From b91984fbcd267c2618dd05b8207c66d333b5d230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Smoli=C5=84ski?= Date: Wed, 25 Nov 2026 17:36:09 +0100 Subject: [PATCH] IAPL rename: docs, agent guide, skills, reference site and starter on the new names; changelog draft MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- README.md | 28 +- docs/CHANGELOG.md | 46 ++- docs/README.md | 14 +- docs/access.md | 38 +- docs/accessibility.md | 2 +- docs/agent/AGENT.md | 379 ++++++++++-------- docs/agent/reference-site/INDEX.md | 52 +-- docs/agent/skills/iapl-audit/SKILL.md | 20 +- docs/agent/skills/iapl-audit/scripts/audit.sh | 48 +-- .../iapl-audit/scripts/polish-literals.mjs | 4 +- docs/agent/skills/iapl-block/SKILL.md | 16 +- .../iapl-block/resources/section-code.md | 6 +- docs/agent/skills/iapl-collection/SKILL.md | 14 +- docs/agent/skills/iapl-consent-check/SKILL.md | 28 +- .../scripts/consent-check.mjs | 12 +- .../scripts/cookie-scan.mjs | 4 +- .../scripts/import-cookies.ts | 2 +- docs/agent/skills/iapl-debug/SKILL.md | 72 ++-- docs/agent/skills/iapl-doctor/SKILL.md | 38 +- docs/agent/skills/iapl-form/SKILL.md | 28 +- .../skills/iapl-form/resources/FormBlock.tsx | 4 +- .../skills/iapl-form/resources/actions.ts | 2 +- .../iapl-form/resources/seed-form.template.ts | 2 +- docs/agent/skills/iapl-locale-add/SKILL.md | 22 +- .../scripts/locale-coverage.ts | 6 +- .../agent/skills/iapl-migrate-fields/SKILL.md | 10 +- .../migrate-block-fields.template.ts | 2 +- docs/agent/skills/iapl-nav/SKILL.md | 12 +- .../skills/iapl-nav/resources/nav-code.md | 4 +- docs/agent/skills/iapl-plugin-gap/SKILL.md | 24 +- docs/agent/skills/iapl-reference/SKILL.md | 92 ++--- .../skills/iapl-reference/resources/api.md | 106 ++--- docs/agent/skills/iapl-seo-check/SKILL.md | 10 +- .../iapl-seo-check/scripts/seo-check.mjs | 16 +- docs/agent/skills/iapl-setup/SKILL.md | 135 +++---- .../skills/iapl-setup/resources/DESIGN.md | 4 +- .../skills/iapl-setup/resources/tokens.ts | 2 +- docs/agent/skills/iapl-site/SKILL.md | 80 ++-- .../resources/seed-content.template.ts | 8 +- docs/agent/skills/iapl-upgrade/SKILL.md | 200 +++++---- docs/analytics.md | 8 +- docs/block-library.md | 14 +- docs/blocks.md | 2 +- docs/consent.md | 22 +- docs/construction.md | 4 +- docs/content.md | 2 +- docs/cookie-scanner.md | 42 +- docs/deployment.md | 34 +- docs/design-tokens.md | 34 +- docs/dev/PROGRAMISTA.md | 119 +++--- docs/dev/admin-ux.md | 6 +- docs/dev/rename-iapl-plan.md | 2 +- docs/dev/vibe.md | 68 ++-- docs/doctor.md | 88 ++-- docs/email.md | 2 +- docs/env.md | 46 ++- docs/forms.md | 34 +- docs/gtm-meta-pixel.md | 2 +- docs/hooks.md | 14 +- docs/i18n.md | 14 +- docs/integrations.md | 6 +- docs/lightbox.md | 8 +- docs/links.md | 10 +- docs/mcp.md | 4 +- docs/notifications.md | 8 +- docs/pages.md | 2 +- docs/payload-helpers.md | 6 +- docs/project-starter.md | 61 +-- docs/richtext.md | 2 +- docs/security.md | 108 ++--- docs/seeding.md | 24 +- docs/seo.md | 24 +- docs/slug.md | 2 +- docs/stats.md | 21 +- docs/storage.md | 6 +- docs/theme.md | 6 +- docs/turnstile.md | 26 +- docs/white-label.md | 10 +- .../{ipal-audit => iapl-audit}/SKILL.md | 20 +- .../resources/smoke.spec.template.ts | 0 .../scripts/audit.sh | 48 +-- .../scripts/html-check.mjs | 0 .../scripts/jsx-text.mjs | 0 .../scripts/panel-check.mjs | 0 .../scripts/polish-literals.mjs | 4 +- .../{ipal-block => iapl-block}/SKILL.md | 16 +- .../resources/section-code.md | 6 +- .../SKILL.md | 14 +- .../SKILL.md | 28 +- .../scripts/consent-check.mjs | 12 +- .../scripts/cookie-scan.mjs | 4 +- .../scripts/import-cookies.ts | 2 +- .../{ipal-debug => iapl-debug}/SKILL.md | 72 ++-- .../{ipal-doctor => iapl-doctor}/SKILL.md | 38 +- .../skills/{ipal-form => iapl-form}/SKILL.md | 28 +- .../resources/CustomForm.example.tsx | 0 .../resources/FormBlock.tsx | 4 +- .../resources/actions.ts | 2 +- .../resources/formClasses.ts | 0 .../resources/seed-form.template.ts | 2 +- .../SKILL.md | 22 +- .../scripts/locale-coverage.ts | 6 +- .../SKILL.md | 10 +- .../migrate-block-fields.template.ts | 2 +- .../skills/{ipal-nav => iapl-nav}/SKILL.md | 12 +- .../resources/nav-code.md | 4 +- .../SKILL.md | 24 +- .../SKILL.md | 92 ++--- .../resources/api.md | 106 ++--- .../SKILL.md | 10 +- .../scripts/seo-check.mjs | 16 +- .../{ipal-setup => iapl-setup}/SKILL.md | 135 +++---- .../resources/DESIGN.md | 4 +- .../resources/tokens.ts | 2 +- .../skills/{ipal-site => iapl-site}/SKILL.md | 80 ++-- .../resources/seed-content.template.ts | 8 +- .../{ipal-upgrade => iapl-upgrade}/SKILL.md | 200 +++++---- reference/.env.example | 10 +- reference/AGENTS.md | 26 +- reference/DESIGN.md | 4 +- reference/README.md | 6 +- reference/docs/DEPLOY.md | 8 +- reference/e2e/late-staff-fixture.ts | 8 +- reference/e2e/late-staff.spec.ts | 2 +- reference/e2e/two-factor-back.spec.ts | 2 +- .../{ipal-doctor.json => iapl-doctor.json} | 0 reference/next.config.ts | 2 +- reference/package.json | 4 +- .../src/app/(frontend)/[locale]/actions.ts | 2 +- .../app/(frontend)/[locale]/design/page.tsx | 2 +- reference/src/collections/CaseStudies.ts | 2 +- .../src/components/design/TokenPanel.tsx | 8 +- reference/src/components/forms/formClasses.ts | 2 +- reference/src/components/layout/Header.tsx | 2 +- reference/src/components/layout/MobileNav.tsx | 2 +- reference/src/design/tokens.css | 4 +- reference/src/globals/Footer.ts | 2 +- reference/src/globals/Header.ts | 2 +- reference/src/instrumentation.ts | 8 +- reference/src/lib/content.ts | 4 +- reference/src/lib/globals.ts | 2 +- reference/src/payload.config.ts | 13 +- reference/src/seed/demo.ts | 10 +- reference/src/seed/forms.ts | 2 +- reference/src/seed/index.ts | 4 +- reference/starter.manifest.json | 4 +- scripts/starter-gate.mjs | 4 +- src/modules/doctor/rules/tooling.ts | 4 + test/docsConsistency.test.ts | 6 +- 149 files changed, 1930 insertions(+), 1747 deletions(-) rename reference/.agents/skills/{ipal-audit => iapl-audit}/SKILL.md (74%) rename reference/.agents/skills/{ipal-audit => iapl-audit}/resources/smoke.spec.template.ts (100%) rename reference/.agents/skills/{ipal-audit => iapl-audit}/scripts/audit.sh (92%) rename reference/.agents/skills/{ipal-audit => iapl-audit}/scripts/html-check.mjs (100%) rename reference/.agents/skills/{ipal-audit => iapl-audit}/scripts/jsx-text.mjs (100%) rename reference/.agents/skills/{ipal-audit => iapl-audit}/scripts/panel-check.mjs (100%) rename reference/.agents/skills/{ipal-audit => iapl-audit}/scripts/polish-literals.mjs (97%) rename reference/.agents/skills/{ipal-block => iapl-block}/SKILL.md (83%) rename reference/.agents/skills/{ipal-block => iapl-block}/resources/section-code.md (98%) rename reference/.agents/skills/{ipal-collection => iapl-collection}/SKILL.md (84%) rename reference/.agents/skills/{ipal-consent-check => iapl-consent-check}/SKILL.md (87%) rename reference/.agents/skills/{ipal-consent-check => iapl-consent-check}/scripts/consent-check.mjs (94%) rename reference/.agents/skills/{ipal-consent-check => iapl-consent-check}/scripts/cookie-scan.mjs (98%) rename reference/.agents/skills/{ipal-consent-check => iapl-consent-check}/scripts/import-cookies.ts (97%) rename reference/.agents/skills/{ipal-debug => iapl-debug}/SKILL.md (82%) rename reference/.agents/skills/{ipal-doctor => iapl-doctor}/SKILL.md (59%) rename reference/.agents/skills/{ipal-form => iapl-form}/SKILL.md (92%) rename reference/.agents/skills/{ipal-form => iapl-form}/resources/CustomForm.example.tsx (100%) rename reference/.agents/skills/{ipal-form => iapl-form}/resources/FormBlock.tsx (92%) rename reference/.agents/skills/{ipal-form => iapl-form}/resources/actions.ts (86%) rename reference/.agents/skills/{ipal-form => iapl-form}/resources/formClasses.ts (100%) rename reference/.agents/skills/{ipal-form => iapl-form}/resources/seed-form.template.ts (99%) rename reference/.agents/skills/{ipal-locale-add => iapl-locale-add}/SKILL.md (82%) rename reference/.agents/skills/{ipal-locale-add => iapl-locale-add}/scripts/locale-coverage.ts (95%) rename reference/.agents/skills/{ipal-migrate-fields => iapl-migrate-fields}/SKILL.md (92%) rename reference/.agents/skills/{ipal-migrate-fields => iapl-migrate-fields}/resources/migrate-block-fields.template.ts (98%) rename reference/.agents/skills/{ipal-nav => iapl-nav}/SKILL.md (76%) rename reference/.agents/skills/{ipal-nav => iapl-nav}/resources/nav-code.md (98%) rename reference/.agents/skills/{ipal-plugin-gap => iapl-plugin-gap}/SKILL.md (79%) rename reference/.agents/skills/{ipal-reference => iapl-reference}/SKILL.md (88%) rename reference/.agents/skills/{ipal-reference => iapl-reference}/resources/api.md (92%) rename reference/.agents/skills/{ipal-seo-check => iapl-seo-check}/SKILL.md (79%) rename reference/.agents/skills/{ipal-seo-check => iapl-seo-check}/scripts/seo-check.mjs (97%) rename reference/.agents/skills/{ipal-setup => iapl-setup}/SKILL.md (89%) rename reference/.agents/skills/{ipal-setup => iapl-setup}/resources/DESIGN.md (93%) rename reference/.agents/skills/{ipal-setup => iapl-setup}/resources/tokens.ts (95%) rename reference/.agents/skills/{ipal-site => iapl-site}/SKILL.md (78%) rename reference/.agents/skills/{ipal-site => iapl-site}/resources/seed-content.template.ts (95%) rename reference/.agents/skills/{ipal-upgrade => iapl-upgrade}/SKILL.md (85%) rename reference/{ipal-doctor.json => iapl-doctor.json} (100%) diff --git a/README.md b/README.md index eec9137..cb4205e 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,15 @@ -# @intecion/ipal-kit +# IAPL (`@intecion/ipal-kit`) -Intecion Payload Advanced Library — a plugin for Payload CMS 3. +IAPL, the Intecion Advanced Payload Library — a plugin for Payload CMS 3. It was called ipal-kit before 1.17.0; +the package name, `@intecion/ipal-kit`, is unchanged, and every older name keeps working +([names table](./docs/agent/AGENT.md#names-iapl-and-ipal-kit)). Provides internationalization (per-locale routing, hreflang, language switcher), SEO (metadata, canonical, sitemap, robots), forms (Turnstile, rate limiting, validation), consent management (consent mode), analytics (GA4/GTM), and a blog/archive system (collections under an archive page, listing, pagination). -**Principle:** ipal-kit helps projects, never limits them — every module can be +**Principle:** IAPL helps projects, never limits them — every module can be turned off on its own, every default (access, fields, hooks, labels, routes, collections, globals) can be overridden and the project's config wins, and the building blocks are exported, not only the finished features. Where the code @@ -50,7 +52,7 @@ You *can* install straight from the repo quick throwaway test it works. But prefer the registry for real projects: - **Client components resolve correctly.** A git install unpacks into a - commit-hashed path (`.pnpm/@intecion+ipal-kit@git+https…#hash/…`) that breaks + commit-hashed path (`.pnpm/@intecion+IAPL@git+https…#hash/…`) that breaks Next.js's React Client Manifest — the consent banner, analytics, and Turnstile components fail at runtime with "Could not find the module … in the React Client Manifest". The registry unpacks to a clean `node_modules/@intecion/…` @@ -89,7 +91,7 @@ your project — in a version matching your Payload. The plugin accepts Payload | `payload`, `@payloadcms/next`, `@payloadcms/ui`, `@payloadcms/richtext-lexical` | `^3.90.2` | already in a `create-payload-app` project | | `next`, `react` | `>=15`, `^19.0.0` | already in a `create-payload-app` project | | `@payloadcms/plugin-seo`, `@payloadcms/plugin-form-builder` | `^3.90.2` | **add these** | -| `@clocklimited/payload-2fa` | `^3.0.0-0` | optional peer, but **needed by default**: 2FA is enforced and `ipalKit()` throws at startup unless you pass `twoFactor: { issuer, plugin: payloadTotp }` (or opt out with `twoFactor: false`) | +| `@clocklimited/payload-2fa` | `^3.0.0-0` | optional peer, but **needed by default**: 2FA is enforced and `iapl()` throws at startup unless you pass `twoFactor: { issuer, plugin: payloadTotp }` (or opt out with `twoFactor: false`) | | `@payloadcms/storage-s3` | `^3.90.2` | optional — only when media go to Cloudflare R2 ([docs/storage.md](./docs/storage.md)) | ```bash @@ -115,19 +117,19 @@ placeholders also use the `sharp` you pass to `buildConfig({ sharp })` **Working with an AI agent?** Run this right after installing (and after every upgrade): ```bash -pnpm exec ipal-skills +pnpm exec iapl-skills ``` -It copies the `ipal-*` agent skills into `.agents/skills/` and adds a marked -`` block to `AGENTS.md` (plus a `CLAUDE.md` that imports it, if you -have none) pointing the agent at the full guide: `AGENT.md`, the `ipal-reference` skill -(every option, env var, route and export) and the `ipal-setup` skill. Only the text between +It copies the `iapl-*` agent skills into `.agents/skills/` and adds a marked +`` block to `AGENTS.md` (plus a `CLAUDE.md` that imports it, if you +have none) pointing the agent at the full guide: `AGENT.md`, the `iapl-reference` skill +(every option, env var, route and export) and the `iapl-setup` skill. Only the text between the markers is ever rewritten. `--no-pointer` skips that step. There is no `postinstall` script. -`pnpm exec ipal-skills --external` also adds a few well-known third-party skills as `ext-*` folders — Vercel's +`pnpm exec iapl-skills --external` also adds a few well-known third-party skills as `ext-*` folders — Vercel's React best practices and composition patterns, Addy Osmani's accessibility skill, Anthropic's frontend-design skill and the official Payload 3 skill. They are vendored into the package at pinned commits (text only, each -with its licence and source), so nothing is downloaded, and each starts with a note that ipal-kit's rules win. +with its licence and source), so nothing is downloaded, and each starts with a note that IAPL's rules win. Pick some with `--external ext-accessibility,ext-payload`. *Updating the pins (plugin maintainers):* change the commit in `scripts/vendor-external-skills.mjs`, run @@ -194,7 +196,7 @@ Everything lives in the **[docs/](./docs)** directory. To get started: | `404` on `pnpm add @intecion/...` | the `@intecion:registry` line is missing from `.npmrc` — the install went to public npm instead of Gitea | | `Could not find the module … in the React Client Manifest` | installed from git, not the registry — reinstall from the registry (clean path) | | two versions of `lucide-react` | your project uses a `lucide-react` outside the plugin's `^0.400.0` (= `0.400.x`) — align them | -| `[ipal] 2FA is enforced but no 2FA plugin was injected` | install `@clocklimited/payload-2fa` and pass `twoFactor: { issuer, plugin: payloadTotp }` | +| `[iapl] 2FA is enforced but no 2FA plugin was injected` | install `@clocklimited/payload-2fa` and pass `twoFactor: { issuer, plugin: payloadTotp }` | | `missing secret key … to secure Payload` | `PAYLOAD_SECRET` isn't set in the runtime environment (not a plugin issue) | If you get stuck, see **[docs/dev/PROGRAMISTA.md](./docs/dev/PROGRAMISTA.md)** or message the diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 281f607..6f86e4b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,13 +1,55 @@ # Changelog -Changes that matter for projects built on ipal-kit. How to move to a new version: the -**ipal-upgrade** skill and [PROGRAMISTA.md §6](./dev/PROGRAMISTA.md). +Changes that matter for projects built on IAPL (called ipal-kit before 1.17.0; entries below that version keep the +names their release had: `ipalKit`, `ipal-doctor`, `IPAL_*` and the `ipal-*` skills are the `iapl` names of today). +How to move to a new version: the **iapl-upgrade** skill and [PROGRAMISTA.md §6](./dev/PROGRAMISTA.md). We keep at least the **20 most recent versions** here. When you upgrade a project by several versions at once, go through every "Requires project changes" section in order, starting from the version you have. A new release = a new section at the top; we remove the oldest ones only once there are more than 20. +## 1.17.0 — the plugin is called IAPL (draft) + +> **Read before upgrading.** Nothing has to change in a project. The plugin's name is now **IAPL** (Intecion +> Advanced Payload Library); it was ipal-kit. **The package is still `@intecion/ipal-kit`**, and every name a +> project uses keeps working. No option, schema, migration or import-map change. This release also carries the +> security follow-ups listed under 1.16.8 below (prepared, not released on their own). + +### Requires project changes +- **Nothing.** Recommended after the update: `pnpm exec iapl-skills` (or the project's `ipal:skills` script) and commit — + the skills are named `iapl-*` now; the 16 old `ipal-*` folders are removed by name, a project's own `ipal-…` skill + stays, and the pointer block in `AGENTS.md` is rewritten in place. +- **A log filter or alert on `[ipal]`:** the log prefix is `[iapl]`. + +### Changed +- **New names beside the old ones** (the old ones are deprecated and go in 2.0): + `iapl()` for `ipalKit()`, `IaplOptions`, `iaplEnvRules`, `IaplEnvFeatures`, `iaplT`, `iaplVar`, `IAPL_TOKENS`, + `IAPL_BREAKPOINTS`, `IaplTokenName`, `IaplGlobalSlug`; commands `iapl`, `iapl-doctor`, `iapl-skills`, `iapl-tokens`, + `iapl-blocks` (the `ipal-*` commands are the same programs); env `IAPL_`, with `IPAL_` read when the new + one is missing or empty; `iapl-doctor.json` (an existing `ipal-doctor.json` is read and written as before); + `iapl-audit-skip:`; the pointer block ``. +- **Not renamed:** the package and its import paths, import-map paths, routes `/api/ipal/*`, CSS tokens `--ipal-*`, + `data-ipal` hooks, `config.custom.ipal`, `req.context` flags, the `ipal` translation namespace, the header + `X-Ipal-Cookie-Crawler`. They change, with a migration path, in 2.0. +- Docs, the agent guide and the skills use the new names; `AGENT.md` has one table of old and new names + ("Names: IAPL and ipal-kit"). +- Audit findings whose titles named a command (`iapl-tokens --check`, "forms in iapl", `IAPL_IP_HEADER in .env.example`) + keep their doctor rule ids, so settings in a project's doctor file still match. + +### Added +- **`iapl-doctor` rule `legacy-names`** (info): lists the old names a project still uses, each with the new one. + Information, not a defect. A warning only for `iapl-doctor.json` and `ipal-doctor.json` side by side, or one variable + set as `IAPL_…` and `IPAL_…` with different values (the `IAPL_` one is read). +- **`storageNames: 'ipal' | 'iapl'`** (default `'ipal'`) for the two names the plugin stores: the statistics visitor + cookie the cookie scanner declares (`ipal_vid` / `iapl_vid`) and the 2FA attempt counter's key in `payload-kv` + (`ipal:2fa-verify:…` / `iapl:2fa-verify:…`). **Sites made with `iapl create` from this version on get `'iapl'`; + existing sites change nothing** — same cookie, same cookie list, same counters. With it: ``, + `IAPL_VISITOR_COOKIE`, `visitorCookieFor`, `twoFactor.verifyLimit.keyPrefix`, and the doctor rule `storage-names` + (the cookie the layout sets is the one the scanner declares). Withdrawing consent deletes the cookie under either name. + Not a switch for a live site: it would start visitors' histories and the running 2FA counts again. +- `EnvRule.aliases` for `assertEnv`: older names of a variable, read when the main one is missing. + ## 1.16.8 — security follow-ups to 1.16.7 > **Read before upgrading.** No option, schema, migration or import-map change. Three points: diff --git a/docs/README.md b/docs/README.md index 1da81cf..050785c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,8 +1,8 @@ # @intecion/ipal-kit documentation -All ipal-kit docs, the agent guide and the agent skills are written in English. +All IAPL docs, the agent guide and the agent skills are written in English. -**Main rule — the plugin helps, never limits:** ipal-kit is a plugin — it helps projects and never +**Main rule — the plugin helps, never limits:** IAPL is a plugin — it helps projects and never limits them. Every module can be turned off on its own, every default can be overridden (the project config wins), safe defaults have an option to relax them, and the plugin exports building blocks (helpers, builders, hooks), not only finished features. Every module page has a "Turn off, override, @@ -11,9 +11,9 @@ extend" section that describes the current code. | Who you are | Read | |---|---| | **AI agent** working in a project | [AGENT.md](./agent/AGENT.md) — rules, structure, building sections, checks before "done" | -| **AI agent — skills** | [agent/skills/](./agent/skills) — 15 `ipal-*` skills for Antigravity/Claude Code, including `ipal-reference` (full map of the plugin and every export), `ipal-setup` (complete installation), `ipal-site` (a site from brief to report) and the check scripts (copied into the project: `pnpm exec ipal-skills`, AGENT.md §14) | +| **AI agent — skills** | [agent/skills/](./agent/skills) — 15 `iapl-*` skills for Antigravity/Claude Code, including `iapl-reference` (full map of the plugin and every export), `iapl-setup` (complete installation), `iapl-site` (a site from brief to report) and the check scripts (copied into the project: `pnpm exec iapl-skills`, AGENT.md §14) | | **Developer** | [PROGRAMISTA.md](./dev/PROGRAMISTA.md) — installation, new project, env, deployment, upgrades, releasing the plugin, Gitea; deployment and health check: [deployment.md](./deployment.md) | -| **Person driving an AI agent** | [vibe.md](./dev/vibe.md) — autonomous mode (`/ipal-site`) and ready-made step-by-step prompts | +| **Person driving an AI agent** | [vibe.md](./dev/vibe.md) — autonomous mode (`/iapl-site`) and ready-made step-by-step prompts | API details — one file per module: @@ -29,7 +29,7 @@ API details — one file per module: | Under construction — locks subpages behind a popup (developer tool) | [construction.md](./construction.md) | | Routing, archives, redirects, Markdown, search | [content.md](./content.md) | | Site frontend: `createContentHelpers` (`@/lib/content`), `createPageRoute`, `SiteProviders` | [frontend.md](./frontend.md) | -| New site in one command (`ipal-kit create`, `@intecion/ipal-kit/starter`) | [project-starter.md](./project-starter.md) | +| New site in one command (`iapl create`, `@intecion/ipal-kit/starter`) | [project-starter.md](./project-starter.md) | | Deployment, production variables, health check | [deployment.md](./deployment.md) | | Seeds: create-only, dry run, backup, production update guard | [seeding.md](./seeding.md) | | Email SMTP / Graph | [email.md](./email.md) | @@ -52,10 +52,10 @@ API details — one file per module: | Stats in the admin panel (no cookies; visitor history with consent) | [stats.md](./stats.md) | | Auto-slug | [slug.md](./slug.md) | | Light / dark theme, switcher | [theme.md](./theme.md) | -| Design tokens (`--ipal-*`, `tokens.css`, `tailwind.css`, `ipal-tokens`, DESIGN.md) | [design-tokens.md](./design-tokens.md) | +| Design tokens (`--ipal-*`, `tokens.css`, `tailwind.css`, `iapl-tokens`, DESIGN.md) | [design-tokens.md](./design-tokens.md) | | R2, `buildImagesConfig`, `MediaPreconnect`, `YouTubeEmbed` | [storage.md](./storage.md) | | Turnstile | [turnstile.md](./turnstile.md) | -| ipal-doctor (the site against the team standard, `ipal-doctor.json`) | [doctor.md](./doctor.md) | +| iapl-doctor (the site against the team standard, `iapl-doctor.json`) | [doctor.md](./doctor.md) | | Admin panel white-label | [white-label.md](./white-label.md) | Maintenance rule: a module's API changes → update its file in the same commit. New working rules → diff --git a/docs/access.md b/docs/access.md index e184000..4f4f6ed 100644 --- a/docs/access.md +++ b/docs/access.md @@ -7,7 +7,7 @@ predicates and ready access functions (collection-level and field-level). ## Config (payload.config.ts) ```ts -ipalKit({ +iapl({ access: { authCollection: 'users', // slug of your auth collection (required) // defaultRole: 'user', // role of new accounts @@ -50,7 +50,7 @@ only checks that someone is logged in. ```ts import { authenticated } from '@intecion/ipal-kit' -ipalKit({ +iapl({ access: { authCollection: 'users', authAccess: { read: authenticated } }, // editors see the account list globalOverrides: { notifications: { access: { update: authenticated } }, // any logged-in account edits the texts @@ -99,8 +99,8 @@ What follows: `access.staffCollections`. That is the one switch that makes its roles count. Without a `roles` field every partner passes every staff check, admin ones included; to tell them apart add the field: `fields: [buildRolesField('editor')]` in that collection. **2FA covers one collection** (`twoFactor.collectionSlug`, - by default the panel's): accounts of a further staff collection are staff with a password alone. ipalKit says - so in the log at start (`[ipal] 2FA covers "users" only…`); name such a collection only when that is acceptable. + by default the panel's): accounts of a further staff collection are staff with a password alone. iapl says + so in the log at start (`[iapl] 2FA covers "users" only…`); name such a collection only when that is acceptable. - **Payload's own default** for a collection or global without `access` is "any logged-in account" — an account of a visitor collection included. In a project with a second auth collection give every collection and global explicit `access` (`adminOrEditor`, `requireRole(…)`, …). @@ -134,7 +134,7 @@ which collections are staff: | Where you call it | Pass | Without it | |---|---|---| -| access functions, hooks, endpoints (server, the config is loaded) | `req.payload` | works: the staff collections of the config `ipalKit` built in this process. With two different configs in one process, only collections that are staff in **both** count — pass `req.payload` to get that config's own answer | +| access functions, hooks, endpoints (server, the config is loaded) | `req.payload` | works: the staff collections of the config `iapl` built in this process. With two different configs in one process, only collections that are staff in **both** count — pass `req.payload` to get that config's own answer | | client components — import from **`@intecion/ipal-kit/client`** | the config from `useConfig()` (it has `admin.user`, the panel's login collection), or `{ staffCollections: ['users', …] }` | **always `false`** — the browser bundle has no config | | Next middleware / `proxy.ts`, the edge runtime | `{ staffCollections: ['users'] }` | **always `false`** — the config is not loaded there | @@ -222,15 +222,15 @@ injectRoles(config, { authCollection: 'members' }) // add the field to a applyGlobalOverrides(globals, { notifications: { … } }) // the same logic as the globalOverrides option ``` -Types: `AccessOption`, `Role`, `GlobalOverride`, `GlobalOverrides`, `IpalGlobalSlug`. +Types: `AccessOption`, `Role`, `GlobalOverride`, `GlobalOverrides`, `IaplGlobalSlug`. ## Account rules (`accounts`) Rules for the accounts of the staff collection. All on by default; each has its own switch, and -`ipalKit({ accounts: false })` turns them all off. +`iapl({ accounts: false })` turns them all off. ```ts -ipalKit({ +iapl({ access: { authCollection: 'users' }, // accounts: { panelRole: 'user' }, // every account may open the panel (as before) // accounts: { adminOnlyCreate: false }, // Payload's default `create` on your own staff collection @@ -251,7 +251,7 @@ account that holds only `user` (or no role) logs in and sees Payload's "Unauthor touched** — such an account still gets over REST / GraphQL what its role allows. The rule looks at the role, not at the second factor, so the 2FA screens stay reachable. -- **What an existing site sees on the first start:** the log line `[ipal] N account(s) of "users" are below the +- **What an existing site sees on the first start:** the log line `[iapl] N account(s) of "users" are below the role "editor" and cannot open the admin panel` — give those people `editor`, or set `panelRole: 'user'`. When **no** account has the role it is an error (`NOBODY can open the admin panel`): give one account the role with a script (`payload.update`, Local API) or set `accounts: { panelRole: false }` and redeploy. @@ -324,11 +324,11 @@ declared values, not your code: a value that a hook of yours puts into `roles` ( `['admin']` from a checkbox, a virtual field) is not seen — such a collection is judged by its declared field. **If no staff account holds `admin` at all**, nobody can create, delete or unlock accounts in such a collection. -The start log says so: `[ipal] No staff account holds the role "admin", so NOBODY can create, delete or unlock +The start log says so: `[iapl] No staff account holds the role "admin", so NOBODY can create, delete or unlock accounts in "…"`. Way out: give one account the role with a script (`payload.update`, Local API), or write the collection's own rules. The check asks each staff collection in the way its field allows (a count for a select, reading the accounts for text / json / relationship fields, up to 1000 of them); where it cannot check a -collection it says `[ipal] Could not check whether an account of "…" holds the role "admin"` instead and claims +collection it says `[iapl] Could not check whether an account of "…" holds the role "admin"` instead and claims nothing. **Roles of your own — what the plugin does and does not hold.** It cannot rank `superadmin` against `writer`, @@ -336,16 +336,16 @@ so inside such a collection it enforces one thing only: an account does not chan else that was allowed inside the collection stays allowed — **every account of it may still create an account with any role, and change or delete another account**. That is a hole only you can close: write the collection's `create` / `update` / `delete` rules and the field access of its `roles` field from your roles. -`ipal-doctor --url` names such a collection (`staff-own-roles`, warning). What the plugin closes for you is the +`iapl-doctor --url` names such a collection (`staff-own-roles`, warning). What the plugin closes for you is the door for accounts of **other** collections. **A staff collection without a `roles` field:** every account of it is an admin to the plugin (unchanged), so it may also manage the accounts of the other staff collections. Give it the plugin's roles (`buildRolesField`), or write its rules. -**A staff collection that a plugin listed after ipalKit adds** gets the same rules, the password rule and the +**A staff collection that a plugin listed after iapl adds** gets the same rules, the password rule and the first-user endpoint when the config goes live — at start and on every dev reload. The log says exactly what was -put: `[ipal] "late-staff" was added after ipalKit: put on it — access rules for create, update, delete, unlock, +put: `[iapl] "late-staff" was added after iapl: put on it — access rules for create, update, delete, unlock, read, readVersions, roles; the password rule; the first-user endpoint.` One difference from a collection of your own config: by then Payload has sanitized the collection and filled every missing rule with its default, and that default cannot be told from a rule somebody wrote (a production build renames every function). So the @@ -353,18 +353,18 @@ plugin does not guess: **its rule is put in front of whatever rule is there, and (`bothAllow`). With Payload's default behind it the result is the plugin's rule; a rule of the collection's own is kept and can only narrow it. To keep a late collection's rules exactly as they are — an open `create`, a wider `read` — say so on the collection: `custom: { ipal: { accountRules: false } }` (the password rule and the -first-user endpoint still apply), or list that plugin before ipalKit. +first-user endpoint still apply), or list that plugin before iapl. **A collection of your own config that becomes staff later** — it is in the config, you did not name it as staff, -and a plugin listed after ipalKit sets `admin.user` to it — is handled at the same moment, with one difference: +and a plugin listed after iapl sets `admin.user` to it — is handled at the same moment, with one difference: the plugin saw it at config time and wrote down which operations had a rule of yours (the marker's `own`). **Those rules stay exactly as written; an operation that had no rule gets the plugin's** — the same result as for a collection named in `access.staffCollections`, and its `roles` field is guarded where the plugin's `update` rule -is the one in force. The log: `[ipal] "people" became a staff collection after ipalKit ran: put on it — access +is the one in force. The log: `[iapl] "people" became a staff collection after iapl ran: put on it — access rules for update, delete, unlock, read, readVersions, roles; the password rule. Its own rules for create are kept as written.` Without rules of its own such a collection ran on Payload's defaults before (any signed-in account, a customer included, created and changed panel accounts). Simpler and clearer: name the collection in -`access.staffCollections`, or list that plugin before ipalKit. Verify: sign in as an account of a non-staff +`access.staffCollections`, or list that plugin before iapl. Verify: sign in as an account of a non-staff collection and `POST /api/` — 403 unless your own `create` rule lets it through. **A copy of a staff collection** — a later plugin that spreads one into a new slug (`{ ...staff, slug: 'copy' }`), @@ -433,7 +433,7 @@ container serving, so a wrong slug never goes live (`unknownStaffCollections`). - **What an existing site sees:** nothing, unless its own staff collection relied on Payload's defaults (non-admins creating accounts in a collection with the plugin's roles; accounts of another collection writing to it) — then write the rule you want, or set `adminOnlyCreate: false` / `adminOnlyWrite: false`. -- `ipal-doctor --url`: `open-signup` (info) lists auth collections with open sign-up; `staff-own-roles` (warning) +- `iapl-doctor --url`: `open-signup` (info) lists auth collections with open sign-up; `staff-own-roles` (warning) a staff collection with role values of its own on the default rules; `staff-accounts-open` (error) names a staff collection an account of another collection may create in, read (a warning), update, delete from or unlock (the rules are off, or your own rule is wider). diff --git a/docs/accessibility.md b/docs/accessibility.md index daeaa9a..b62a8ec 100644 --- a/docs/accessibility.md +++ b/docs/accessibility.md @@ -225,7 +225,7 @@ sell the client "we have a widget = we are WCAG compliant". See [dev/PROGRAMISTA ## Turn off, override, extend - **Turn off:** the module is opt-in — without `AccessibilityProvider` / `AccessibilityWidget` nothing happens - (no option in `ipalKit`, no fields in the panel). + (no option in `iapl`, no fields in the panel). - **Override:** the widget's `classNames` and `texts`; the whole look of the effects is project CSS. - **Extend:** your own UI on `useAccessibility()` (`state`, `set`, `reset`); SSR helpers `parseA11y` / `a11yAttributes` / `serializeA11y` / `A11Y_DEFAULT`. The option set (`A11yState`) currently diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index 437d281..c2bcfc5 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -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/.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 `` … `` | `` … `` | both recognised; `iapl-skills` rewrites the old one in place | +| skills `ipal-` (16) | `iapl-` | `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 `` / `` | +| 2FA attempt counter in `payload-kv` | `ipal:2fa-verify::` | `iapl:2fa-verify::` | + +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@ create ` 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 : docs/plugin-requests/` and is recorded in + it, is marked `// WORKAROUND IAPL : docs/plugin-requests/` 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
`, with ISR and `generateStaticParams`** — otherwise metadata lands in `` 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()` + ``, upload + ``, `
` + ``. No `ctaLabel`/`pdfUrl` fields. @@ -163,18 +206,18 @@ export function Offer({ header, items }: OfferBlockProps) { return
/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 ``, 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//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 ``, 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
`); `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`; ``; `images: buildImagesConfig()` and `buildUploadSecurityHeaders()` in `next.config.ts`; the project's `` 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 `` + `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 `` + `formClasses.ts` (look, once); `actions.ts` = `createSubmitAction({ getCachedPayload, headers })`; `forms: {…}` in `iapl`; `email: mailAdapter()` | `RenderForm` (`/rsc`), `createSubmitAction`, `mailAdapter` | A, P | | 11 | **Turnstile** | `` 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'` (`` — 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) + `}>` (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 `` 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'` (`` — 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) + `}>` (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 `` 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 ``, 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 : …`) 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 : …`) 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: `` (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 ; + 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 `
`). 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 `` 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..ipal.` (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` + `` (`/admin`; + components: `iaplT`, `formatNumber`, `formatDateTime`, `defineTexts`, `ADMIN_LANGUAGES`, + `applyAdminI18n` (already applied by `iapl`), `adminDocumentTitle` + `` (`/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) — `` around the thumbnail (a client component you render from a server block with plain `lightboxImage(…)` data), - one ``, labels from Form messages → Image viewer (lightbox.md). `ipal-audit` + one ``, 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 + ``; **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 `` (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 `` from `/rsc` — never your own `` in the admin panel = XSS) | seo.md | | 15i | own `clamp()` formulas in `styles.css` | `@import "@intecion/ipal-kit/fluid.css"` + mapping in `@theme` (§2.5) | — | -| 15j | the form front end sends `fetch('/api/form-submissions')` (from this version REST returns 403 for anonymous users) | rewrite as a server action + `submitForm` (skill `ipal-form`) | forms.md | +| 15j | the form front end sends `fetch('/api/form-submissions')` (from this version REST returns 403 for anonymous users) | rewrite as a server action + `submitForm` (skill `iapl-form`) | forms.md | | 15k | Turnstile secret saved by code (`updateGlobal` in `onInit` / an action) or own `verify` without `remoteip` | delete the workaround: secret in the admin panel or env `TURNSTILE_SECRET_KEY`; the plugin does not send `remoteip` and logs the rejection reason | turnstile.md | | 15l | a Turnstile outage blocked forms | nothing in the project: on an error on our side the plugin accepts the submission and shows an alert in the admin panel; `generate:importmap`, Postgres: `migrate:create` | turnstile.md | | 15m | own plugin moving Notifications into a group; `formOverrides`/`formSubmissionOverrides` only for labels and the admin group | delete — the plugin itself puts Form messages in the "Forms" group, and forms → the "Forms" group with labels (`forms.adminGroup`) | forms.md | @@ -627,14 +627,14 @@ Do one item at a time, build, check. Order by importance: | 17 | **AI/GEO (mandatory since 1.9.0)** | llms.txt + llms-full.txt, the `/md/…` route, `markdownAlternate: true`, `prefersMarkdown` in the proxy, `/api/mcp`, `buildSummaryField`, AI bots allowed — AGENT.md §0b | content.md, seo.md, mcp.md | | 18 | **1.9.0** — `TurnstileProvider siteKey` from `getSiteIntegrations(…).turnstileSiteKey` | `getTurnstileConfig(payload).siteKey`. Note: with both keys set `submitForm` **requires** a token — a form without the widget will be rejected | turnstile.md | | 19 | **1.9.0** — `twoFactor: { issuer }` without `plugin` | add `plugin: payloadTotp` (the fallback with a dynamic import was removed — startup fails with an error) | security.md | -| 20 | **1.9.0** — IP in the form action computed by hand from `x-forwarded-for` | `clientIp(await headers())` + `IPAL_IP_HEADER` in the production env | forms.md | +| 20 | **1.9.0** — IP in the form action computed by hand from `x-forwarded-for` | `clientIp(await headers())` + `IAPL_IP_HEADER` in the production env | forms.md | | 21 | **1.9.0** — media without R2 in production / no `buildR2Storage` | wire `buildR2Storage(['media'], { s3Storage })`, set `R2_*` | storage.md | -| 22 | **1.9.1** — hand-written `actions.ts` / `md` route / no form seed | `createSubmitAction`, `createMarkdownRoute`, seed from `ipal-form` (mail to the company + to the visitor) | forms.md, content.md | +| 22 | **1.9.1** — hand-written `actions.ts` / `md` route / no form seed | `createSubmitAction`, `createMarkdownRoute`, seed from `iapl-form` (mail to the company + to the visitor) | forms.md, content.md | | 23 | **1.9.1** — `createProxy` without `markdown: true` | add it — otherwise `/md/…` redirects to `/pl/md/…` | content.md | | 24 | **1.9.1** — page JSON-LD assembled by hand | `getPageJsonLd`, `buildNavigationJsonLd`, `sameAsUrls`, `formatOpeningHours` | seo.md | | 25 | **1.9.1** — consent: version, log, table | Cookies → Policy version; `consentLog: true` + `logEndpoint`; ``; scan + ``; Postgres: `migrate:create` | consent.md | | 26 | **1.9.1** — media: `priority`, no placeholders, `images` in next.config | `` through `mediaImageProps`/`videoProps`, `buildMediaPlaceholderHook`, `buildImagesConfig`, `buildUploadSecurityHeaders` | media.md, storage.md | -| 27 | **1.9.1** — staging indexed | `IPAL_NOINDEX=1` in the staging env | seo.md | +| 27 | **1.9.1** — staging indexed | `IAPL_NOINDEX=1` in the staging env | seo.md | | 28 | **1.9.2** — own `FormRenderer` (a copy of the engine on `useForm`) | **security:** it passed the whole form document, including the Emails tab, to the browser (company addresses in the HTML). Block → ``, styling into `formClasses.ts`, delete `FormRenderer.tsx`; unusual form → `useBuilderForm` | forms.md | | 29 | **1.9.2** — multi-step forms / choice lists built in code | admin panel: the **Step**, **Radio**, **Checkbox group**, **Date** blocks; Form messages → next / back / stepOf; Postgres: `migrate:create` | forms.md | | 30 | **1.9.2** — layout assembled by hand (ConsentProvider, TurnstileProvider, Analytics, JsonLdGraph, MediaPreconnect) | `` — the same options (banner, analytics, jsonLd, logEndpoint) | PROGRAMISTA §2.8 | @@ -644,7 +644,7 @@ Do one item at a time, build, check. Order by importance: | 34 | **1.11.0** — a copy of `publicForm`, own field renderer with a variant / context | `RenderForm values` or `prepareBuilderForm` + ``; delete the copy | forms.md | | 35 | **1.11.0** — extra "categories" relations next to links, links to entries as URLs | `buildLinkField({ relationTo: ['pages', 'categories'] })` (link data migration) | links.md | | 36 | **1.11.0** — product / category JSON-LD assembled in the project, `jsonLd: false` | `pageJsonLd.entries` + `buildProductJsonLd`, `jsonLd` back on in `createPageRoute` | seo.md | -| 37 | **1.11.0** — own RenderBlocks in the page route only for the first section's `h1`; `storage` in `ipalEnvRules` conditional on NODE_ENV; hand-written `remotePatterns` / `dangerouslyAllowLocalIP` for localhost | `isFirst` from `createPageRoute`; `ipalEnvRules({ storage: true })`; `buildImagesConfig()` | pages.md, env.md, storage.md | +| 37 | **1.11.0** — own RenderBlocks in the page route only for the first section's `h1`; `storage` in `iaplEnvRules` conditional on NODE_ENV; hand-written `remotePatterns` / `dangerouslyAllowLocalIP` for localhost | `isFirst` from `createPageRoute`; `iaplEnvRules({ storage: true })`; `buildImagesConfig()` | pages.md, env.md, storage.md | | 38 | **1.11.1** — `revalidatePath` wrapped in a `process.env.NEXT_RUNTIME` condition (seed / `payload run` failed) | delete the condition — the hook skips revalidation outside Next itself; on purpose: `context: { disableRevalidate: true }` | hooks.md | | 39 | **1.11.1** — focus guard around `RenderForm` (the page scrolled to the form on return) | delete — `BuilderForm` moves focus only when the step changes | forms.md | | 40 | **1.11.1** — own `ThemeScript` / theme switcher / `useSyncExternalStore` on `data-theme` | `` (or ``), ``, `useTheme`; the same `ipal-theme` key — visitors' choice is kept. Postgres: `migrate:create` (`system`, `themeToggleLabel`) | theme.md | @@ -655,32 +655,33 @@ Do one item at a time, build, check. Order by importance: | 45 | **1.11.1** — format description in a form field label / time as text | the **Placeholder** field in the admin panel, the **Time** type; Postgres: `migrate:create` | forms.md | | 46 | **1.12.3** — own cookie settings window / cookie list in the banner written in the project | `` (list from Cookies → Cookie list, captions: Detail labels); delete your own version; Postgres: `migrate:create` | consent.md | | 47 | **1.13.0** — staff access, Search engines, seed scripts, workarounds around plugin globals | without `access`: every logged-in account gets the staff features → `access` or `globalOverrides` / `formOverrides` / `formSubmissionOverrides` / `collectionOverrides`; with `access`: staff need `editor`/`admin`; Postgres: `migrate:create`; check `settingsDepth`, `sitemap()` throwing, 2FA slug, client IP; own seed code → `@intecion/ipal-kit/seed`; global hooks/access plugins → `revalidatePath` / `globalOverrides` | CHANGELOG 1.13.0, AGENT.md §7.1, seo.md, seeding.md | -| 48 | **1.14.0 — image lightbox** — own image modal (`useState(index)` + `div role="dialog"`), `glightbox` / other lightbox library, thumbnails linking to the raw file in a new tab | `ipalKit({ lightbox: true })` + Postgres `migrate:create`; ``; `` around the thumbnail; delete the old dialog and `pnpm remove glightbox`; old label fields → Form messages → Image viewer | lightbox.md → "Replacing a hand-made modal" | -| 49 | **1.14.0** — import map, Node, Next, audit, cookie list, admin languages | `pnpm payload generate:importmap` (`FaviconCheck`, `RowLabel`); Node 20.9+; `next@^16.4.3` + `sharp@^0.35.5` (Next ≤16.4.0 has two RCEs); `pnpm audit --prod` + `dompurify` / `undici` overrides on payload 3.90.x; hand-kept cookie list → `cookieScanner` (+ `crawl`, `IPAL_COOKIE_SCAN_URL` / `IPAL_COOKIE_SCAN_TOKEN`) + `migrate:create`; English-only admin → `i18n.supportedLanguages`; tests on validator strings → full sentences | CHANGELOG 1.14.0, cookie-scanner.md, i18n.md, AGENT.md §4 items 11–12 | +| 48 | **1.14.0 — image lightbox** — own image modal (`useState(index)` + `div role="dialog"`), `glightbox` / other lightbox library, thumbnails linking to the raw file in a new tab | `iapl({ lightbox: true })` + Postgres `migrate:create`; ``; `` around the thumbnail; delete the old dialog and `pnpm remove glightbox`; old label fields → Form messages → Image viewer | lightbox.md → "Replacing a hand-made modal" | +| 49 | **1.14.0** — import map, Node, Next, audit, cookie list, admin languages | `pnpm payload generate:importmap` (`FaviconCheck`, `RowLabel`); Node 20.9+; `next@^16.4.3` + `sharp@^0.35.5` (Next ≤16.4.0 has two RCEs); `pnpm audit --prod` + `dompurify` / `undici` overrides on payload 3.90.x; hand-kept cookie list → `cookieScanner` (+ `crawl`, `IAPL_COOKIE_SCAN_URL` / `IAPL_COOKIE_SCAN_TOKEN`) + `migrate:create`; English-only admin → `i18n.supportedLanguages`; tests on validator strings → full sentences | CHANGELOG 1.14.0, cookie-scanner.md, i18n.md, AGENT.md §4 items 11–12 | | 50 | **1.14.1** — `X-Powered-By: Next.js, Payload` in responses, no CSP or a hand-written one | `withPayload(withSecurityConfig(nextConfig))`; `buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', …flags } })` + `buildAdminCspHeaders` on `/admin/:path*` + `export const POST = createCspReportRoute()`; after clean reports `mode: 'enforce'`; nonces (`createProxy({ csp })` + ``) only for dynamic sites | security.md, CHANGELOG 1.14.1 | | 51 | **1.14.2** — a new admin stuck on `/admin/setup-totp?back=null` (the page keeps redirecting to itself), or an own `x-pathname` rule on `/admin` added as a workaround | `pnpm payload generate:importmap` (`TotpRedirectProvider`), commit `importMap.js`, redeploy; delete the workaround; own redirect rules → `twoFactor.provider` | security.md → "The redirect to the 2FA screens", CHANGELOG | | 52 | **1.14.3** — editors open every Cookie review entry one by one to accept it | with `cookieScanner`: `pnpm payload generate:importmap` (`CookieApprovalView`, `CookieCrawlAlert`), Postgres/SQLite `migrate:create` (`change`, `needs_description`); editors use Approve cookies (`/admin/cookie-approval`, linked from Privacy → Cookie review); old flow: `cookieScanner: { approval: false }` | cookie-scanner.md, CHANGELOG 1.14.3 | | 53 | **1.14.4** — cookie texts retyped in every language; three cookie entries in the admin navigation | `pnpm payload generate:importmap` (`CookieReviewTab`, `CookieSiteCheckTab`); empty languages fill themselves (`fillEmptyLocales: false` to keep them empty); with `cookieScanner` one **Cookies** entry with tabs (`cookieScanner: { adminLayout: 'separate' }` for the old entries); Cookie banner is now called Cookies — update editor instructions; no migration | consent.md, cookie-scanner.md, hooks.md, CHANGELOG 1.14.4 | -| 54 | **1.14.6** (1.14.5 never published) — `/api/graphql` answers 500; graphql-scalars high advisory; theme stored as `ipal-theme`; hand-written `admin.meta` for the panel preview | Postgres: `migrate:create` for the title separator **plus `${sql.raw(titleSeparatorSql())}` after the first `SET DATA TYPE text;`**, and the cookie storage type; `graphql-scalars` override (Node 22 recommended); `THEME_STORAGE_KEY` instead of `'ipal-theme'`; `titleSeparatorChar()` for a raw `settings.titleSeparator`; remove hand-written panel `admin.meta`; `pnpm ipal:skills` (`--external` optional) | CHANGELOG 1.14.6 + 1.14.5, seo.md, theme.md, white-label.md, consent.md | -| 55 | **1.15.0** — a production seed runs everything; no design tokens / block library; no site check | `SEED_ONLY` for production seeds (full seed refused, `IPAL_SEED_ALLOW_FULL=1` with the owner's OK); optional tokens.css + the block library (block by block, `migrate:create`); CookieButton above the footer (`avoid={false}`); `pnpm ipal:skills`; `pnpm exec ipal-doctor` (`--url`); new sites with `ipal-kit create` | CHANGELOG 1.15.0, seeding.md, design-tokens.md, block-library.md, doctor.md, project-starter.md | -| 56 | **1.15.1** — a seed in Coolify's Terminal ends with exit 0 and no output (it stopped before Payload started) | `guardSeedExit()` first in every seed script, `seed.summary()` at the end; check `echo $?` after a seed; `pnpm ipal:skills` | CHANGELOG 1.15.1, seeding.md | -| 57 | **1.15.2** — ipal-doctor reports missing routes for a site whose pages live in `app/(site)` (not `(frontend)`), or a `notFoundView.tsx` | nothing to change; remove the temporary `layout-required` silence; two candidates → `layout.frontend` in `ipal-doctor.json`; `pnpm ipal:skills` | CHANGELOG 1.15.2, doctor.md | -| 58 | **1.15.3** — ipal-audit / ipal-doctor report `adminText()` or `{ en, pl }` panel labels as hardcoded Polish text | `pnpm ipal:skills`; remove a temporary `i18n-literals` silence added for such labels; public text is still reported | CHANGELOG 1.15.3, ipal-audit skill | -| 59 | **1.15.4** — a seeded form / layout / global array shows only the last language (whole localized arrays) | nothing to change in the seed; repair: `SEED_UPDATE=1` locally, on production `SEED_ONLY` + `SEED_UPDATE=1` + `IPAL_SEED_ALLOW_PROD_UPDATE=1` after a backup; edited records and global arrays by hand | CHANGELOG 1.15.4, seeding.md | +| 54 | **1.14.6** (1.14.5 never published) — `/api/graphql` answers 500; graphql-scalars high advisory; theme stored as `ipal-theme`; hand-written `admin.meta` for the panel preview | Postgres: `migrate:create` for the title separator **plus `${sql.raw(titleSeparatorSql())}` after the first `SET DATA TYPE text;`**, and the cookie storage type; `graphql-scalars` override (Node 22 recommended); `THEME_STORAGE_KEY` instead of `'ipal-theme'`; `titleSeparatorChar()` for a raw `settings.titleSeparator`; remove hand-written panel `admin.meta`; `pnpm iapl:skills` (`--external` optional) | CHANGELOG 1.14.6 + 1.14.5, seo.md, theme.md, white-label.md, consent.md | +| 55 | **1.15.0** — a production seed runs everything; no design tokens / block library; no site check | `SEED_ONLY` for production seeds (full seed refused, `IAPL_SEED_ALLOW_FULL=1` with the owner's OK); optional tokens.css + the block library (block by block, `migrate:create`); CookieButton above the footer (`avoid={false}`); `pnpm iapl:skills`; `pnpm exec iapl-doctor` (`--url`); new sites with `iapl create` | CHANGELOG 1.15.0, seeding.md, design-tokens.md, block-library.md, doctor.md, project-starter.md | +| 56 | **1.15.1** — a seed in Coolify's Terminal ends with exit 0 and no output (it stopped before Payload started) | `guardSeedExit()` first in every seed script, `seed.summary()` at the end; check `echo $?` after a seed; `pnpm iapl:skills` | CHANGELOG 1.15.1, seeding.md | +| 57 | **1.15.2** — iapl-doctor reports missing routes for a site whose pages live in `app/(site)` (not `(frontend)`), or a `notFoundView.tsx` | nothing to change; remove the temporary `layout-required` silence; two candidates → `layout.frontend` in `iapl-doctor.json`; `pnpm iapl:skills` | CHANGELOG 1.15.2, doctor.md | +| 58 | **1.15.3** — iapl-audit / iapl-doctor report `adminText()` or `{ en, pl }` panel labels as hardcoded Polish text | `pnpm iapl:skills`; remove a temporary `i18n-literals` silence added for such labels; public text is still reported | CHANGELOG 1.15.3, iapl-audit skill | +| 59 | **1.15.4** — a seeded form / layout / global array shows only the last language (whole localized arrays) | nothing to change in the seed; repair: `SEED_UPDATE=1` locally, on production `SEED_ONLY` + `SEED_UPDATE=1` + `IAPL_SEED_ALLOW_PROD_UPDATE=1` after a backup; edited records and global arrays by hand | CHANGELOG 1.15.4, seeding.md | | 60 | **1.15.5** — a seeded page with a required layout linking to a page or form fails validation ("… > Layout") | nothing to change in the seed; run it again (dry run first); a missing `$form` / `$page` is now an error in the dry run too; a required link cycle: make one link optional | CHANGELOG 1.15.5, seeding.md | -| 61 | **1.16.0 — files on forms** — a CV / drawing field built by hand (own upload collection, bucket, `` posting to an own route), or "send the file by e-mail" asked for and refused | `forms: { attachments: true }` + a **File** field (panel or seed) + one e-mail with a fixed recipient; Postgres/SQLite `migrate:create`; `generate:types`; `formClasses` keys `file`, `help`, `fileList`, `fileItem`, `fileRemove`; proxy body limit (nginx `client_max_body_size 12m`); Graph: `Mail.ReadWrite` limited to the forms mailbox, or SMTP settings, or ~2.8 MB; test e-mail with the 10 MB file; delete the hand-built upload path; `pnpm ipal:skills` | CHANGELOG 1.16.0, forms.md "Files", email.md "Attachments", deployment.md "Form files" | -| 62 | **1.16.1** — `pnpm dev` warns "Next.js 16.4.3 is affected by a known security vulnerability"; ipal-doctor `next-min` error below 16.4.5 (GHSA-mfr8-8qww-v76h) | `pnpm add next@16.4.6 eslint-config-next@16.4.6`, `rm -rf .next`, build, commit the lockfile, redeploy on Coolify; `pnpm ipal:skills`; no option, migration or import map change | CHANGELOG 1.16.1, AGENT.md §4 item 11 | -| 63 | **1.16.2** — `pnpm audit --prod` shows `mongoose` (critical, via `@payloadcms/db-mongodb`) or `happy-dom` (high, via `@payloadcms/richtext-lexical`); ipal-doctor `transitive-min` | `pnpm.overrides`: `"mongoose@>=8 <8.24.7": "~8.24.10"` (MongoDB sites) and `"happy-dom@<21.0.4": "^21.0.4"`; `pnpm install`, build, commit the lockfile, redeploy on Coolify; `pnpm ipal:skills`; no migration | CHANGELOG 1.16.2, AGENT.md §4 item 12 | -| 64 | **1.16.3** — the reference site and the starter run Payload 3.94.1; the site is still on 3.90–3.93, or `node -v` (locally or in the Coolify app's Terminal) is below 22.23.5 | Recommended, not required (the plugin still accepts `^3.90.2`). First make sure Node is 22.23.5 or later everywhere, Coolify included (Nixpacks picks the patch: check `node -v`, update Coolify if lower). Then every `payload` / `@payloadcms/*` 3.94.1 (in `dependencies` and `pnpm.overrides`), `react` / `react-dom` 19.3.1, `"engines": { "node": ">=22.23.5 <23" }`; overrides: keep `dompurify` and `happy-dom`, drop `mongoose`, `undici` and `graphql-scalars`; `pnpm install`, `generate:types`, `generate:importmap`, `rm -rf .next`, build, redeploy; Postgres/SQLite: `migrate:create`; `pnpm ipal:skills` | CHANGELOG 1.16.3, AGENT.md §4 items 11–12, ipal-upgrade "Every upgrade — Payload" | -| 65 | **1.16.4 — security** — with 2FA on, a login with the password only gets `200` from `/api/globals/site-integrations` or `/api/form-submissions`; or the project has a second auth collection (`customers`) | Upgrade and redeploy (no config change with one auth collection). With the owner: change the SMTP password and the Turnstile secret, review Site settings / Site integrations / each form's Emails tab for values nobody set. Second auth collection: `admin: { user }` in `buildConfig`, `adminOrSelfIn('')`, `access.staffCollections` only for a second STAFF collection. Every account must have 2FA set up (`ipal-doctor --url` → 0 without). Own endpoints: `secondFactorPassed(req)`; own `overrideAccess: false` calls: `user` from `payload.auth()`. `pnpm ipal:skills`; no migration | CHANGELOG 1.16.4, security.md "What the second factor covers", access.md "Who is staff" | -| 66 | **1.16.4** — production `PAYLOAD_SECRET` shorter than 32 characters (the site would stop at `assertEnv`) | Before deploying 1.16.4, check the length in Coolify (`node -e 'console.log(process.env.PAYLOAD_SECRET.length)'`). Shorter: a random 32+ character secret (logs everyone out, asks for 2FA again, breaks stored API keys), or `ipalEnvRules({ secretMinLength: 0 })` for now | CHANGELOG 1.16.4, deployment.md "PAYLOAD_SECRET — length and changing it" | -| 67 | **1.16.5 — security** — with 2FA on, `/admin/verify-totp?back=https%3A%2F%2Fexample.com%2F` sends the user to example.com after the code (and `back=javascript:…` runs script in the panel) | Upgrade and, **in ONE deploy**, `pnpm payload generate:importmap` (adds `@intecion/ipal-kit/admin#SafeTotpView`), commit `importMap.js`, `rm -rf .next`, redeploy on Coolify — with the old map the 2FA screens have no code form and nobody can sign in (run `pnpm exec ipal-doctor` before deploying; the start log says so too); check: the link above ends on `/admin`. `pnpm ipal:skills`. No option, env or migration; off / own rule: `twoFactor.safeBack` | CHANGELOG 1.16.5, security.md "The `back` link of the 2FA screens" | -| 68 | **1.16.6 — 2FA setup required** (not a routine patch: a new default that can lock accounts out) — an account that has not set 2FA up still reads data over the API with its password; or after the upgrade an account "can do nothing" / is blocked | Before upgrading: `ipal-doctor --url` → accounts without 2FA set it up or are removed; one admin (better two) must have 2FA; deploy day agreed with the owner. Then, in ONE deploy: update, `generate:types`, `generate:importmap` (`TwoFactorStatusField`, `TwoFactorAlert`), **Postgres/SQLite: `migrate:create` and the migration applied in the same deploy when the new container starts — `prodMigrations` or `pnpm payload migrate && pnpm start`, never a pre-deployment command (deployment.md §4.3) — (column `totp_setup_from`); without it every login answers 500**, build, redeploy. Existing accounts get 72 h from the first start; blocked later → admin: account page → "Reopen setup". Password-login integrations: API key or `requireSetup.exempt`. `pnpm ipal:skills` | CHANGELOG 1.16.6, security.md "Setup required" | -| 69 | **1.16.7 — hardening** (not a routine patch: stricter defaults) — an account with only the role `user` sees "Unauthorized" in the panel; or the API returns `"smtpPassword":"********"`; or a form with a File field is refused while Turnstile is misconfigured; or "The password must have at least 12 characters."; or "Enter the password again…" on the SMTP password; or `403` "Not allowed from this origin." on the 2FA code | Update, `generate:types`, redeploy; no import map, schema or migration. Every slug in `access.staffCollections` must be an auth collection (otherwise Payload does not start: `/api/health` 503, the old container keeps serving). Set `serverURL` (a proxy that rewrites `Host` otherwise blocks the 2FA code; the log names the origin). Read the start log (`N account(s) … cannot open the admin panel`) and give panel users `editor`. Own code that read the two secrets over the API → Local API on the server. `TURNSTILE_SECRET_KEY` is deprecated: with the owner move the key into the panel. Own staff collection without rules: an admin (update: or the account itself; roles only by an admin; read by staff only) where the roles are the plugin's, accounts of that collection where they are the project's own — write that collection's own rules. Existing short passwords keep working. Switches: `accounts`, `secrets`, `forms.turnstileOnConfigError`, `twoFactor.sameOrigin`, `dashboardAlerts`. `pnpm ipal:skills` | CHANGELOG 1.16.7, access.md "Account rules", security.md "Stored secrets", turnstile.md | +| 61 | **1.16.0 — files on forms** — a CV / drawing field built by hand (own upload collection, bucket, `` posting to an own route), or "send the file by e-mail" asked for and refused | `forms: { attachments: true }` + a **File** field (panel or seed) + one e-mail with a fixed recipient; Postgres/SQLite `migrate:create`; `generate:types`; `formClasses` keys `file`, `help`, `fileList`, `fileItem`, `fileRemove`; proxy body limit (nginx `client_max_body_size 12m`); Graph: `Mail.ReadWrite` limited to the forms mailbox, or SMTP settings, or ~2.8 MB; test e-mail with the 10 MB file; delete the hand-built upload path; `pnpm iapl:skills` | CHANGELOG 1.16.0, forms.md "Files", email.md "Attachments", deployment.md "Form files" | +| 62 | **1.16.1** — `pnpm dev` warns "Next.js 16.4.3 is affected by a known security vulnerability"; iapl-doctor `next-min` error below 16.4.5 (GHSA-mfr8-8qww-v76h) | `pnpm add next@16.4.6 eslint-config-next@16.4.6`, `rm -rf .next`, build, commit the lockfile, redeploy on Coolify; `pnpm iapl:skills`; no option, migration or import map change | CHANGELOG 1.16.1, AGENT.md §4 item 11 | +| 63 | **1.16.2** — `pnpm audit --prod` shows `mongoose` (critical, via `@payloadcms/db-mongodb`) or `happy-dom` (high, via `@payloadcms/richtext-lexical`); iapl-doctor `transitive-min` | `pnpm.overrides`: `"mongoose@>=8 <8.24.7": "~8.24.10"` (MongoDB sites) and `"happy-dom@<21.0.4": "^21.0.4"`; `pnpm install`, build, commit the lockfile, redeploy on Coolify; `pnpm iapl:skills`; no migration | CHANGELOG 1.16.2, AGENT.md §4 item 12 | +| 64 | **1.16.3** — the reference site and the starter run Payload 3.94.1; the site is still on 3.90–3.93, or `node -v` (locally or in the Coolify app's Terminal) is below 22.23.5 | Recommended, not required (the plugin still accepts `^3.90.2`). First make sure Node is 22.23.5 or later everywhere, Coolify included (Nixpacks picks the patch: check `node -v`, update Coolify if lower). Then every `payload` / `@payloadcms/*` 3.94.1 (in `dependencies` and `pnpm.overrides`), `react` / `react-dom` 19.3.1, `"engines": { "node": ">=22.23.5 <23" }`; overrides: keep `dompurify` and `happy-dom`, drop `mongoose`, `undici` and `graphql-scalars`; `pnpm install`, `generate:types`, `generate:importmap`, `rm -rf .next`, build, redeploy; Postgres/SQLite: `migrate:create`; `pnpm iapl:skills` | CHANGELOG 1.16.3, AGENT.md §4 items 11–12, iapl-upgrade "Every upgrade — Payload" | +| 65 | **1.16.4 — security** — with 2FA on, a login with the password only gets `200` from `/api/globals/site-integrations` or `/api/form-submissions`; or the project has a second auth collection (`customers`) | Upgrade and redeploy (no config change with one auth collection). With the owner: change the SMTP password and the Turnstile secret, review Site settings / Site integrations / each form's Emails tab for values nobody set. Second auth collection: `admin: { user }` in `buildConfig`, `adminOrSelfIn('')`, `access.staffCollections` only for a second STAFF collection. Every account must have 2FA set up (`iapl-doctor --url` → 0 without). Own endpoints: `secondFactorPassed(req)`; own `overrideAccess: false` calls: `user` from `payload.auth()`. `pnpm iapl:skills`; no migration | CHANGELOG 1.16.4, security.md "What the second factor covers", access.md "Who is staff" | +| 66 | **1.16.4** — production `PAYLOAD_SECRET` shorter than 32 characters (the site would stop at `assertEnv`) | Before deploying 1.16.4, check the length in Coolify (`node -e 'console.log(process.env.PAYLOAD_SECRET.length)'`). Shorter: a random 32+ character secret (logs everyone out, asks for 2FA again, breaks stored API keys), or `iaplEnvRules({ secretMinLength: 0 })` for now | CHANGELOG 1.16.4, deployment.md "PAYLOAD_SECRET — length and changing it" | +| 67 | **1.16.5 — security** — with 2FA on, `/admin/verify-totp?back=https%3A%2F%2Fexample.com%2F` sends the user to example.com after the code (and `back=javascript:…` runs script in the panel) | Upgrade and, **in ONE deploy**, `pnpm payload generate:importmap` (adds `@intecion/ipal-kit/admin#SafeTotpView`), commit `importMap.js`, `rm -rf .next`, redeploy on Coolify — with the old map the 2FA screens have no code form and nobody can sign in (run `pnpm exec iapl-doctor` before deploying; the start log says so too); check: the link above ends on `/admin`. `pnpm iapl:skills`. No option, env or migration; off / own rule: `twoFactor.safeBack` | CHANGELOG 1.16.5, security.md "The `back` link of the 2FA screens" | +| 68 | **1.16.6 — 2FA setup required** (not a routine patch: a new default that can lock accounts out) — an account that has not set 2FA up still reads data over the API with its password; or after the upgrade an account "can do nothing" / is blocked | Before upgrading: `iapl-doctor --url` → accounts without 2FA set it up or are removed; one admin (better two) must have 2FA; deploy day agreed with the owner. Then, in ONE deploy: update, `generate:types`, `generate:importmap` (`TwoFactorStatusField`, `TwoFactorAlert`), **Postgres/SQLite: `migrate:create` and the migration applied in the same deploy when the new container starts — `prodMigrations` or `pnpm payload migrate && pnpm start`, never a pre-deployment command (deployment.md §4.3) — (column `totp_setup_from`); without it every login answers 500**, build, redeploy. Existing accounts get 72 h from the first start; blocked later → admin: account page → "Reopen setup". Password-login integrations: API key or `requireSetup.exempt`. `pnpm iapl:skills` | CHANGELOG 1.16.6, security.md "Setup required" | +| 69 | **1.16.7 — hardening** (not a routine patch: stricter defaults) — an account with only the role `user` sees "Unauthorized" in the panel; or the API returns `"smtpPassword":"********"`; or a form with a File field is refused while Turnstile is misconfigured; or "The password must have at least 12 characters."; or "Enter the password again…" on the SMTP password; or `403` "Not allowed from this origin." on the 2FA code | Update, `generate:types`, redeploy; no import map, schema or migration. Every slug in `access.staffCollections` must be an auth collection (otherwise Payload does not start: `/api/health` 503, the old container keeps serving). Set `serverURL` (a proxy that rewrites `Host` otherwise blocks the 2FA code; the log names the origin). Read the start log (`N account(s) … cannot open the admin panel`) and give panel users `editor`. Own code that read the two secrets over the API → Local API on the server. `TURNSTILE_SECRET_KEY` is deprecated: with the owner move the key into the panel. Own staff collection without rules: an admin (update: or the account itself; roles only by an admin; read by staff only) where the roles are the plugin's, accounts of that collection where they are the project's own — write that collection's own rules. Existing short passwords keep working. Switches: `accounts`, `secrets`, `forms.turnstileOnConfigError`, `twoFactor.sameOrigin`, `dashboardAlerts`. `pnpm iapl:skills` | CHANGELOG 1.16.7, access.md "Account rules", security.md "Stored secrets", turnstile.md | | 70 | **1.16.7** — `next build --webpack`: `'server-only' cannot be imported from a Client Component module`, from a `'use client'` file that imports `isAdmin`, `isEditor` or `hasMinimumRole` | Import them from `@intecion/ipal-kit/client` in client components, keep the second argument (`isAdmin(user, config)`); `import type` may stay on the main entry | CHANGELOG 1.16.7, access.md | -| 71 | **1.16.8 — security** — a site built with Turbopack (`next build` without `--webpack`) serves `/_next/static/media/package..json`; or the project has a staff collection of its own without access rules; or a plugin listed after ipalKit copies a staff collection or sets `admin.user`; or the start log says `No staff account holds the role "admin", so NOBODY can …` | Update, `pnpm ipal:skills`, `rm -rf .next`, rebuild; no option, schema, migration or import map. Turbopack: `find .next/static -name 'package*.json'` empty, purge a CDN. Own staff collection: a `roles` list that can hold `editor` / `admin` → only an admin manages its accounts (write own rules otherwise; one account must hold `admin`); a single select with only `user` / `editor` / `admin` → its accounts manage each other again (own rules if your code goes by the value). A copy: `access.update: adminOrSelfIn('copy')`, or `custom.ipal.accountRules: false` | CHANGELOG 1.16.8, access.md "Account rules" | +| 71 | **1.16.8 — security** — a site built with Turbopack (`next build` without `--webpack`) serves `/_next/static/media/package..json`; or the project has a staff collection of its own without access rules; or a plugin listed after iapl copies a staff collection or sets `admin.user`; or the start log says `No staff account holds the role "admin", so NOBODY can …` | Update, `pnpm iapl:skills`, `rm -rf .next`, rebuild; no option, schema, migration or import map. Turbopack: `find .next/static -name 'package*.json'` empty, purge a CDN. Own staff collection: a `roles` list that can hold `editor` / `admin` → only an admin manages its accounts (write own rules otherwise; one account must hold `admin`); a single select with only `user` / `editor` / `admin` → its accounts manage each other again (own rules if your code goes by the value). A copy: `access.update: adminOrSelfIn('copy')`, or `custom.ipal.accountRules: false` | CHANGELOG 1.16.8, access.md "Account rules" | +| 72 | **1.17.0 — the plugin is called IAPL** — you see `iapl()`, `iapl-doctor`, `IAPL_IP_HEADER`, `iapl-doctor.json`, `[iapl]` in docs and logs and wonder whether the project must change | No. Every old name works through 1.x (`ipalKit`, `ipal-*` commands, `IPAL_*` env, `ipal-doctor.json`, `ipal-audit-skip`, the old pointer block); the package is still `@intecion/ipal-kit`. Run `pnpm exec iapl-skills` (or the project's `ipal:skills` script) and commit; change a log filter on `[ipal]` to `[iapl]`. Rename the rest only when the owner asks (`iapl-upgrade` "→ 1.17.0", AGENT.md "Names: IAPL and ipal-kit"). Never set `storageNames: 'iapl'` on an existing site | -After updating the package: `pnpm ipal:skills` (new skill versions), `pnpm payload generate:importmap`, `rm -rf .next`, restart dev, grep for the new symbol in +After updating the package: `pnpm iapl:skills` (new skill versions), `pnpm payload generate:importmap`, `rm -rf .next`, restart dev, grep for the new symbol in `node_modules/@intecion/ipal-kit/dist`. --- @@ -693,8 +694,8 @@ After updating the package: `pnpm ipal:skills` (new skill versions), `pnpm paylo | `PayloadComponent not found in importMap` | `pnpm payload generate:importmap` | | `Cannot destructure property 'config'` | duplicate `@payloadcms/ui` in the plugin — `ls node_modules/@intecion/ipal-kit/node_modules/@payloadcms/ui` | | `Cannot find module '@clocklimited/payload-2fa'` | inject `plugin: payloadTotp` in `twoFactor` (`serverExternalPackages` does not help) | -| `TS2322` on `plugin: payloadTotp` / `ipal-skills: command not found` | ipal-kit ≤ 1.8.13 — update | -| `[ipal] R2 storage: … adapter was not injected` | `pnpm add @payloadcms/storage-s3` + `buildR2Storage(['media'], { s3Storage })` | +| `TS2322` on `plugin: payloadTotp` / `iapl-skills: command not found` | IAPL ≤ 1.8.13 — update | +| `[iapl] R2 storage: … adapter was not injected` | `pnpm add @payloadcms/storage-s3` + `buildR2Storage(['media'], { s3Storage })` | | Images 403 for visitors (`/api/media/file/…`) | the Media collection has no public read — `access: { read: () => true }` (storage.md) | | `R2_PUBLIC_URL is required but missing` in production | media through the app — make the rule optional (env.md) | | New deploy never goes live / old version keeps serving | the health check fails (migration error, database unreachable) — Coolify deployment log (deployment.md §4.4) | @@ -716,7 +717,7 @@ at startup) → save in the admin panel → duplicate dependency → importmap --- -## 8. ipal-kit DEVELOPMENT AND PUBLISHING +## 8. IAPL DEVELOPMENT AND PUBLISHING ### 8.1 Change chain Pre-release checks are the tests in `test/` (also run by `prepublishOnly`): @@ -767,7 +768,7 @@ done until the reference site uses it. Before `npm version`: - [ ] Everything new or changed in this release is used in `reference/` — a new option set, a route wired, a block or variant shown (the Blocks page picks up new blocks and variants from `blockLibraryManifest` by itself). -- [ ] `reference/` upgraded the way `ipal-upgrade` tells client projects; the upgrade notes are tried here first. +- [ ] `reference/` upgraded the way `iapl-upgrade` tells client projects; the upgrade notes are tried here first. - [ ] Local run green: `pnpm build` (plugin) → `pnpm --dir reference install --ignore-workspace` (refreshes the injected copy) → in `reference/`: `pnpm generate:types && pnpm generate:importmap` (no diff), `pnpm typecheck`, `pnpm seed` on a throwaway MongoDB, `pnpm build`, `ALLOW_LOCAL_MEDIA=1 PORT=3100 pnpm start`, @@ -788,7 +789,7 @@ done until the reference site uses it. Before `npm version`: when the constant differs from package.json. - [ ] `pnpm reference:index` → `docs/agent/reference-site/INDEX.md` committed (`test/referenceIndex.test.ts` fails otherwise; a new file in `reference/` needs its line in `scripts/reference-index.mjs` → `DESCRIPTIONS`). -- [ ] CI job `reference` green (`.gitea/workflows/ci.yml`), the starter check included once `ipal-kit create` ships. +- [ ] CI job `reference` green (`.gitea/workflows/ci.yml`), the starter check included once `iapl create` ships. - [ ] Tag `v` pushed — the index links to `reference/` at that tag, and `git diff v v -- reference/` is the upgrade guide for projects. @@ -817,8 +818,8 @@ an empty project (only errors) and a complete one (0 errors). CI (`.gitea/workfl typecheck, lint, tests and build on every push. ### 8.2 Plugin package.json -- `"files": ["dist", "docs", "bin", "src/modules/block-library"]` — **the docs and the `ipal-skills` command ship in the package** - (the block-library source is what `ipal-blocks eject` copies); agents in projects +- `"files": ["dist", "docs", "bin", "src/modules/block-library"]` — **the docs and the `iapl-skills` command ship in the package** + (the block-library source is what `iapl-blocks eject` copies); agents in projects read `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md`. Without `docs` they have nothing. - One `exports` block, all paths to `./dist/` (not `./src/`). - `payload`, `@payloadcms/*`, `next`, `react` → **`peerDependencies`** @@ -836,7 +837,7 @@ typecheck, lint, tests and build on every push. ```bash grep -c '"exports"' package.json # 1 -grep -c "git+https.*ipal-kit" package.json # 0 +grep -c "git+https.*IAPL" package.json # 0 grep '"import"' package.json | head -1 # ./dist/ ``` @@ -859,10 +860,10 @@ ls node_modules/@intecion/ipal-kit/docs/agent/AGENT.md |---|---| | `Cannot find module …/src/…ts` | `exports` points to `src` | | "Module not found" although the file exists | two `exports` blocks | -| `ENOENT …ipal-kit.tgz` | self-reference in `dependencies` | +| `ENOENT …IAPL.tgz` | self-reference in `dependencies` | | old code despite reinstalling | version not bumped; `pnpm store prune` + `rm -rf .next node_modules/@intecion` | -Versions: 1.x = Payload 3. Moving to Payload 4 → ipal-kit 2.0. +Versions: 1.x = Payload 3. Moving to Payload 4 → IAPL 2.0. --- diff --git a/docs/dev/admin-ux.md b/docs/dev/admin-ux.md index f5bd3f0..0031f95 100644 --- a/docs/dev/admin-ux.md +++ b/docs/dev/admin-ux.md @@ -1,7 +1,7 @@ # admin-ux.md — wording and layout of the admin panel > **Who it is for:** anyone (person or agent) who adds or changes a collection, -> global, field, admin view, button or default text in ipal-kit — or in a project +> global, field, admin view, button or default text in IAPL — or in a project > built on it. Projects can override every label and description the plugin ships; > this guide is what the defaults follow, and what new fields in projects should follow. @@ -18,7 +18,7 @@ not the code. Every screen must be clear to them without a developer at hand. "Rendered via buildIconsMetadata". - **No developer words** in labels, descriptions, placeholders, toasts or errors: no function, component, hook, file, skill or env-var names (``, - `buildIconsMetadata`, `ipal-consent-check`, `SMTP_HOST`), no `camelCase`, no + `buildIconsMetadata`, `iapl-consent-check`, `SMTP_HOST`), no `camelCase`, no `settings="detailed"`, no arrows like `Empty →`. Developer notes belong in code comments and `docs/`. - **Product names stay** when the editor must find that product: Google Analytics, @@ -27,7 +27,7 @@ not the code. Every screen must be clear to them without a developer at hand. - **Errors say what to do:** "Enter a full address, e.g. https://example.com" — not "Invalid URL". Errors an editor can see never name env vars, config files or packages; the developer detail goes to the server log. -- **No package or vendor names** (ipal-kit, Intecion) in labels, descriptions, test e-mails +- **No package or vendor names** (IAPL, Intecion) in labels, descriptions, test e-mails or messages. "Ask your administrator" instead of "configured by Intecion". The one exception is the vendor credit under the navigation (`whiteLabel.credit`), which exists to name the vendor. diff --git a/docs/dev/rename-iapl-plan.md b/docs/dev/rename-iapl-plan.md index 465aa9f..6614d01 100644 --- a/docs/dev/rename-iapl-plan.md +++ b/docs/dev/rename-iapl-plan.md @@ -290,7 +290,7 @@ In the guide and skills of 1.17.0: name, state in 1.17.0 (renamed with alias / unchanged until 2.0 / unchanged). It is the only place old aliases are listed. - Everywhere else the guide uses **the name that is preferred on 1.17.0**: `iapl()`, `iapl-doctor`, - `IAPL_IP_HEADER`, `iapl-doctor.json`, and still `@intecion/ipal-kit/...`, `/api/ipal/...`, `--ipal-*`, + `IAPL_IP_HEADER`, `iapl-doctor.json`, and still the `@intecion/ipal-kit` import paths, `/api/ipal/` routes, `--ipal-*`, `data-ipal`. The guide never shows a name that does not work on the installed version. - A rule for existing projects: **do not rename on your own.** Old names work; a project moves to the new ones only when its owner asks, with the `iapl-upgrade` skill's "→ 1.17.0" section, which lists the optional diff --git a/docs/dev/vibe.md b/docs/dev/vibe.md index 5e201ad..4574432 100644 --- a/docs/dev/vibe.md +++ b/docs/dev/vibe.md @@ -11,26 +11,26 @@ The agent works like an independent contractor (AGENT.md §0a): it asks once, in one list, only for missing data; it makes technical decisions itself; it checks its own -work; it speaks up only with the final report (or when ipal-kit has a bug). +work; it speaks up only with the final report (or when IAPL has a bug). ``` -/ipal-site +/iapl-site ``` You: answer the list of questions (or don't — it will use the defaults), and at the end read the report: what was done, check results, `[TO FILL]` placeholders, -reports to ipal-kit. The steps below are **guided mode** — for when you want to +reports to IAPL. The steps below are **guided mode** — for when you want to control each stage or fix one thing. | Need | Prompt | |---|---| -| new section / section fix | `/ipal-block — ` | -| form | `/ipal-form ` | -| new language | `/ipal-locale-add — ` | -| change fields that have content in the database | `/ipal-migrate-fields ` | -| something does not work | `/ipal-debug ` | -| SEO / Google does not see it | `/ipal-seo-check ` | -| GDPR / pixels before consent | `/ipal-consent-check ` | -| before handover | `/ipal-audit` | +| new section / section fix | `/iapl-block — ` | +| form | `/iapl-form ` | +| new language | `/iapl-locale-add — ` | +| change fields that have content in the database | `/iapl-migrate-fields ` | +| something does not work | `/iapl-debug ` | +| SEO / Google does not see it | `/iapl-seo-check ` | +| GDPR / pixels before consent | `/iapl-consent-check ` | +| before handover | `/iapl-audit` | --- @@ -48,9 +48,9 @@ control each stage or fix one thing. 6. When the agent breaks a rule — use the repair prompts at the end of this file; do not explain it again from scratch. -**Skills instead of long prompts.** When the project has the ipal-kit skills -(`pnpm exec ipal-skills`, AGENT.md §14), most steps are one short -prompt, e.g. `/ipal-block Hero — `. The prompts below also work +**Skills instead of long prompts.** When the project has the IAPL skills +(`pnpm exec iapl-skills`, AGENT.md §14), most steps are one short +prompt, e.g. `/iapl-block Hero — `. The prompts below also work without skills; the short version is given at each step. **Prefix for every prompt** (paste it at the start if the agent does not read @@ -79,7 +79,7 @@ buildLinksField/CMSLink, minimum collections. If not — tell it to read again. ## STEP 1 — Skeleton and installation -Short version: `/ipal-setup` (walks through steps 1–8, stage by stage). +Short version: `/iapl-setup` (walks through steps 1–8, stage by stage). ``` @@ -114,7 +114,7 @@ Do not copy rules from AGENT.md — only a link. ``` Create src/i18n.config.ts (as const satisfies I18nConfig) with languages <…> and payload.config.ts according to PROGRAMISTA.md §2.3: -ipalKit with i18n, access, pages (slug 'pages'), seo, forms, +iapl with i18n, access, pages (slug 'pages'), seo, forms, twoFactor with INJECTED payloadTotp (issuer: ''), whiteLabel: true, email: mailAdapter(). Do not add content collections yet. Plan first. @@ -153,7 +153,7 @@ Before this: `/impeccable init` and `/impeccable document` → `PRODUCT.md`, `DE Based on DESIGN.md, create src/app/(frontend)/styles.css according to AGENT.md §6.11: @theme with tokens (primary, background, foreground, muted + fonts), @source for the plugin, mapping of --ipal-primary / --ipal-radius. Fonts through next/font. -Then the primitives 1:1 from node_modules/@intecion/ipal-kit/docs/agent/skills/ipal-block/resources/section-code.md: +Then the primitives 1:1 from node_modules/@intecion/ipal-kit/docs/agent/skills/iapl-block/resources/section-code.md: components/ui/CMSLink.tsx, Button.tsx, Media.tsx, Section.tsx, SectionHeader.tsx, and components/icons according to §6.10. Zero hex values in components — tokens only. @@ -189,7 +189,7 @@ Do this according to PROGRAMISTA.md §2.8–2.9 and seo.md: - next.config.ts: htmlLimitedBots, buildSecurityHeaders, - page metadata through generatePageMetadata from lib/content (shared cache), favicon through buildIconsMetadata, - JSON-LD: Organization + WebSite come from SiteProviders using Site settings; local business → siteJsonLd in createContentHelpers (seo.md), -- src/instrumentation.ts with assertEnv(ipalEnvRules(...)) imported from @intecion/ipal-kit/env (env.md). +- src/instrumentation.ts with assertEnv(iaplEnvRules(...)) imported from @intecion/ipal-kit/env (env.md). No CSP yet — that comes in step 14. Plan first. ``` @@ -199,17 +199,17 @@ Check: `curl -A "Googlebot" http://localhost:3000/pl | grep canonical` — in `< ## STEP 8 — Header, Footer, company data -Short version: `/ipal-nav `. +Short version: `/iapl-nav `. ``` -Do this according to AGENT.md §6.8, code from node_modules/@intecion/ipal-kit/docs/agent/skills/ipal-nav/resources/nav-code.md: +Do this according to AGENT.md §6.8, code from node_modules/@intecion/ipal-kit/docs/agent/skills/iapl-nav/resources/nav-code.md: - globals/Header.ts, Footer.ts (code from §6.8), - globals/Company.ts for market : name, address, , phone, email — all localized where it is text, - menu through resolveNav from lib/content (plugin, NOT lib/navigation.ts), components/layout/Header.tsx, Footer.tsx, MobileNav.tsx, - legal links in the footer from System pages roles, NOT by hand, -- the project's own globals (Header, Footer, Company) get buildGlobalRevalidateHook (afterChange); plugin globals refresh through ipalKit({ revalidatePath }). +- the project's own globals (Header, Footer, Company) get buildGlobalRevalidateHook (afterChange); plugin globals refresh through iapl({ revalidatePath }). Wire it into [locale]/layout.tsx. a11y labels from the admin panel. Plan first. ``` @@ -230,7 +230,7 @@ Goal: as few blocks as possible, each reusable. Do not write code. **9b. One block:** -Short version: `/ipal-block — , `. +Short version: `/iapl-block — , `. ``` Build the block according to AGENT.md §6 (layer 3): @@ -249,11 +249,11 @@ Check with the checks from AGENT.md §11 (grep for `ctaLabel`, `href="/`, ``. +Short version: `/iapl-form `. ``` Do this according to forms.md, turnstile.md, email.md: -- form block: from @intecion/ipal-kit/rsc + formClasses.ts (ipal-form skill) — fields, steps, +- form block: from @intecion/ipal-kit/rsc + formClasses.ts (iapl-form skill) — fields, steps, select options and texts from the admin panel, no custom renderer, - consent checkbox (GDPR consent) with a link to the policy through getSystemPagePath, - Turnstile from SiteProviders in the layout — without passing siteKey to the block, @@ -282,7 +282,7 @@ pings to Google); only non-Google pixels are blocked until consent (analytics.md ## STEP 12 — Content collections (only when the client needs them) -Short version: `/ipal-collection `. +Short version: `/iapl-collection `. ``` @@ -301,7 +301,7 @@ Plan first. ``` Check according to hooks.md that these are wired: -buildRevalidateHook (a collection hook: Pages + content collections; plugin globals: ipalKit({ revalidatePath }); the project's own globals: buildGlobalRevalidateHook, as in step 8), trackSlugHistoryHook + resolveRedirect, +buildRevalidateHook (a collection hook: Pages + content collections; plugin globals: iapl({ revalidatePath }); the project's own globals: buildGlobalRevalidateHook, as in step 8), trackSlugHistoryHook + resolveRedirect, buildCrossLocaleFieldSync (languages from the config), buildPreventDeleteSystemPage, buildValidateUniqueRole. Show a test: change a page's slug → the old URL returns 308 to the new one. ``` @@ -335,8 +335,8 @@ a hex value instead of a token, a new field with a forbidden name, or a file >80 ## STEP 16 — Audit before handover -Short version: `/ipal-audit` (script), on the built app `/ipal-seo-check http://localhost:3000` -and `/ipal-consent-check http://localhost:3000/`, then the editor test and compliance by hand. +Short version: `/iapl-audit` (script), on the built app `/iapl-seo-check http://localhost:3000` +and `/iapl-consent-check http://localhost:3000/`, then the editor test and compliance by hand. ``` @@ -372,14 +372,14 @@ Move to a field in and show the diff. **Zoo of CTA fields / monolithic section:** ``` Stop. AGENT.md §6.5–6.6: CTA = buildLinksField() + CMSLink, image = media + Media, -max ~80 lines of JSX. Refactor according to §6.7. If there is content in the database — run /ipal-migrate-fields first. +max ~80 lines of JSX. Refactor according to §6.7. If there is content in the database — run /iapl-migrate-fields first. ``` **Unreadable admin panel (cta1/cta2, dozens of fields, "Item 01", Polish labels):** ``` Stop. AGENT.md §6.5a: repeated items = an array with labels + rowLabel ("+ Add …"), zero numbered fields and spare fields, EN labels of 1–3 words, descriptions ≤ 80 characters, settings in the sidebar. -Fix (with content in the database → /ipal-migrate-fields) and run the empty block test. +Fix (with content in the database → /iapl-migrate-fields) and run the empty block test. ``` **The agent writes something the plugin already has:** @@ -389,7 +389,7 @@ already has it (AGENT.md §1.1, §7). If it does — remove your code and use th ``` **The plugin is missing something / the plugin has a bug:** -Short version: `/ipal-plugin-gap `. +Short version: `/iapl-plugin-gap `. ``` Do not patch it silently. Write a report according to AGENT.md §1.3 (problem, proposed API, why it is universal) in docs/plugin-requests/, tell me, and wait for my decision on that part — no workaround on your own. @@ -403,7 +403,7 @@ If it is a block or a global — rework it. **"Done" without proof:** ``` -Run /ipal-audit (without --quick) and show the full output. Without it the step is not finished. +Run /iapl-audit (without --quick) and show the full output. Without it the step is not finished. ``` **The agent lost the rules (long conversation):** @@ -414,9 +414,9 @@ and check your recent changes against §0 (compass). List the violations. --- -## EXISTING PROJECT — upgrade to the latest ipal-kit +## EXISTING PROJECT — upgrade to the latest IAPL -Short version: `/ipal-upgrade`. +Short version: `/iapl-upgrade`. ``` diff --git a/docs/doctor.md b/docs/doctor.md index d856fc1..f42398f 100644 --- a/docs/doctor.md +++ b/docs/doctor.md @@ -1,25 +1,25 @@ -# ipal-doctor — one check for the whole site +# iapl-doctor — one check for the whole site -`ipal-doctor` checks a site against the team's rules and lists every gap with a fix hint and a doc link. It covers +`iapl-doctor` checks a site against the team's rules and lists every gap with a fix hint and a doc link. It covers what drifts between sites: versions, Node, the folder layout, database names, env rules, security headers, 2FA, the cookie scanner, the admin preview, the agent guide, seeds, the block library, and the running site. -Related: [AGENT.md §11](./agent/AGENT.md), the `ipal-doctor` skill, [deployment.md](./deployment.md), +Related: [AGENT.md §11](./agent/AGENT.md), the `iapl-doctor` skill, [deployment.md](./deployment.md), [seeding.md](./seeding.md), [security.md](./security.md), [blocks.md](./blocks.md). ## Run it ```bash -pnpm exec ipal-doctor # this project, human-readable -pnpm exec ipal-doctor --strict --offline # CI on a new site: any finding fails -pnpm exec ipal-doctor --deep --url http://localhost:3000 # + database (read-only) and the running site -pnpm exec ipal-doctor --json > doctor.json # machine-readable -pnpm dlx --package=@intecion/ipal-kit@latest ipal-doctor # the newest rules, before an upgrade +pnpm exec iapl-doctor # this project, human-readable +pnpm exec iapl-doctor --strict --offline # CI on a new site: any finding fails +pnpm exec iapl-doctor --deep --url http://localhost:3000 # + database (read-only) and the running site +pnpm exec iapl-doctor --json > doctor.json # machine-readable +pnpm dlx --package=@intecion/ipal-kit@latest iapl-doctor # the newest rules, before an upgrade ``` -`ipal-doctor` is a bin of the package (`bin/ipal-doctor.mjs`), like `ipal-skills`. `pnpm exec` uses the rules of +`iapl-doctor` is a bin of the package (`bin/iapl-doctor.mjs`), like `iapl-skills`. `pnpm exec` uses the rules of the version the site has installed — reproducible in CI. The report header names both: the rules version and the -site's ipal-kit. +site's IAPL. | Option | What it does | |---|---| @@ -29,7 +29,7 @@ site's ipal-kit. | `--strict` | any finding that is not silenced fails (= `--fail-on info`) | | `--fail-on error\|warning\|info` | the lowest severity that fails (default `error`) | | `--offline` | skips the two rules that need the registry: `plugin-latest` (`pnpm view`) and `deps-audit` (`pnpm audit --prod`) | -| `--url ` | also checks the running site: headers, X-Powered-By, CSP, `/api/health`, admin noindex and link preview, production noindex, and `ipal-seo-check` (robots, sitemap, canonical, hreflang, JSON-LD, llms, MCP) | +| `--url ` | also checks the running site: headers, X-Powered-By, CSP, `/api/health`, admin noindex and link preview, production noindex, and `iapl-seo-check` (robots, sitemap, canonical, hreflang, JSON-LD, llms, MCP) | | `--staging` | with `--url`: the site is a staging copy, so it must be noindex | | `--admin-route ` | with `--url`: the panel path (default `/admin`) | | `--deep` | read-only database checks through `pnpm exec payload run` (below) | @@ -38,7 +38,7 @@ site's ipal-kit. | `--sites ` | many projects at once, e.g. `'../*-web'`: a rule × site table (always exit 0 — a report, never a gate) | **Exit codes:** `0` nothing at or above `--fail-on` · `1` findings at or above it · `2` the doctor could not run (not -a project root, a broken `ipal-doctor.json`, a bad option) · `3` a rule crashed (the others still report). +a project root, a broken `iapl-doctor.json`, a bad option) · `3` a rule crashed (the others still report). **Severities:** `error` breaks a team rule or is a security or data risk; `warning` is drift to fix; `info` is worth knowing. Without `--strict`, only errors fail. @@ -47,8 +47,8 @@ worth knowing. Without `--strict`, only errors fail. - **Static** (default): reads files only — `package.json`, the installed versions in `node_modules`, the config files, `.env` / `.env.example` (only variable names and the database name ever reach the report, never values), - the import map, `AGENTS.md`, the skills folder. It also runs `ipal-audit --quick` from the installed package. No - build, no database, no server. It writes nothing, except one date in `ipal-doctor.json` (below) outside CI. + the import map, `AGENTS.md`, the skills folder. It also runs `iapl-audit --quick` from the installed package. No + build, no database, no server. It writes nothing, except one date in `iapl-doctor.json` (below) outside CI. - **Live** (`--url`): GET requests only, no login, a doctor user agent, each path once per run. `localhost` is exempt from the HSTS check (plain http). - **Deep** (`--deep`): `pnpm exec payload run node_modules/@intecion/ipal-kit/dist/modules/doctor/probe.js` in the @@ -56,12 +56,12 @@ worth knowing. Without `--strict`, only errors fail. waiting for approval; the project's own env rules (`register()` from `instrumentation.ts`); the committed import map against a freshly generated one (written to a temporary file next to it and removed). Run it locally against the dev database, or in the Coolify app container's terminal against the MongoDB container. -- **Deep through the site**: with `--url` (and no `--deep`), when `IPAL_DOCTOR_TOKEN` is set in the doctor's +- **Deep through the site**: with `--url` (and no `--deep`), when `IAPL_DOCTOR_TOKEN` is set in the doctor's environment, the doctor reads the same counts from `GET /api/ipal/doctor` of the running site. ### The status endpoint — `GET /api/ipal/doctor` -Added by `ipalKit` and **off until the site has `IPAL_DOCTOR_TOKEN`** (at least 32 characters): before that it answers +Added by `iapl` and **off until the site has `IAPL_DOCTOR_TOKEN`** (at least 32 characters): before that it answers 404. With the token set it needs `Authorization: Bearer `, is rate-limited (10 a minute per client IP) and returns counts only — never names, e-mails or values: @@ -69,7 +69,7 @@ returns counts only — never names, e-mails or values: { "node": "v22.20.0", "openSignUp": [], "pendingCookies": 0, "plugin": "1.15.0", "staffOnOwnRoles": [], "staffOpenToOthers": [], "turnstile": null, "turnstileSecretFromEnv": false, "usersSetupClosed": 0, "usersWithout2fa": 0 } ``` -Turn off: `ipalKit({ doctor: false })`. Adapt: `ipalKit({ doctor: { tokenVar: 'MY_TOKEN', access: ({ req }) => isAdmin(req.user, req.payload) } })` (a logged-in staff admin may read it too; the second factor is checked for you — never test `req.user.roles` by hand, an account of another collection can carry the same value) +Turn off: `iapl({ doctor: false })`. Adapt: `iapl({ doctor: { tokenVar: 'MY_TOKEN', access: ({ req }) => isAdmin(req.user, req.payload) } })` (a logged-in staff admin may read it too; the second factor is checked for you — never test `req.user.roles` by hand, an account of another collection can carry the same value) (`access` lets a logged-in admin read it without the token). Building blocks: `buildDoctorEndpoint`, `collectDoctorStatus` from `@intecion/ipal-kit/doctor`. @@ -85,52 +85,56 @@ Turn off: `ipalKit({ doctor: false })`. Adapt: `ipalKit({ doctor: { tokenVar: 'M | | `node-22` | warning | `engines.node` only 22 (`">=22 <23"`), `.nvmrc` / `.node-version` = 22; with `--deep`, the running Node | | | `pnpm-pinned` | info | `packageManager` is set | | | `deps-audit` | error on critical/high, info on moderate/low | `pnpm audit --prod` (registry) | -| layout | `layout-required` | error | the AGENT.md §3 files (proxy, i18n config, instrumentation, `lib/content`, every route, the frontend files — `layout`, `actions`, `not-found`, `notFoundView` (`.ts` or `.tsx`), the catch-all page — in the route group found by structure: any `app/()` (or `app` itself) holding `[locale]/[[...slug]]/page.tsx` or `[[...slug]]/page.tsx`, a localized one first, `(frontend)` on a tie (two matches → a warning naming both); `layout.frontend` sets it, `blocks/registry.ts`, `collections/{Pages,Media}.ts`, `components/layout`, `components/forms/formClasses.ts`); an `ipal-audit-skip` key (`llms`, `llms-full`, `markdown`, `mcp`, `indexnow`) drops its file | +| layout | `layout-required` | error | the AGENT.md §3 files (proxy, i18n config, instrumentation, `lib/content`, every route, the frontend files — `layout`, `actions`, `not-found`, `notFoundView` (`.ts` or `.tsx`), the catch-all page — in the route group found by structure: any `app/()` (or `app` itself) holding `[locale]/[[...slug]]/page.tsx` or `[[...slug]]/page.tsx`, a localized one first, `(frontend)` on a tie (two matches → a warning naming both); `layout.frontend` sets it, `blocks/registry.ts`, `collections/{Pages,Media}.ts`, `components/layout`, `components/forms/formClasses.ts`); an `iapl-audit-skip` key (`llms`, `llms-full`, `markdown`, `mcp`, `indexnow`) drops its file | | | `layout-forbidden` | error | no `middleware.ts`, no `lib/{pages,locales,navigation}.ts`, `fields/{link,sectionHeader,sectionSettings}.ts` | | | `layout-extra` | info | `src/` entries outside the allow list (AGENT.md §3 + `seed/`, `design/`, `db.ts`, `env.rules.ts`, `content.config.ts`; extend with `layout.allow`) | | | `naming` | warning | block folders, collection and global files PascalCase, `scripts/*` kebab-case, no `index.ts` barrels | | | `importmap` | error | the import map exists, holds the entries for what the config turns on (2FA incl. `SafeTotpView`, `TwoFactorStatusField`, `TwoFactorAlert`; R2, cookie scanner, `adminMeta`), names no export the plugin no longer has; with `--deep`, equals a fresh one. Warning: the config uses the 2FA package's own setup / verify view as a view's `Component` (outside the `back` link check — security.md); not for that path as `ipalTotpView` of `SafeTotpView` or in `admin.dependencies` | | | `tsconfig-skills` | error | `tsconfig.json` excludes the skills folder | | env | `db-name` | error | `DATABASE_URI` in `.env` and `.env.example` names `_dev`; a local `.env` on `_prod` is an error; `--env-file` checks `_prod` (`databaseNamesFor`) | -| | `env-rules` | error / warning | `instrumentation.ts` calls `assertEnv(ipalEnvRules(…))` from `/env`, with `storage` (R2), `cookieCrawl` (crawl), `ipHeader`; `databaseName` suggested (info) | +| | `env-rules` | error / warning | `instrumentation.ts` calls `assertEnv(iaplEnvRules(…))` from `/env`, with `storage` (R2), `cookieCrawl` (crawl), `ipHeader`; `databaseName` suggested (info) | | | `env-example` | warning / error | `.env.example` lists the variables those rules name; no credentials or secret values in it | | | `env-live` | error | (deep) the project's env rules pass in the real environment | | security | `security-headers` | error | `buildSecurityHeaders`; live: HSTS, nosniff, Referrer-Policy, Permissions-Policy, frame protection | | | `powered-by` | error | `withSecurityConfig`; live: no `X-Powered-By` on `/` and the admin | | | `csp` | warning / info | CSP on the site and the admin; report-only is info, a warning after 4 weeks (`seen`) | | | `2fa` | error | `twoFactor: { plugin: payloadTotp }` + the package; deep: 0 users without TOTP (the message says how many of them are blocked because their setup window has passed); error: a Postgres / SQLite project whose migrations do not mention the 2FA column `totp_setup_from` (every login would answer 500; a warning when there is no migrations folder — the doctor cannot see a schema that gets there another way); warning: `twoFactor.requireSetup: false`; info: no setup window (`windowHours: false`) | -| | `access-missing` | warning | `ipalKit` has an `access` option — without it there are no roles and every panel account is an admin | +| | `access-missing` | warning | `iapl` has an `access` option — without it there are no roles and every panel account is an admin | | | `csrf-empty` | warning | the config sets `serverURL` or `csrf` — otherwise Payload accepts the login cookie from any origin | | | `open-signup` | info | (deep) auth collections whose `create` rule lets an anonymous request through: sign-up is open there (intended for a customer zone — silence with a reason) | | | `staff-own-roles` | warning | (deep) a staff collection with role values of its own, neither `editor` nor `admin` among them, that runs on the plugin's default account rules: the plugin cannot rank those roles, so inside the collection every account may create an account with any role and change or delete another. Write the collection's own rules | | | `staff-accounts-open` | error (warning for `read`, `readVersions`) | (deep) a staff collection that an account of another, non-staff auth collection may create in, read (also its versions), update, delete from or unlock — it can make itself staff, change a staff password, list the accounts or lift a login lock. The account rules are off (`accounts: false`, `adminOnlyCreate` / `adminOnlyWrite` / `staffOnlyRead: false`) or the project's own rule is wider. Asked with a made-up outside account; a rule that throws counts as closed | | | `turnstile-degraded` | warning / error | (deep) Turnstile is checking forms; while it is not (wrong or missing secret, Cloudflare down) a warning, an error once it has lasted 24 hours (counted from the recorded start to now) | | | `turnstile-env-key` | warning | (deep) the Turnstile secret key is in the panel, not in the deprecated `TURNSTILE_SECRET_KEY` environment variable | +| | `storage-names` | warning | the visitor cookie the layout sets (``, default `ipal_vid`) is the one the config makes the cookie scanner declare (`storageNames`, stats.md) | | | `cookie-scanner` | error / warning / info | `cookieScanner` on (with `crawl`, else info); deep: nothing waits for approval (warning) | -| admin | `admin-meta` | warning | ipal-kit ≥ 1.14.5, no `adminMeta: false` / `agency: false`; live: the admin `og:image` is `/api/ipal/admin-og` | +| admin | `admin-meta` | warning | IAPL ≥ 1.14.5, no `adminMeta: false` / `agency: false`; live: the admin `og:image` is `/api/ipal/admin-og` | | | `admin-noindex` | error | (live) the admin login page is noindex | -| agents | `agents-md` | error / warning | `AGENTS.md` with a non-empty `## Project decisions`, the `ipal-kit:start…end` pointer for the installed version, `CLAUDE.md` with `@AGENTS.md` | -| | `skills-current` | warning | `.agents/skills/ipal-*` equal the installed plugin's (`planSkills`, what `ipal-skills` would change) | -| seeds | `seed-named` | error / warning | every `seed*` script uses `createSeeder` (`only` / `SEED_ONLY`, the full-seed guard), deletes nothing, has no `fresh`/`reset` script, does not switch the guard off (`guard: false`, `allowFull: true`, `IPAL_SEED_ALLOW_FULL=1` in a script or committed env file); after launch a seed without an `only` list is a warning | +| agents | `agents-md` | error / warning | `AGENTS.md` with a non-empty `## Project decisions`, the `iapl:start…end` pointer for the installed version, `CLAUDE.md` with `@AGENTS.md` | +| | `legacy-names` | info / warning | names from before the rename to IAPL (1.17.0) the project still uses: `ipal-doctor.json`, `ipalKit` / `ipalEnvRules` and the other old exports in the config and `instrumentation.ts`, old commands in `package.json` scripts, `IPAL_*` in env files, the old pointer block, `ipal-audit-skip`, `ipal-*` skill folders. All of them work, so this is information; a **warning** only for two doctor files side by side, or one variable set as `IAPL_…` and `IPAL_…` with different values | +| | `skills-current` | warning | `.agents/skills/iapl-*` equal the installed plugin's (`planSkills`, what `iapl-skills` would change) | +| seeds | `seed-named` | error / warning | every `seed*` script uses `createSeeder` (`only` / `SEED_ONLY`, the full-seed guard), deletes nothing, has no `fresh`/`reset` script, does not switch the guard off (`guard: false`, `allowFull: true`, `IAPL_SEED_ALLOW_FULL=1` in a script or committed env file); after launch a seed without an `only` list is a warning | | blocks | `blocks-registry` | error | `blocks/registry.ts` uses `createBlockRegistry` or `RenderBlocks` (no `switch (blockType)`) | | | `blocks-ui-required` | error | without `createBlockRegistry`, `components/ui/` has Section, SectionHeader, Media, CMSLink, Button | | | `blocks-ui-override` | warning | a `components/ui/` file named like a library primitive is passed through `createBlockRegistry({ ui })` | | | `blocks-duplicate` | warning | a project block whose `slug` (or `interfaceName`) matches a library block — also a slug renamed through the block's `slug` option — unless it is an override in `createBlockRegistry({ components })` | | | `blocks-helper-copy` | warning | no local copy of a plugin field builder (`blockLibraryManifest.fieldBuilders`), `ctaHref`, `buildActionButtonsField` | -| | `blocks-tokens` | error / warning | from `ipal-audit`: hex colours, the token standard not wired, `ipal-tokens --check` | -| audit | `i18n-literals` | error / warning | from `ipal-audit`: hardcoded text in blocks (error) and components (warning), Polish literals in code (not the panel's `adminText()` / `{ en, pl }` labels in a schema file — the `ipal-audit` skill) | -| | `audit:` | as reported | every other `ipal-audit --quick` finding, one per file | -| live | `live-reachable`, `live-health`, `live-noindex`, `live-seo` | error / warning | the URL answers; `/api/health` 200; production not noindex (staging must be); every `ipal-seo-check` error and warning | +| | `blocks-tokens` | error / warning | from `iapl-audit`: hex colours, the token standard not wired, `iapl-tokens --check` | +| audit | `i18n-literals` | error / warning | from `iapl-audit`: hardcoded text in blocks (error) and components (warning), Polish literals in code (not the panel's `adminText()` / `{ en, pl }` labels in a schema file — the `iapl-audit` skill) | +| | `audit:<title>` | as reported | every other `iapl-audit --quick` finding, one per file | +| live | `live-reachable`, `live-health`, `live-noindex`, `live-seo` | error / warning | the URL answers; `/api/health` 200; production not noindex (staging must be); every `iapl-seo-check` error and warning | | deep | `deep-status` | error | the deep check could not finish | -| — | `doctor-config` | error / warning | `ipal-doctor.json` problems: invalid JSON, an entry without a reason, an expired `until` | +| — | `doctor-config` | error / warning | `iapl-doctor.json` problems: invalid JSON, an entry without a reason, an expired `until` | | — | `doctor-crash` | error (exit 3) | a rule threw | The block rules read `blockLibraryManifest` (`@intecion/ipal-kit/blocks`), so a new library block needs no doctor change. -## Adapt it — `ipal-doctor.json` +## Adapt it — `iapl-doctor.json` -Every rule can be silenced, lowered or raised — **with a reason** — in `ipal-doctor.json` in the project root: +Every rule can be silenced, lowered or raised — **with a reason** — in `iapl-doctor.json` in the project root +(a project that has `ipal-doctor.json`, the name before 1.17.0, keeps it: the doctor reads and writes whichever +of the two exists, `iapl-doctor.json` when both do): ```json { @@ -160,7 +164,7 @@ Every rule can be silenced, lowered or raised — **with a reason** — in `ipal Silenced findings stay in the report: in JSON with `"silenced": true` and the reason, in the human output under "Silenced", in the summary count. `--strict` does not fail on them. -`ipal-audit-skip: <keys> — <reason>` lines in `AGENTS.md` (a client decision, AGENT.md §0b) count too: the audit honours +`iapl-audit-skip: <keys> — <reason>` lines in `AGENTS.md` (a client decision, AGENT.md §0b) count too: the audit honours its keys, and the doctor maps `twofactor` → `2fa`, `csp` → `csp`, and drops the files of `llms`, `llms-full`, `markdown`, `mcp`, `indexnow` from `layout-required`. @@ -188,9 +192,9 @@ New sites only (the starter's and the reference site) gate on the doctor; existi ```yaml - run: pnpm install --frozen-lockfile -- run: pnpm exec ipal-doctor --strict --offline # static, right after install +- run: pnpm exec iapl-doctor --strict --offline # static, right after install # … build, start the app on :3000 with the CI database … -- run: pnpm exec ipal-doctor --strict --offline --deep --url http://localhost:3000 +- run: pnpm exec iapl-doctor --strict --offline --deep --url http://localhost:3000 ``` The plugin's own CI does the same for `reference/` (`.gitea/workflows/ci.yml`). @@ -217,18 +221,18 @@ console.log(formatReport(report)) | Variable | Where | Effect | |---|---|---| -| `IPAL_DOCTOR_TOKEN` | the site (Coolify), ≥ 32 characters | turns `GET /api/ipal/doctor` on; in the doctor's environment, `--url` uses it to read the deep counts | -| `CI` | the doctor's environment | set → the doctor never writes `seen` into `ipal-doctor.json` | +| `IAPL_DOCTOR_TOKEN` | the site (Coolify), ≥ 32 characters | turns `GET /api/ipal/doctor` on; in the doctor's environment, `--url` uses it to read the deep counts | +| `CI` | the doctor's environment | set → the doctor never writes `seen` into `iapl-doctor.json` | | `NO_COLOR` | the doctor's environment | no colours in the human report | | `PAYLOAD_CONFIG_PATH` | the project | `--deep` loads this config instead of `src/payload.config.ts` | -| `IPAL_DOCTOR_IMPORT_MAP` | internal | set by the doctor for the probe: the committed import map to compare | +| `IAPL_DOCTOR_IMPORT_MAP` | internal | set by the doctor for the probe: the committed import map to compare | ## Relation to the other checks | Tool | When | |---|---| -| `ipal-audit` | inside the edit loop: is the code I just wrote built the ipal-kit way (+ tsc and build without `--quick`) | -| `ipal-seo-check` | what crawlers see on a running site | -| `ipal-consent-check` | tracking waits for consent (a real browser) — not run by the doctor | -| `ipal-skills` | copies the skills; the doctor's `skills-current` uses the same comparison (`planSkills`) | -| **`ipal-doctor`** | the whole site against the team standard: runs `ipal-audit --quick` and (with `--url`) `ipal-seo-check` from the installed package and adds everything they do not check | +| `iapl-audit` | inside the edit loop: is the code I just wrote built the IAPL way (+ tsc and build without `--quick`) | +| `iapl-seo-check` | what crawlers see on a running site | +| `iapl-consent-check` | tracking waits for consent (a real browser) — not run by the doctor | +| `iapl-skills` | copies the skills; the doctor's `skills-current` uses the same comparison (`planSkills`) | +| **`iapl-doctor`** | the whole site against the team standard: runs `iapl-audit --quick` and (with `--url`) `iapl-seo-check` from the installed package and adds everything they do not check | diff --git a/docs/email.md b/docs/email.md index 9f09259..c14323a 100644 --- a/docs/email.md +++ b/docs/email.md @@ -247,7 +247,7 @@ The large path, step by step, and what happens when it fails: # a mail-enabled security group that holds only the sender mailbox New-DistributionGroup -Name "ipal-forms-mailbox" -Type Security -Members forms@intecion.pl New-ApplicationAccessPolicy -AppId <GRAPH_CLIENT_ID> -PolicyScopeGroupId ipal-forms-mailbox ` - -AccessRight RestrictAccess -Description "ipal-kit: only the forms mailbox" + -AccessRight RestrictAccess -Description "IAPL: only the forms mailbox" Test-ApplicationAccessPolicy -AppId <GRAPH_CLIENT_ID> -Identity forms@intecion.pl # AccessCheckResult: Granted Test-ApplicationAccessPolicy -AppId <GRAPH_CLIENT_ID> -Identity someone.else@intecion.pl # AccessCheckResult: Denied ``` diff --git a/docs/env.md b/docs/env.md index 0560ab3..4235a83 100644 --- a/docs/env.md +++ b/docs/env.md @@ -27,11 +27,11 @@ server startup): ```ts // src/instrumentation.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 // Edge: no server process.env - assertEnv(ipalEnvRules({ storage: true, emailGraph: true, turnstile: true })) + assertEnv(iaplEnvRules({ storage: true, emailGraph: true, turnstile: true })) } ``` @@ -39,18 +39,18 @@ export function register() { > `instrumentation.ts` for Edge too. The package root pulls in Payload, `file-type`, > `fs` — Turbopack fails (`Export fileTypeFromFile doesn't exist in target module`). > `/env` is only the validator, zero dependencies. The root still exports `assertEnv` -> and `ipalEnvRules` (e.g. for `payload.config.ts`). +> and `iaplEnvRules` (e.g. for `payload.config.ts`). **Turn off / override / extend:** validation is fully opt-in — the plugin never calls `assertEnv` by itself; without this line nothing is checked. Replace any preset rule by filtering -the array (`ipalEnvRules(…).filter((r) => r.name !== 'X')`), add your own (spread below), or +the array (`iaplEnvRules(…).filter((r) => r.name !== 'X')`), add your own (spread below), or write the whole set by hand. Alternatively at the top of `payload.config.ts` (it loads both at build time and at runtime). Server-side only (reads `process.env`) — do NOT import it into a client component. -## ipalEnvRules — ready-made schema for the stack (opt-in) +## iaplEnvRules — ready-made schema for the stack (opt-in) Builds the rule set from the features the project actually uses — a site on local disk is not forced to set `R2_*`, a site without forms is not forced to set Turnstile. @@ -58,11 +58,11 @@ It is not a rigid required set (A0: the plugin does not demand config you do not use). ```ts -ipalEnvRules({ +iaplEnvRules({ storage?: boolean | { requirePublicUrl?: boolean }, // R2_* (R2_BUCKET, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_ENDPOINT; R2_PUBLIC_URL optional) emailGraph?: boolean, // GRAPH_* (GRAPH_TENANT_ID, GRAPH_CLIENT_ID, GRAPH_CLIENT_SECRET, GRAPH_SENDER — e-mail) - cookieCrawl?: boolean, // IPAL_COOKIE_SCAN_URL (url), IPAL_COOKIE_SCAN_TOKEN (≥ 16 chars) — required in production; cookieScanner.crawl (cookie-scanner.md) - ipHeader?: boolean, // IPAL_IP_HEADER — required in production, optional outside it (header name [a-z0-9-]) + cookieCrawl?: boolean, // IAPL_COOKIE_SCAN_URL (url), IAPL_COOKIE_SCAN_TOKEN (≥ 16 chars) — required in production; cookieScanner.crawl (cookie-scanner.md) + ipHeader?: boolean, // IAPL_IP_HEADER — required in production, optional outside it (header name [a-z0-9-]) turnstile?: boolean | { siteKeyVar?: string; secretVar?: string }, // NEXT_PUBLIC_TURNSTILE_SITE_KEY, TURNSTILE_SECRET_KEY serverUrlVar?: string, // default 'NEXT_PUBLIC_SERVER_URL' secretVar?: string, // default 'PAYLOAD_SECRET' @@ -75,10 +75,10 @@ ipalEnvRules({ Always (core): `DATABASE_URI`, `PAYLOAD_SECRET` (in production at least `secretMinLength` = 32 characters), `NEXT_PUBLIC_SERVER_URL` (URL), `NODE_ENV` (optional, oneOf `development`/`production`/`test`). The names `R2_*` / `GRAPH_*` / -`NEXT_PUBLIC_SERVER_URL` / `IPAL_IP_HEADER` / Turnstile match what the plugin modules +`NEXT_PUBLIC_SERVER_URL` / `IAPL_IP_HEADER` / Turnstile match what the plugin modules read; DB/secret are Payload variables — their names can be overridden. -**`storage: true` — when R2_* are required** (evaluated when `ipalEnvRules` is called): +**`storage: true` — when R2_* are required** (evaluated when `iaplEnvRules` is called): - `NODE_ENV=production` → the 4 keys (`R2_BUCKET`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_ENDPOINT`); - outside production, when any of the 4 keys is set → all 4 (all or none); - outside production without keys → none required (local disk); `R2_PUBLIC_URL` alone passes @@ -91,8 +91,14 @@ read; DB/secret are Payload variables — their names can be overridden. from the panel first (Site integrations) and env is only a fallback — turn it on only when you keep the keys in env. +**Names.** The plugin's own variables are `IAPL_<NAME>` since 1.17.0. A deploy that still sets `IPAL_<NAME>` +keeps working: `IAPL_…` is read first, `IPAL_…` when it is missing or empty (also by `assertEnv(iaplEnvRules())`, +whose messages name the `IAPL_` spelling). Set one of the two; `iapl-doctor` (`legacy-names`) warns when both are +set with different values. For your own rules: `{ name: 'NEW_NAME', aliases: ['OLD_NAME'] }` reads the old +name the same way. `ipalEnvRules` is the old name of `iaplEnvRules` and still exported. + The plugin also reads (outside the preset — add your own rules if you want to validate them): -`INDEXNOW_KEY` (seo.md), `IPAL_NOINDEX` (`1`/`true`/`yes` — staging, seo.md), `IPAL_DOCTOR_TOKEN` (≥ 32 characters — +`INDEXNOW_KEY` (seo.md), `IAPL_NOINDEX` (`1`/`true`/`yes` — staging, seo.md), `IAPL_DOCTOR_TOKEN` (≥ 32 characters — turns `GET /api/ipal/doctor` on, doctor.md). Full table: [deployment.md](./deployment.md). @@ -100,7 +106,7 @@ Extending with your own variables — spread: ```ts assertEnv([ - ...ipalEnvRules({ storage: true }), + ...iaplEnvRules({ storage: true }), { name: 'MY_API_KEY', description: 'Key for integration X' }, ]) ``` @@ -108,7 +114,7 @@ assertEnv([ ### Database names — `databaseName` The naming rule (deployment.md §4.2a): the site's domain with the dots removed, plus `_prod` / `_dev` — -`intecion.com` → `intecioncom_prod` / `intecioncom_dev`. `ipalEnvRules({ databaseName: true })` adds a check that +`intecion.com` → `intecioncom_prod` / `intecioncom_dev`. `iaplEnvRules({ databaseName: true })` adds a check that only **warns** (console, or your `warn`) when the database in `DATABASE_URI` breaks it. The domain comes from `NEXT_PUBLIC_SERVER_URL` in `process.env` (localhost and dotless hosts are skipped) or from `{ domain }`. @@ -128,7 +134,7 @@ assertEnv(rules: EnvRule[], options?: { env?, label? }): void Collects ALL problems and throws one aggregated `Error`. With no problems it does nothing. `options.env` (default `process.env`) makes testing easier; -`options.label` changes the prefix (default `[ipal]`). +`options.label` changes the prefix (default `[iapl]`). ### EnvRule @@ -154,10 +160,10 @@ assertEnv([ ]) ``` -### Sample message (preset `ipalEnvRules()`) +### Sample message (preset `iaplEnvRules()`) ``` -[ipal] Environment validation failed (3 problems): +[iapl] Environment validation failed (3 problems): • DATABASE_URI is required but missing — Database connection string (e.g. MongoDB URI) • NEXT_PUBLIC_SERVER_URL must be a valid URL (got "example.com") — Public site origin, e.g. https://example.com • NODE_ENV must be one of: development, production, test (got "prod") — Node environment @@ -170,19 +176,19 @@ redeploys. ## Exports ```ts -import { assertEnv, checkDatabaseName, databaseNameFromUri, databaseNamesFor, ipalEnvRules } from '@intecion/ipal-kit/env' -import type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from '@intecion/ipal-kit/env' +import { assertEnv, checkDatabaseName, databaseNameFromUri, databaseNamesFor, iaplEnvRules } from '@intecion/ipal-kit/env' +import type { EnvRule, EnvKind, AssertEnvOptions, IaplEnvFeatures } from '@intecion/ipal-kit/env' ``` ## `R2_PUBLIC_URL` — production vs dev -`R2_PUBLIC_URL` is optional in `ipalEnvRules({ storage: true })`: our default is media served through the app +`R2_PUBLIC_URL` is optional in `iaplEnvRules({ storage: true })`: our default is media served through the app with `R2_PUBLIC_URL` **empty** (the client zones are not on Cloudflare — storage.md, deployment.md §6). When it is set, **production** requires a full URL (`https://media.klient-media.com`). A project that always uses a media domain requires it: ```ts -assertEnv(ipalEnvRules({ storage: { requirePublicUrl: true }, ipHeader: true })) +assertEnv(iaplEnvRules({ storage: { requirePublicUrl: true }, ipHeader: true })) ``` Outside production it allows a relative path diff --git a/docs/forms.md b/docs/forms.md index f700b29..576d2ee 100644 --- a/docs/forms.md +++ b/docs/forms.md @@ -40,7 +40,7 @@ configuration (see below) or extend the plugin. Do NOT hard-code your own form. ## Config (payload.config.ts) ```ts -ipalKit({ +iapl({ forms: { redirectRelationships: ['pages'], // a form can redirect to a Page // fields: { date: false, … }, // default: text, textarea, email, number, date, @@ -55,7 +55,7 @@ ipalKit({ |---|---|---| | `adminGroup` | `'Forms'` | group in the panel; `false` = Payload's default; `admin.group` in overrides wins | | `attachments` | `false` | files on forms: adds the **File** field; a file is checked, e-mailed to the company and dropped — never stored ("Files" below) | -| `fields` | see below | builder field types; `false` turns a type off, an object (block) replaces it; `true` = the default ipal block | +| `fields` | see below | builder field types; `false` turns a type off, an object (block) replaces it; `true` = the default IAPL block | | `redirectRelationships` | — | collections a form can redirect to | | `formOverrides` / `formSubmissionOverrides` | — | collection overrides (`fields` as a function + any collection settings) | | `emailLayout` | `false` | nice emails + the Site settings → E-mails tab | @@ -84,7 +84,7 @@ import { RenderForm } from '@intecion/ipal-kit/rsc' - `form` — the relation from the block (depth ≥ 1; an ID or null → nothing renders), - `action` — `sendForm` from `createSubmitAction` (below), `texts` — `getFormTexts(locale)` from `lib/content` (Form messages → Form messages), -- `classNames` — the **only** place for looks (`src/components/forms/formClasses.ts`, template in ipal-form); +- `classNames` — the **only** place for looks (`src/components/forms/formClasses.ts`, template in iapl-form); the plugin has no styles at all. Keys: `form, progress, step, stepTitle, stepDescription, fields, field, fieldHalf, fieldFull, label, input, textarea, select, checkbox, checkboxLabel, choices, legend, choice, choiceInput, choiceLabel, message, error, formError, turnstile, actions, back, @@ -177,7 +177,7 @@ pass the raw form document to the browser. `stepIndex`, `total`, `isFirst/isLast`, `next()`, `back()`, `goTo(i)`, `submit`, `values`, `errors`, `errorMessage`, `isSubmitting`, `isSuccess`, `resultMessage`, `isFixed`, `getFieldProps`, `getInputProps`, `getTextareaProps`, `getSelectProps`, `getOptionProps`, `fieldId`, `errorId`, - `TurnstileWidget`; for a File field `getFileProps`, `getFiles`, `removeFile`, `helpId`. Example: `ipal-form/resources/CustomForm.example.tsx`. + `TurnstileWidget`; for a File field `getFileProps`, `getFiles`, `removeFile`, `helpId`. Example: `iapl-form/resources/CustomForm.example.tsx`. 3. Pure logic (also on the server / in tests): `splitSteps`, `initialBuilderValues`, `validateBuilderFields`, `stepOfField`, `inputFields`, `visibleFields`, `autoCompleteFor` (autocomplete hint from the field's type and name), `fileFieldRules`, `fileFieldError`, `formatFileSize` (File field). @@ -194,7 +194,7 @@ records only the file's name, type and size and whether the mail server took the ```ts // payload.config.ts -ipalKit({ forms: { attachments: true } }) // adds the File field to the form builder +iapl({ forms: { attachments: true } }) // adds the File field to the form builder ``` 1. Turn the option on (above). Postgres / SQLite projects: `pnpm payload migrate:create` (new block and submission @@ -410,7 +410,7 @@ const f = useForm({ initialValues, validate, submitAction: sendForm.bind(null, f `submitForm` result: `{ success: true, submissionId }` or `{ success: false, reason, … }` (codes below). Options: `payload`, `formId`, `data` (required), `files`, `attemptKey` ("Files" above), `ip`, `locale`, `turnstileToken`, `maxPerMinute` (default 5, `0` turns it off; without `ip` — the shared `unknown-ip` bucket, below), -`consentFieldName` (default from `ipalKit({ forms })`, then `'consent'`), `turnstileOnConfigError` +`consentFieldName` (default from `iapl({ forms })`, then `'consent'`), `turnstileOnConfigError` (`'allow'` | `'reject'`, default `'allow'`), `turnstileHostnames` (see [turnstile.md](./turnstile.md)). Simpler: `createSubmitAction({ getCachedPayload, headers })` from `/server` (section 1.9.1 below) — @@ -421,24 +421,24 @@ extra options: `clientIp`, `honeypotField`, `consentFieldName`, `maxPerMinute`, `clientIp(req | headers, { header?, trustedProxies? })` (from `@intecion/ipal-kit`): -- **Pinned header** — `header` or the env **`IPAL_IP_HEADER`**: only that header is read (missing → empty +- **Pinned header** — `header` or the env **`IAPL_IP_HEADER`**: only that header is read (missing → empty string). For `x-forwarded-for` it takes the `trustedProxies`-th entry (default 1) from the right. - **Not pinned** (default): it trusts **any** of the headers, in this order: `cf-connecting-ip`, `x-real-ip`, then `X-Forwarded-For` counted **from the right** (the client writes the left part itself). A client that reaches the app bypassing the proxy can therefore inject `cf-connecting-ip` / - `x-real-ip` and dodge the limit. In production without `IPAL_IP_HEADER` there is a one-time warning in the log. - Set e.g. `IPAL_IP_HEADER=cf-connecting-ip` behind Cloudflare, `x-forwarded-for` only behind Traefik/nginx. + `x-real-ip` and dodge the limit. In production without `IAPL_IP_HEADER` there is a one-time warning in the log. + Set e.g. `IAPL_IP_HEADER=cf-connecting-ip` behind Cloudflare, `x-forwarded-for` only behind Traefik/nginx. - No recognised IP → the shared bucket (below). The same `clientIp` option exists in `createSearchRoute` and `createMcpRoute`. -A missing IP (the proxy strips the header, a wrong `IPAL_IP_HEADER`) does **not** bypass the limit: such requests +A missing IP (the proxy strips the header, a wrong `IAPL_IP_HEADER`) does **not** bypass the limit: such requests share one `unknown-ip` bucket with a ×20 limit (`UNKNOWN_IP_FACTOR`) — real visitors get through, a flood without the header does not. `setUnknownIpFactor(n)` (root, once at startup) changes the multiplier; `setUnknownIpFactor(0)` = the old behaviour (no limit), when a limiter sits in front. Without a pinned header the order `cf-connecting-ip` → `x-real-ip` → XFF stays (switching to XFF-only, from the right, would put every visitor -behind Cloudflare into the bucket of the edge node) — that is why `IPAL_IP_HEADER` is mandatory in production -(`ipalEnvRules({ ipHeader: true })`). +behind Cloudflare into the bucket of the edge node) — that is why `IAPL_IP_HEADER` is mandatory in production +(`iaplEnvRules({ ipHeader: true })`). Limits are kept in memory by default, separately for each instance. Several instances → a shared store (e.g. Redis) once at startup: `setRateLimitStore({ hit })` @@ -495,7 +495,7 @@ forms: { emailLayout: true } // optional: beforeEmail: (emails, args) a form needs beyond its own fields: ```ts -ipalKit({ +iapl({ forms: { redirectRelationships: ['pages'], formOverrides: { @@ -521,7 +521,7 @@ remove and reorder. Besides `fields` it accepts any collection settings then does it store. A flood dies before it touches the network or the database. **REST is closed.** By default the form-builder lets anyone create submissions through -`POST /api/form-submissions` — skipping all the gates below. ipal-kit +`POST /api/form-submissions` — skipping all the gates below. IAPL sets `access.create` of the `form-submissions` collection to "logged-in users only"; the front end submits through `submitForm` (server action → Local API), so this does not affect it. A deliberately public REST (e.g. an external app) → @@ -634,7 +634,7 @@ export const sendForm = createSubmitAction({ getCachedPayload, headers, consentF // or: submitForm({ …, consentFieldName: 'zgoda' }) ``` -Or once for the whole site: `ipalKit({ forms: { consentFieldName: 'zgoda' } })` — `submitForm` +Or once for the whole site: `iapl({ forms: { consentFieldName: 'zgoda' } })` — `submitForm` reads it from `payload.config.custom.ipal` when the call does not pass one. ## Messages — resolveFormMessage (recommended) @@ -770,7 +770,7 @@ the analytics fields to the Forms collection: ```ts // payload.config.ts import { buildFormAnalyticsFields } from '@intecion/ipal-kit' -ipalKit({ +iapl({ forms: { formOverrides: { fields: ({ defaultFields }) => [...defaultFields, ...buildFormAnalyticsFields()], @@ -823,7 +823,7 @@ filter it out on the client. `export const sendForm = createSubmitAction({ getCachedPayload, headers })` (`headers` from `next/headers`, injected). Honeypot → `clientIp` → `submitForm` → text from Notifications; result `{ success, message, reason?, field? }`. -- **Form seed** (`ipal-form/resources/seed-form.template.ts`): fields, confirmation, an email to the company +- **Form seed** (`iapl-form/resources/seed-form.template.ts`): fields, confirmation, an email to the company (address from the panel) and a confirmation to the customer (`{{email}}`), every language, idempotent. Mandatory. - **Validation by the field type from the panel:** email = one address (no `a@x, b@y`, no CR/LF), select/radio only values from the panel, numbers, checkbox `true/false`, objects and arrays rejected, control diff --git a/docs/gtm-meta-pixel.md b/docs/gtm-meta-pixel.md index bbdd699..3af0bcf 100644 --- a/docs/gtm-meta-pixel.md +++ b/docs/gtm-meta-pixel.md @@ -1,4 +1,4 @@ -# GTM + Meta Pixel — setup (ipal-kit stack) +# GTM + Meta Pixel — setup (IAPL stack) A step-by-step guide to wiring Meta Pixel through Google Tag Manager on a site built on `@intecion/ipal-kit`. Written for our stack: the plugin already does part diff --git a/docs/hooks.md b/docs/hooks.md index 1e8e2fe..d1957c6 100644 --- a/docs/hooks.md +++ b/docs/hooks.md @@ -44,7 +44,7 @@ the path of the deleted document. Limits (code state, `src/modules/hooks/buildRevalidateHook.ts`): - **Collections only** — these are collection `afterChange`/`afterDelete` hooks. Globals are - handled by `buildGlobalRevalidateHook` / `ipalKit({ revalidatePath })` — see below. + handled by `buildGlobalRevalidateHook` / `iapl({ revalidatePath })` — see below. - The slug in the hook is usually a string in the saved locale, so the same slug goes into the path of every locale (`/pl/o-nas`, `/en/o-nas`); the real address in another locale (`/en/about`) is not refreshed. A change to a non-localized field (e.g. an image) stays stale in other locales until @@ -59,7 +59,7 @@ migrations — there is no `process.env.NEXT_RUNTIME`. Before, Next threw `Invar and the seed failed. Deliberate skip (bulk import in the app): `context: { disableRevalidate: true }` in the Local API call. -### Globals — buildGlobalRevalidateHook / `ipalKit({ revalidatePath })` +### Globals — buildGlobalRevalidateHook / `iapl({ revalidatePath })` A global (Site settings, Cookie banner, the project's menu) feeds the layout of **every** page — logo, menu, consent texts, analytics IDs. Without revalidation, ISR pages kept the old values until the end of the @@ -68,14 +68,14 @@ consent texts, analytics IDs. Without revalidation, ISR pages kept the old value ```ts // payload.config.ts — the plugin's globals (Site settings, Site integrations, Cookie banner, Notifications) import { revalidatePath } from 'next/cache' -ipalKit({ …, revalidatePath }) +iapl({ …, revalidatePath }) // the project's own global (e.g. a menu) import { buildGlobalRevalidateHook } from '@intecion/ipal-kit' hooks: { afterChange: [buildGlobalRevalidateHook({ revalidatePath })] } ``` -- With `revalidatePath` passed to `ipalKit()`, the plugin appends the hook itself to `afterChange` of +- With `revalidatePath` passed to `iapl()`, the plugin appends the hook itself to `afterChange` of `site-settings`, `site-integrations`, `cookie-settings` and `notifications` (`src/plugin.ts`). Without the option, the plugin's globals are not revalidated. - The project's own globals (Header/Footer menu etc.) need the hook wired by hand, as above. @@ -236,7 +236,7 @@ A sync error is logged; the save does not fail. The text counterpart of `buildCrossLocaleFieldSync`: text saved in one language goes to every language where that field is still empty; a language with its own text is never overwritten. The -plugin adds it to the cookie list and the cookie review (`ipalKit({ fillEmptyLocales })`, consent.md). +plugin adds it to the cookie list and the cookie review (`iapl({ fillEmptyLocales })`, consent.md). On your own global or collection: ```ts @@ -298,8 +298,8 @@ setPublishedAt; everything with a URL: revalidate + slugHistory; Pages: + preven ## Turn off, override, extend - The plugin does not wire these collection hooks itself (exceptions: `seo` → meta auto-fill, `indexNow` → the IndexNow hook) — you add each one in the project's collection, so turning one off = not adding it. -- Global revalidation: the plugin adds `buildGlobalRevalidateHook` to its own globals only when you pass `ipalKit({ revalidatePath })`; leave the option out to turn it off. -- `globalOverrides` (`ipalKit({ globalOverrides: { 'site-settings': …, 'site-integrations': …, 'cookie-settings': …, notifications: … } })`): an object merges over the plugin's global — `access`, `admin` and `hooks` key by key (your access rules win, your hooks run after the plugin's), any other key replaces the plugin's value; a function gets the plugin's global and returns the one to use (full control, e.g. drop the plugin's revalidate hook, add `buildValidateUniqueRole` to the role fields, or use `revalidateTag`). +- Global revalidation: the plugin adds `buildGlobalRevalidateHook` to its own globals only when you pass `iapl({ revalidatePath })`; leave the option out to turn it off. +- `globalOverrides` (`iapl({ globalOverrides: { 'site-settings': …, 'site-integrations': …, 'cookie-settings': …, notifications: … } })`): an object merges over the plugin's global — `access`, `admin` and `hooks` key by key (your access rules win, your hooks run after the plugin's), any other key replaces the plugin's value; a function gets the plugin's global and returns the one to use (full control, e.g. drop the plugin's revalidate hook, add `buildValidateUniqueRole` to the role fields, or use `revalidateTag`). - Skip revalidation per call: `context: { disableRevalidate: true }`. - Configurable: `homeSlug` (revalidate), `settingsSlug`/`roleFields` (preventDelete), `siblingFields` (unique role), `arrayField`/`guardFlag`/`fields` (cross-locale sync). - Fixed: the field name `slugHistory` in `trackSlugHistoryHook` and `publishedAt`/`_status` in `setPublishedAtHook` — other names need your own hook. diff --git a/docs/i18n.md b/docs/i18n.md index 52c7904..b684438 100644 --- a/docs/i18n.md +++ b/docs/i18n.md @@ -7,7 +7,7 @@ language switching without 404. ## Config (payload.config.ts) ```ts -ipalKit({ +iapl({ i18n: { defaultLocale: 'pl', locales: [ @@ -28,8 +28,8 @@ ipalKit({ The `i18n` option is **required** (type `I18nConfig`). The plugin sets `config.localization` from it (overriding the project's own `localization`). Validation is eager — already when -`ipalKit()` is called, also with `enabled: false`: an empty list, missing `code`/`label`, -duplicate codes, a `defaultLocale` not in the list, a bad code format → error `[ipal] i18n: ...`. +`iapl()` is called, also with `enabled: false`: an empty list, missing `code`/`label`, +duplicate codes, a `defaultLocale` not in the list, a bad code format → error `[iapl] i18n: ...`. **`fallback: true` and saving.** Reading a language with no value returns the default language's value — and **saving the document persists it**: saving a page (in the admin panel or with `payload.update`) in any @@ -307,7 +307,7 @@ sitemap, canonical), two or more = with the prefix. With one language, **do not structure in advance — the plugin would generate `/kontakt` links while pages live under `/pl/kontakt`. When the client adds a second language: -1. add the language to `i18n.config.ts` (and `localization` in Payload via `ipalKit`), +1. add the language to `i18n.config.ts` (and `localization` in Payload via `iapl`), 2. move `app/(frontend)/*` to `app/(frontend)/[locale]/`, and `app/md/[[...slug]]` to `app/md/[locale]/[[...slug]]`, 3. the layout takes `locale` from `params` (PROGRAMISTA §2.8) — `createPageRoute` / `createNotFoundPage` unchanged, 4. translate slugs and content in the admin panel. @@ -412,7 +412,7 @@ Payload takes the browser's language (English or Polish), else `i18n.fallbackLan default `en`). An English browser therefore gets an English panel — 2FA screens included — on a Polish site; set `i18n.fallbackLanguage: 'pl'` in your config to change the last step. -- **Default:** when the project's `buildConfig` has no `i18n.supportedLanguages`, ipal-kit +- **Default:** when the project's `buildConfig` has no `i18n.supportedLanguages`, IAPL sets English and Polish. A project that sets its own list keeps it, untouched: ```ts @@ -437,11 +437,11 @@ Polish site; set `i18n.fallbackLanguage: 'pl'` in your config to change the last A language the plugin has no texts for (e.g. `de`) gets the English ones until you add yours. -- **Building blocks** for your own admin components: `ipalT(t, key, vars)` reads a plugin +- **Building blocks** for your own admin components: `iaplT(t, key, vars)` reads a plugin text through Payload's `t`; `formatNumber(n, language)` and `formatDateTime(iso, language, timeZone?)` format in the admin language; `defineTexts({ en, pl })` declares a text set whose Polish keys must match the English ones; `ADMIN_LANGUAGES` lists the plugin's languages; - `applyAdminI18n(config)` is the config step itself (already applied by `ipalKit`). + `applyAdminI18n(config)` is the config step itself (already applied by `iapl`). - **Browser-tab title of a custom admin view:** Payload takes a view's `meta.title` as one plain string and never translates it (its custom-view metadata ignores `i18n`), so the server-rendered title stays in that one language. Render `<DocumentTitle title={…} />` diff --git a/docs/integrations.md b/docs/integrations.md index 064344e..2fdee87 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -47,7 +47,7 @@ The same mechanism for project integrations (fields via `integrationsFields`): ```ts import { buildIntegrationStatusBanner, buildIntegrationStatusField, recordIntegrationStatus } from '@intecion/ipal-kit' -ipalKit({ +iapl({ integrationsFields: [ // UI field `crmStatusBanner`; label as a string or { en, pl }; optional third argument // { failing, hint } = keys of your own texts in i18n.translations.<lang>.ipal @@ -77,8 +77,8 @@ The dashboard `IntegrationAlerts` checks only `emailStatus` and `turnstileStatus - The `site-integrations` global, the `/api/ipal/test-email` endpoint and `IntegrationAlerts` on the dashboard are **currently always added** — there is no option to turn them off. Workaround: a project plugin - wired after `ipalKit()` that removes / replaces the entry in `config.globals`, `config.endpoints` or + wired after `iapl()` that removes / replaces the entry in `config.globals`, `config.endpoints` or `admin.components.beforeDashboard`. - Extension: `integrationsFields` (the *More* tab). Access, hooks, labels and tabs: override with - `ipalKit({ globalOverrides: { 'site-integrations': … } })` (an object merges `access` / `admin` / `hooks`, + `iapl({ globalOverrides: { 'site-integrations': … } })` (an object merges `access` / `admin` / `hooks`, a function gets the whole global — hooks.md). diff --git a/docs/lightbox.md b/docs/lightbox.md index d937ec6..f92c1e8 100644 --- a/docs/lightbox.md +++ b/docs/lightbox.md @@ -50,7 +50,7 @@ The provider renders nothing until an image is opened. ```ts // payload.config.ts -ipalKit({ …, lightbox: true }) +iapl({ …, lightbox: true }) ``` Adds the **Image viewer** group (`lightbox`) to **Forms → Form messages** (`notifications`): trigger name ("Enlarge image"), dialog @@ -171,7 +171,7 @@ drops every inline style; style with `classNames` (`dialog`, `figure`, `image`, | Feature | Default | Turn off / override | |---|---|---| | Whole feature | off — nothing renders without a trigger | don't use the components | -| Form messages → Image viewer labels | off | `ipalKit({ lightbox: true })`; `lightboxNotificationFields` for your own global; `globalOverrides.notifications` | +| Form messages → Image viewer labels | off | `iapl({ lightbox: true })`; `lightboxNotificationFields` for your own global; `globalOverrides.notifications` | | Texts | panel → `lightboxFallback(locale)` (`LIGHTBOX_FALLBACK_PL` on `pl`, else `LIGHTBOX_FALLBACK`) | `texts` on the provider / trigger / dialog; `resolveLightboxTexts` | | Provider in `SiteProviders` | off | `lightbox` prop; or your own `<LightboxProvider>` in a client component | | Large image markup | `<img srcSet>` | `renderImage={({ image, imgProps, index }) => <Image … />}` (provider, client only) | @@ -191,7 +191,7 @@ Projects built before this feature open images in different ways: a `glightbox` `div role="dialog"` with `next/image fill`, a link to the raw file in a new tab, or nothing. Move them to the shared lightbox: -1. **Config:** `ipalKit({ lightbox: true })`, then `pnpm payload migrate:create` (Postgres) and commit +1. **Config:** `iapl({ lightbox: true })`, then `pnpm payload migrate:create` (Postgres) and commit the migration. Fill **Forms → Form messages → Image viewer** in every language — copy the labels from the old block fields (e.g. `closeLabel`, `prevLabel`, `nextLabel`) or seed them. 2. **Layout:** `<SiteProviders lightbox={{ texts: (await getNotificationTexts({ payload, locale })).lightbox }}>`. @@ -205,7 +205,7 @@ to the shared lightbox: 5. **"Open in a new tab" links** (certificates, diplomas): swap `<a href={image.url} target="_blank">` for a `LightboxTrigger` — the visitor stays on the page. 6. **Block label fields** for close / previous / next that only served the old modal: stop reading - them; remove them in a later release with a migration (skill **ipal-migrate-fields**) once the + them; remove them in a later release with a migration (skill **iapl-migrate-fields**) once the panel texts are filled. 7. **Check:** keyboard only — Tab to a thumbnail, Enter opens, focus is on Close, ← / → browse, Tab stays in the dialog, Esc closes and focus is back on the thumbnail; the page does not scroll behind diff --git a/docs/links.md b/docs/links.md index f5e3d73..ee5dfe8 100644 --- a/docs/links.md +++ b/docs/links.md @@ -69,7 +69,7 @@ take the archives from Site settings themselves (`archives: { categories: 'kateg (the link does not render). The entry path is built by `buildEntryPath`, which **always** adds `/{locale}` — on a single-language site a link to an entry gets a needless `/pl/…` prefix (`src/modules/links/resolveLinkHref.ts` ~94). Changing `relationTo` to an array changes the data shape (`page` → `{ relationTo, value }`): -existing links must be migrated (ipal-migrate-fields). +existing links must be migrated (iapl-migrate-fields). ## href @@ -124,13 +124,13 @@ export async function CMSLink({ link, locale, className, children }: { link: Cms ``` **Do not write your own version** (`resolveHref`, `getHref`, `` `/${slug}` ``, `slug === 'home'`): it loses the language -prefix, the home page from Site settings, the `javascript:` filter and dead links. `ipal-audit` reports it as an +prefix, the home page from Site settings, the `javascript:` filter and dead links. `iapl-audit` reports it as an ERROR. A field in a different shape (e.g. `page` + `url`) is mapped onto the plugin's shape instead of computing the href: `resolveLink(url?.trim() ? { type: 'external', url } : { type: 'internal', page }, locale)`. Highlight, color, item variant = **a style from the admin panel** (`appearances`), mapped to classes in the project (`l.appearance === 'highlight'` → class). Never logic based on content (`label === 'Tesla'`) — the editor renames -it and the style disappears; `ipal-audit` reports it as an ERROR. +it and the style disappears; `iapl-audit` reports it as an ERROR. ## Legal links — `getSystemLinks` @@ -156,7 +156,7 @@ const items = await resolveNav(header.navItems, locale) // from lib/c Any depth, configurable item shape (`linkField`, `childrenField`), items with a dead link or no label are skipped (instead of `href="#"`). The result is plain data — it goes straight to the client `MobileNav`. Menu markup (Header, Footer, MobileNav) stays in the project: -[nav-code.md](./agent/skills/ipal-nav/resources/nav-code.md). +[nav-code.md](./agent/skills/iapl-nav/resources/nav-code.md). `homeSlugFrom(settings)` — the home page slug from `SiteSettings.homepage` (lib/content: `getHomeSlug(locale)`, and the full link option set: `getLinkOptions(locale)` — also for `RenderForm linkOptions`). @@ -176,7 +176,7 @@ migration is needed**: ## Turn off, override, extend -- The module has no option in `ipalKit()` — you use the fields and resolvers in your collections or you don't. +- The module has no option in `iapl()` — you use the fields and resolvers in your collections or you don't. - Fields: `name`, `relationTo` (a string or an array), `uploadTo`, `appearances` (your own names or `false`), `disableLabel`, `required`, `interfaceName`; `buildLinksField` also `maxRows`, `labels`. - Link types (`internal` / `external` / `file`) and the allowed URL schemes are currently fixed; map a field of a different shape onto `LinkValue` before `resolveLink`. - Building blocks for your own rendering: `resolveLinkHref`, `resolveLink`, `resolveNav` (`linkField`, `childrenField`), `resolveSystemLinks` (`roles`), `homeSlugFrom`, `safeHref`. diff --git a/docs/mcp.md b/docs/mcp.md index 4ec1459..4b8bc09 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -79,7 +79,7 @@ runs `initialize` → `tools/list` → and can then call `get_site_info`, | `content` | — | archive collections (`list_pages`, `get_page` for entries) | | `summaryField` | — | field with a richer AI description (`buildSummaryField`), preferred in results | | `isPathVisible` | — (from `createContentHelpers`: set) | `(path, locale) => boolean` — hides pages hidden by under-construction mode | -| `serverName` | `'ipal-site'` | name in `initialize` (and fallback site name) | +| `serverName` | `'iapl-site'` | name in `initialize` (and fallback site name) | | `serverVersion` | `'1.0.0'` | version in `initialize` | | `rateLimit` | `{ max: 60, windowMs: 60_000 }` | per-IP limit; `false` = off | | `clientIp` | — | `{ header?, trustedProxies? }` — where to read the IP from (see [forms.md](./forms.md#client-ip-and-rate-limit)) | @@ -99,7 +99,7 @@ Through `createContentHelpers({ mcp })` you pass only `serverName`, `serverVersi messages as it contains) → `429` with `Retry-After`. Batch > `maxBatch` → `400`. The limit is in memory, per instance (or in a shared store with `setRateLimitStore`) — behind Cloudflare add a Rate limiting rule in the WAF. A request without a recognized IP **passes** without - a limit; set `IPAL_IP_HEADER` (see [forms.md](./forms.md#client-ip-and-rate-limit)). + a limit; set `IAPL_IP_HEADER` (see [forms.md](./forms.md#client-ip-and-rate-limit)). - An error inside a tool → generic message `Tool execution failed.` (`isError`), details only in the server log. - Behind Cloudflare Access the route needs a Bypass (MCP clients will not send a Service Token) diff --git a/docs/notifications.md b/docs/notifications.md index 4d55327..ea618dd 100644 --- a/docs/notifications.md +++ b/docs/notifications.md @@ -22,7 +22,7 @@ the texts in the panel (Form messages), grouped per context. Group `form`: all exported from `@intecion/ipal-kit`). In `validation`, `{field}` is the field's label in the page language. For forms: `getFormTexts(locale)` from `lib/content` = the `form` group in the given language. -Group `lightbox` (only with `ipalKit({ lightbox: true })` — adds columns, run a migration on Postgres): +Group `lightbox` (only with `iapl({ lightbox: true })` — adds columns, run a migration on Postgres): `open` ("Enlarge image"), `dialog` ("Image viewer"), `previous`, `next`, `close`, `counter` ("{current} / {total}"). `getNotificationTexts(...).lightbox` always returns the full set (fallback `LIGHTBOX_FALLBACK`), and `getSiteShell(locale).lightboxTexts` carries it to `<SiteProviders lightbox>`. @@ -103,16 +103,16 @@ users), so the frontend reads them without a session. Write: `editor+` (`adminOr ## Turn off, override, extend -- **Turn off:** none — the `notifications` global is currently always added (also without the `forms` option). The `lightbox` group is opt-in (`ipalKit({ lightbox: true })`); `lightboxNotificationFields` puts it in your own global instead. +- **Turn off:** none — the `notifications` global is currently always added (also without the `forms` option). The `lightbox` group is opt-in (`iapl({ lightbox: true })`); `lightboxNotificationFields` puts it in your own global instead. - **Override texts:** in the panel, per language; empty field → `notificationFallback(locale)` (Polish on `pl` pages, English otherwise). The fallbacks cannot be swapped with a plugin option — apply your own default texts in the project on the result of `getNotificationTexts` (e.g. `texts.form.error ||= '…'`). -- **Override access / hooks / admin:** `ipalKit({ globalOverrides: { notifications: … } })` — an object merges +- **Override access / hooks / admin:** `iapl({ globalOverrides: { notifications: … } })` — an object merges `access`, `admin` and `hooks` key by key over the plugin's (e.g. let any logged-in user edit: `{ notifications: { access: { update: authenticated } } }`), a function gets the global and returns the one to use. - **Override mapping:** `resolveFormMessage` is optional — you can map `result.reason` with your own switch. -- **Extend:** the global's fields are fixed in the plugin (no `ipalKit` option to add groups / fields); +- **Extend:** the global's fields are fixed in the plugin (no `iapl` option to add groups / fields); for a project-only extra, a `globalOverrides.notifications` function can append fields, but `getNotificationTexts` will not read them — a new shared context needs a change in the plugin (`globals/Notifications/fields.ts`, types, fallback). diff --git a/docs/pages.md b/docs/pages.md index 68a8bb0..ab10936 100644 --- a/docs/pages.md +++ b/docs/pages.md @@ -7,7 +7,7 @@ The front end resolves a role to a locale-aware path. ## Config (payload.config.ts) ```ts -ipalKit({ +iapl({ pages: { slug: 'pages', // the slug of your Pages collection // roles: ['homepage', 'privacyPolicy', 'cookiePolicy'], // default: all diff --git a/docs/payload-helpers.md b/docs/payload-helpers.md index 1ea4ee2..01605d4 100644 --- a/docs/payload-helpers.md +++ b/docs/payload-helpers.md @@ -10,7 +10,7 @@ The `site-settings` (`SITE_SETTINGS_SLUG`), `site-integrations` (`SITE_INTEGRATI `cookie-settings` and `notifications` globals are **currently always added** by the plugin (also with `enabled: false`, which keeps the schema) — there is no option to skip them or change their slug. -| `ipalKit()` option | What it does | +| `iapl()` option | What it does | |---|---| | `siteSettingsFields?: Field[]` | extra SiteSettings fields in a separate **"More"** tab (flat data: `settings.myField`) | | `integrationsFields?: Field[]` | extra SiteIntegrations fields in the "More" tab | @@ -26,7 +26,7 @@ SiteSettings tabs (unnamed — flat data): **General** (`siteName`, `siteDescrip Keep nothing confidential there (use SiteIntegrations for that, `read`/`update` admin only). SiteSettings `update` requires the **editor** role or higher (a plain `user` account must not change the brand, the homepage or the under-construction mode; without a `roles` field every logged-in account passes). Change it with -`ipalKit({ globalOverrides: { 'site-settings': { access: { update } } } })` (hooks.md). +`iapl({ globalOverrides: { 'site-settings': { access: { update } } } })` (hooks.md). ## Front end — reading globals @@ -81,5 +81,5 @@ const data = await getGlobal<MyType>(payload, 'my-global', { locale: 'pl', depth - The plugin's globals are currently always added (no option to turn them off / change slugs); `enabled: false` keeps them (schema unchanged) and only drops the plugin's endpoints, `onInit` work and admin components. - Extension: `siteSettingsFields` / `integrationsFields` (the "More" tab). -- Change a global's access, hooks, labels or fields with `ipalKit({ globalOverrides: { 'site-settings': … } })` — an object merges `access` / `admin` / `hooks` key by key, a function gets the whole global (hooks.md "Turn off, override, extend"). +- Change a global's access, hooks, labels or fields with `iapl({ globalOverrides: { 'site-settings': … } })` — an object merges `access` / `admin` / `hooks` key by key, a function gets the whole global (hooks.md "Turn off, override, extend"). - `getGlobal(payload, slug, { locale, depth })` works with any project global. diff --git a/docs/project-starter.md b/docs/project-starter.md index ec4661a..6479fe9 100644 --- a/docs/project-starter.md +++ b/docs/project-starter.md @@ -1,4 +1,4 @@ -# project starter — `ipal-kit create` +# project starter — `iapl create` One command creates a new Payload 3 + Next 16 client site that already follows every team convention, so every project starts identical. The site is generated from the **reference site** (`reference/` in the plugin @@ -15,12 +15,12 @@ pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@1.15.0 create inte - `--config.auto-install-peers=false` keeps `dlx` to the plugin itself: 7 packages, ~44 MB, ~1 s with a warm store. Without it pnpm also installs the plugin's peers (Payload, Next, React — 356 packages, ~750 MB in the dlx cache) that the generator never loads. -- An agent that already has the plugin installed: `pnpm exec ipal-kit create <domain> --dir ../<name>-web`. The +- An agent that already has the plugin installed: `pnpm exec iapl create <domain> --dir ../<name>-web`. The command refuses to write into the current project. ## What it asks — and where the answers go -The architecture questions of AGENT.md "Ask before you build" (the same list as `ipal-setup` stage 0), all before +The architecture questions of AGENT.md "Ask before you build" (the same list as `iapl-setup` stage 0), all before a single file is written. Enter takes the recommendation shown in brackets — an explicit choice, recorded as the owner's answer. There is no `--yes`: a missing answer stops the run with the list of open topics. @@ -30,32 +30,37 @@ owner's answer. There is no `--yes`: a missing answer stops the run with the lis | Languages | locales besides `pl` (default) and `en` | `src/i18n.config.ts` (every language with a URL prefix) | | Styling | primary (+ secondary, accent), body and heading font, theme light / dark / both + default, radius sharp / soft / round, fluid standard / wide | `src/design/tokens.ts`, `DESIGN.md`, the next/font calls in the root layout, Site settings → Theme (seed) | | Pages and content | the site map; collections `posts` / `caseStudies` | `AGENTS.md` → Site map; the collection files, `content.config.ts`, the entry list block, the blog archive page | -| Forms | forms, the inbox that receives them, SMTP or Microsoft Graph | Company → E-mail (seed), the seeded forms, `ipalEnvRules({ emailGraph })` + `GRAPH_*` | -| Analytics and consent | tools, Consent Mode, the settings window, cookie scanner, browser crawl | CSP flags in `next.config.ts`, `SiteProviders analytics` / `banner`, `cookieScanner`, `IPAL_COOKIE_SCAN_*` | +| Forms | forms, the inbox that receives them, SMTP or Microsoft Graph | Company → E-mail (seed), the seeded forms, `iaplEnvRules({ emailGraph })` + `GRAPH_*` | +| Analytics and consent | tools, Consent Mode, the settings window, cookie scanner, browser crawl | CSP flags in `next.config.ts`, `SiteProviders analytics` / `banner`, `cookieScanner`, `IAPL_COOKIE_SCAN_*` | | SEO / GEO | local business (schema.org type), AI crawlers | `siteJsonLd` with `buildLocalBusinessJsonLd`, `robots.aiBots` | -| Media | R2 or local disk | `ipalEnvRules({ storage })`, `docs/DEPLOY.md` (Persistent Storage without R2) | +| Media | R2 or local disk | `iaplEnvRules({ storage })`, `docs/DEPLOY.md` (Persistent Storage without R2) | | Admin | 2FA, white-label, agency credit, panel link preview | `twoFactor`, `whiteLabel`, `agency`, `adminMeta` | | Hosting | canonical host apex / www, Coolify server, who adds DNS | `NEXT_PUBLIC_SERVER_URL`, `docs/DEPLOY.md` | -| Agent tooling | external skills | `ipal-skills --external` | +| Agent tooling | external skills | `iapl-skills --external` | + +A site made by the starter gets the new spelling of the two stored names: `iapl({ storageNames: 'iapl' })` in +`payload.config.ts` (2FA counter key `iapl:2fa-verify:…`; visitor cookie `iapl_vid`, with +`visitorCookie={IAPL_VISITOR_COOKIE}` on `<PageStats>` when statistics are turned on — stats.md). Sites made before +1.17.0 keep the old ones. Every answer is written into `AGENTS.md` → **Project decisions** (one line per topic) and the full set into -`.ipal/starter.json`. A module the owner turns off needs the owner's reason, which goes into -`ipal-audit-skip:` and `ipal-doctor.json` (`"rules": { "2fa": { "off": true, "reason": "…" } }`). +`.iapl/starter.json`. A module the owner turns off needs the owner's reason, which goes into +`iapl-audit-skip:` and `iapl-doctor.json` (`"rules": { "2fa": { "off": true, "reason": "…" } }`). **Not supported yet — the command stops before writing anything** and points to the manual path (the -`ipal-setup` skill, stages 1–11), which covers them: +`iapl-setup` skill, stages 1–11), which covers them: - **single-language sites** (owner's decision: later); - **a default language other than `pl`**, and sites without `en` — the base seed is Polish + English with Polish default-locale slugs; - URLs without a language prefix; Postgres (MongoDB only). -Check: `ipal-kit create acme.pl --answers single.json` with one locale exits 1 with "a single-language site is not -supported by `ipal-kit create` yet — set the site up by hand with the ipal-setup skill", and the folder is not created. +Check: `iapl create acme.pl --answers single.json` with one locale exits 1 with "a single-language site is not +supported by `iapl create` yet — set the site up by hand with the iapl-setup skill", and the folder is not created. For agents and CI, the same answers as JSON (shape: `StarterAnswers`, `@intecion/ipal-kit/starter`): ```bash -pnpm exec ipal-kit create intecion.com --dir ../intecioncom-web --answers answers.json +pnpm exec iapl create intecion.com --dir ../intecioncom-web --answers answers.json ``` ```json @@ -92,27 +97,27 @@ pnpm exec ipal-kit create intecion.com --dir ../intecioncom-web --answers answer 1. Validates the domain, the folder and every answer — nothing is written while one is missing. 2. Renders the site from the starter bundle (below) and writes it; writes a local `.env` (`.env.example` with a fresh `PAYLOAD_SECRET`; git-ignored, never committed). -3. `pnpm install` from the shipped lockfile, `pnpm exec ipal-skills` (+ `--external`), `pnpm exec ipal-tokens` +3. `pnpm install` from the shipped lockfile, `pnpm exec iapl-skills` (+ `--external`), `pnpm exec iapl-tokens` (writes `src/design/tokens.css`, fails on a WCAG contrast error — pick another colour), `pnpm generate:types`, - `pnpm generate:importmap`, `pnpm typecheck`, and `pnpm exec ipal-doctor --strict --offline` when the installed - ipal-kit ships it. + `pnpm generate:importmap`, `pnpm typecheck`, and `pnpm exec iapl-doctor --strict --offline` when the installed + IAPL ships it. 4. `git init -b main`, a secret check of every staged file (no `.env*` except `.env.example`, no assigned `*_SECRET` / `*_TOKEN` / `*_PASSWORD` / `*_ACCESS_KEY` value, no private key) and one commit - `chore: create site with ipal-kit create <version>`. No remote, no push. + `chore: create site with iapl create <version>`. No remote, no push. 5. Prints the next steps: local MongoDB with `<domain>_dev`, `pnpm seed` (before launch), the panel steps, the deploy (`docs/DEPLOY.md`). **Check:** in the new folder `git log --oneline` = one commit, `git status` clean, `pnpm typecheck` passes, -`grep -c 'Project decisions' AGENTS.md` = 1, `cat ipal-doctor.json` shows the domain and `launched: false`. +`grep -c 'Project decisions' AGENTS.md` = 1, `cat iapl-doctor.json` shows the domain and `launched: false`. ## The generated site The reference site's tree (AGENT.md §3) with: the plugin pinned to the exact released version, the database names from `databaseNamesFor(domain)` (`intecion.com` → `intecioncom_dev` / `intecioncom_prod`; hyphens stay), -`packageManager` pinned (copied from the reference site), CSP in **report-only** (`ipal-doctor.json` silences the +`packageManager` pinned (copied from the reference site), CSP in **report-only** (`iapl-doctor.json` silences the report-only finding for 28 days with the reason, and carries the reference site's own reasoned silences — `i18n-literals` for the `/design` styleguide, `audit:collections-present` only while `posts` / `caseStudies` are in), -`assertEnv(ipalEnvRules({ databaseName, ipHeader, storage, … }))` in `instrumentation.ts`, the blocks from the +`assertEnv(iaplEnvRules({ databaseName, ipHeader, storage, … }))` in `instrumentation.ts`, the blocks from the block library (`libraryBlocks` + `createBlockRegistry(content, { Image, Link, … })`), the design-token standard (`styles.css` imports only, the brand in `src/design/tokens.ts`, next/font `--font-family-body` / `--font-family-heading`), seeds through `createSeeder` with `SEED_ONLY`, and `docs/DEPLOY.md` for the team's @@ -126,7 +131,7 @@ SEED_ONLY="pages:kontakt" pnpm seed # the real run ``` Not in a new site: the reference company's demo content and media, the Blocks showcase page, the smoke tests -(`e2e/`), `.agents/skills` (re-installed by `ipal-skills`), `README.md`. +(`e2e/`), `.agents/skills` (re-installed by `iapl-skills`), `README.md`. ## How the reference site becomes a site @@ -135,7 +140,7 @@ Not in a new site: the reference company's demo content and media, the Blocks sh | Role | Meaning | |---|---| | `drop` | left out (demo seeds and media, e2e, generated files) | -| `generate` | written by the starter from the answers (`src/i18n.config.ts`, `src/design/tokens.ts`, `DESIGN.md`, `ipal-doctor.json`) | +| `generate` | written by the starter from the answers (`src/i18n.config.ts`, `src/design/tokens.ts`, `DESIGN.md`, `iapl-doctor.json`) | | `template` | copied with `placeholders` replaced — the reference's unique fake values (`example-studio.pl`, `Example Studio`, `example-studiopl`…) → the new site's values | | `keep` | copied as is; must not contain a fake value (the bundle build fails) | | `variants` | whole files that exist only with a flag on (`src/collections/Posts.ts` → `posts`) | @@ -158,7 +163,7 @@ that is how the reference carries code it does not run itself. The flags come fr `graph`, `localBusiness`, `aiBotsBlockTraining`, `aiBotsDisallow`, `analytics`, `metaPixel`, `linkedIn`, `tiktok`, `clarity`, `consentBasic`, `bannerDetailed`, `bannerInline`, `bannerModal`, `themeToggle`, `defaultLight`, `defaultDark`, `defaultSystem`, `whiteLabel`, `adminMeta`, `agencyNone`, `agencyCustom`, `enforceCsp` (always -off in a new site) and `demo` (always off). A flag the reference uses that this ipal-kit does not set stops the +off in a new site) and `demo` (always off). A flag the reference uses that this IAPL does not set stops the run with its name. **Adding a feature to the starter** = changing the reference site: write the code there (marked with @@ -180,10 +185,10 @@ compiled code with source maps, docs — is ~340 KB unpacked (~4 % of 7.96 MB) a `_dev` database (MongoDB in its own Docker container) → `pnpm generate:types && pnpm build` → `SEED_ONLY="pages:kontakt" [SEED_DRY_RUN=1] pnpm seed` in production mode → a full seed in production refused (the guard's "full seed refused" message is required; a run where Payload never initialized is inconclusive and retried, up to 3) → -`pnpm start` with `/api/health`, `/pl`, report-only CSP, no `X-Powered-By`, `/llms.txt` → `ipal-doctor --strict --offline` +`pnpm start` with `/api/health`, `/pl`, report-only CSP, no `X-Powered-By`, `/llms.txt` → `iapl-doctor --strict --offline` (when shipped) → with the `nixpacks` CLI on PATH, the same seed inside the Nixpacks image. Each run packs to a new file name and calls `dlx` with `--config.dlx-cache-max-age=0` (pnpm's dlx cache is keyed by the spec, so a reused path -would run the previous build), then checks the new site's `.ipal/starter.json` → `source` (the bundle's sha256 and the +would run the previous build), then checks the new site's `.iapl/starter.json` → `source` (the bundle's sha256 and the plugin commit `build:starter` recorded) and the installed plugin against the packed tarball. Needs Docker; `--keep` leaves `.starter-gate/` for inspection. @@ -207,9 +212,9 @@ Types: `StarterAnswers`, `AnalyticsTool`, `ContentCollection`, `StarterBundle`, ## Turn off, override -- The command is optional: the manual path (`ipal-setup` stages 1–11) still sets up any site, including what this +- The command is optional: the manual path (`iapl-setup` stages 1–11) still sets up any site, including what this version refuses (other default language, no URL prefix, Postgres). -- Every generated file belongs to the project afterwards — change it like any other file; `ipal-upgrade` and - `ipal-doctor` keep it in line with later plugin versions. +- Every generated file belongs to the project afterwards — change it like any other file; `iapl-upgrade` and + `iapl-doctor` keep it in line with later plugin versions. - `--no-install`, `--no-git`, `--dir`, `--plugin-spec` change the run; a different reference tree → your own generator from the building blocks above. diff --git a/docs/richtext.md b/docs/richtext.md index c982035..efe42f9 100644 --- a/docs/richtext.md +++ b/docs/richtext.md @@ -137,7 +137,7 @@ project already has (it is the editor). No extra dependencies. ## Turn off, override, extend -- The module has no option in `ipalKit()` — it adds nothing to the schema; you use the components and functions or you don't. +- The module has no option in `iapl()` — it adds nothing to the schema; you use the components and functions or you don't. - Override the look of nodes through `converters` (spread `defaultConverters`); heading ids through `headingIds` (`levels`, `className`). - Image lightbox: off by default; `lightbox` turns it on, `withLightboxUploads` is the building block (lightbox.md). - Link filtering: on by default; `safeLinks={false}` turns it off for fully trusted content. diff --git a/docs/security.md b/docs/security.md index c689013..7a28635 100644 --- a/docs/security.md +++ b/docs/security.md @@ -61,7 +61,7 @@ export default withPayload(withSecurityConfig(nextConfig)) | `csp` | `false` | `buildCsp` args → the CSP header (+ `Reporting-Endpoints` with `reportUri`) | | `additional` | `[]` | extra headers; the same key overrides (also the `csp` ones) | -With `IPAL_NOINDEX=1` (staging), `X-Robots-Tag: noindex, nofollow` is added to every response. +With `IAPL_NOINDEX=1` (staging), `X-Robots-Tag: noindex, nofollow` is added to every response. **Uploads:** `buildUploadSecurityHeaders({ collections = ['media'] })` returns `headers()` rules for `/api/<collection>/file/*` (sandbox, no scripts) — an SVG from local disk cannot run a script on the site's @@ -299,7 +299,7 @@ The plugin sets the path through the `adminRoute` option: ```ts // payload.config.ts -ipalKit({ +iapl({ i18n: i18nConfig, adminRoute: '/its', // panel at /its instead of /admin }) @@ -345,7 +345,7 @@ addition to real safeguards, not a replacement for them. The plugin enforces two-factor authentication (TOTP) for ALL panel users — with no way to turn it off per user. Every project gets it automatically. It uses `@clocklimited/payload-2fa`, which wraps access control: TOTP is checked before access to DATA -(REST, GraphQL), not only in the panel UI. On top of the package ipal-kit runs its own check, so the second +(REST, GraphQL), not only in the panel UI. On top of the package IAPL runs its own check, so the second factor also covers what the package cannot see — see "What the second factor covers" below. ### Dependency @@ -362,14 +362,14 @@ ERR_PNPM_NO_MATCHING_VERSION. ```ts import { payloadTotp } from '@clocklimited/payload-2fa' -ipalKit({ +iapl({ i18n: i18nConfig, twoFactor: { issuer: 'Company Name', // shown in the authenticator app plugin: payloadTotp, // ← INJECT — see below why // collectionSlug: 'users', // default: the panel login collection (admin.user, else the first auth collection) // allowCollectionMismatch: true, // deliberate only: 2FA on a collection other than admin.user - // guard: false, // NOT recommended: ipal-kit's own check off, the package's wrapper only + // guard: false, // NOT recommended: IAPL's own check off, the package's wrapper only }, }) ``` @@ -395,15 +395,15 @@ logging in. There is no per-user "on/off" option. ### What the second factor covers The package wraps the `access` functions of the collections and globals that are in the config **at the moment -it runs**. ipalKit runs it early, so the plugin's own globals and collections (Site settings, Site integrations, +it runs**. iapl runs it early, so the plugin's own globals and collections (Site settings, Site integrations, Cookie banner, Notifications, forms, form submissions, consent records, cookie review, stats) and anything a -plugin listed after `ipalKit` adds were not wrapped. **Up to 1.16.3 a staff password without the TOTP code -therefore read and changed them over the API.** Since 1.16.4 ipal-kit closes that itself: +plugin listed after `iapl` adds were not wrapped. **Up to 1.16.3 a staff password without the TOTP code +therefore read and changed them over the API.** Since 1.16.4 IAPL closes that itself: | Where | How | |---|---| -| every collection and global in the config when ipalKit finishes | `access` wrapped with `requireSecondFactor` | -| collections and globals added by plugins listed **after** ipalKit | wrapped in ipalKit's `onInit`; the log line `[ipal] 2FA also enforced on entities added after ipalKit: …` names them | +| every collection and global in the config when iapl finishes | `access` wrapped with `requireSecondFactor` | +| collections and globals added by plugins listed **after** iapl | wrapped in iapl's `onInit`; the log line `[iapl] 2FA also enforced on entities added after iapl: …` names them | | the same after a dev hot reload, or when Payload runs with `disableOnInit` | the instance's `config` is watched, so a swapped config is guarded the moment Payload assigns it (before any request or Local API call); as a second line an auth strategy that authenticates nobody (`ipal-second-factor-guard` on the 2FA collection) does the same at the start of every request | | the plugin's endpoints (`/api/ipal/test-email`, `cookie-scan`, `cookie-approval`, `cookie-crawl`, the `access` option of `/api/ipal/doctor`) | `userMeetsRole` and `secondFactorPassed` | | the 2FA package's own endpoints (`/api/setup-totp`, `/api/verify-totp`, `/api/remove-totp`, `/api/admin/reset-user-totp`, `/api/admin/remove-user-totp`, any a later version adds) | accounts of the 2FA collection only; everything except setup and verify also needs the second factor ("The 2FA package's endpoints" below) | @@ -449,7 +449,7 @@ authenticator at any time; with it, that is possible only in the first days of t | New account (also the first admin of a fresh site) | logs in → setup screen with the notice "Set up two-step verification by <date>…" → after the code, the panel | | Not set up within the window | login still works, every request answers 403, the setup screen says the time has passed and to ask an administrator | | Administrator reopens setup / resets a lost phone | the account's page in the panel → **Two-step verification** (sidebar) → "Reopen setup" / "Reset two-step verification"; or `POST /api/ipal/two-factor/reset` with `{ "userId": "…" }`. A new window starts | -| Administrators' overview | a notice on the dashboard: accounts without two-step verification, and how many of them are blocked; `ipal-doctor --url` reports the same as an error | +| Administrators' overview | a notice on the dashboard: accounts without two-step verification, and how many of them are blocked; `iapl-doctor --url` reports the same as an error | | API key (`auth.useAPIKey`) | passes, whatever the setup state | | Seeds, scripts, the Local API with `overrideAccess` (the default) | not affected | | Bearer-token routes (`/api/ipal/doctor`, the cookie-crawl callback), MCP | not affected (no user) | @@ -457,9 +457,9 @@ authenticator at any time; with it, that is possible only in the first days of t **Accounts that existed before this mode** (an upgrade): their window starts at the **first start of the site after the upgrade**, not at their creation date, so nobody is blocked the moment a site upgrades. The server log -says how many there are: `[ipal] 2FA: N existing account(s) without two-step verification. They have 72 h from +says how many there are: `[iapl] 2FA: N existing account(s) without two-step verification. They have 72 h from now to set it up…`. From that moment they can only set TOTP up; after 72 hours they are blocked until an -administrator reopens setup. **Before upgrading a live site, run `pnpm exec ipal-doctor --url <site>`** (accounts +administrator reopens setup. **Before upgrading a live site, run `pnpm exec iapl-doctor --url <site>`** (accounts without 2FA) and have those accounts set TOTP up, or remove the ones nobody uses. That starting moment is **written once**, on each such account (`totpSetupFrom`), by the start that first finds @@ -492,8 +492,8 @@ twoFactor: { 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](./deployment.md#43-database-migrations-postgres)). **Not Coolify's Pre-deployment command:** it runs in the old container, which does not have the new migration, so the new version would start without the column. Without the column every query on the 2FA collection fails: **every login answers 500 — administrators with 2FA included — and nobody can sign in to the panel** (the public site keeps working). The - log says `[ipal] 2FA: the column for "totpSetupFrom" is missing … NOBODY CAN LOG IN …` at start; - `ipal-doctor` reports a SQL project whose migrations do not mention `totp_setup_from` (error; a warning when + log says `[iapl] 2FA: the column for "totpSetupFrom" is missing … NOBODY CAN LOG IN …` at start; + `iapl-doctor` reports a SQL project whose migrations do not mention `totp_setup_from` (error; a warning when there is no migrations folder at all — it cannot see a schema that is pushed some other way). Recovery: run the migration; no data is lost. - **`exempt` must answer `true` or `false` at once.** It runs inside access checks, which cannot wait. An @@ -502,7 +502,7 @@ twoFactor: { works on its password alone, so give it the lowest role that does its job. - **`windowHours`** must be a number (0 or more) or `false`; anything else (`'24'`, `-1`) stops the site at start. - **Import map.** The status field and the dashboard notice are admin components: `pnpm payload - generate:importmap` after upgrading (`TwoFactorStatusField`, `TwoFactorAlert`); `ipal-doctor` reports a map + generate:importmap` after upgrading (`TwoFactorStatusField`, `TwoFactorAlert`); `iapl-doctor` reports a map that lacks them. Without them the panel has no "Reopen setup" button (the endpoint still works). - **Switch a part off:** `requireSetup: { dashboardNotice: false }` (the administrators' notice), `{ statusField: false }` (the status / reset control on the account; the endpoint stays), @@ -514,7 +514,7 @@ twoFactor: { `resolveRequireSetup`, `strictExempt`, `SETUP_FROM_FIELD`, `TWO_FACTOR_RESET_PATH`, `DEFAULT_SETUP_WINDOW_HOURS`. - **Per collection or global:** the opt-out below (`custom.ipal.secondFactor`) also lets an account without TOTP in, because it takes the entity out of the second-factor check altogether. -- **Needs** ipal-kit's check (`twoFactor.guard`, on by default); with `guard: false` the mode is off. +- **Needs** IAPL's check (`twoFactor.guard`, on by default); with `guard: false` the mode is off. - **Project code** that calls `payload.find({ …, user, overrideAccess: false })` with a user fetched by id: refused for every account of the 2FA collection now — before, only for accounts that had TOTP set up. Take the user from `payload.auth({ headers })`. @@ -541,7 +541,7 @@ account, hand over the password, and have the owner set 2FA up at once.** the panel. As an administrator open the account → "Two-step verification: Set up." **Verify attempts are limited** (`twoFactor.verifyLimit`). The package checks the code and never counts tries; -a six-digit code has about three right answers in a million, so whoever held the password could guess. ipalKit +a six-digit code has about three right answers in a million, so whoever held the password could guess. iapl counts attempts per account on `POST /api/verify-totp`: by default the **sixth attempt within 10 minutes** — right or wrong — is refused with `429` and `Retry-After`, and a line goes to the log. Only a session that already passed the password reaches the endpoint, so nobody without the password can lock an account's owner out; someone @@ -550,7 +550,9 @@ memory per server instance **and in the database** (Payload's key-value store, ` collection Payload itself adds; no new collection): a restart, a redeploy or a second instance does not hand out new attempts. The higher of the two counts decides; when the database part fails, the memory count still does (there is no "allow when the store fails" path). `verifyLimit: { max: 10, windowMinutes: 5 }` changes it, -`{ store: 'memory' }` keeps the count in this instance only, `verifyLimit: false` turns it off (a limiter in +`{ store: 'memory' }` keeps the count in this instance only, `{ keyPrefix }` names the count's key in +`payload-kv` (`<keyPrefix>:2fa-verify:<collection>:<id>`; default `ipal`, and `iapl` on a site with +`iapl({ storageNames: 'iapl' })` — one prefix per site, a change starts the running counts from zero once), `verifyLimit: false` turns it off (a limiter in front of the site). **Verify and setup attempts only from the site's own origin** (`twoFactor.sameOrigin`). The limit counts every @@ -568,10 +570,10 @@ A default port written out (`X-Forwarded-Host: site.example:443`) is the same ho **Behind a reverse proxy that hides the site's address** — it rewrites `Host` and sends no `X-Forwarded-Host` (nginx's plain `proxy_pass`; Traefik and Coolify keep `Host`) — and without `serverURL`, the server cannot know its own address: the site's own verify page is refused, and **nobody can enter a code**. It is not silent: the -first refusal of every origin is logged, `[ipal] 2FA: a code from origin "https://…" was refused and not counted +first refusal of every origin is logged, `[iapl] 2FA: a code from origin "https://…" was refused and not counted — it is not one of this site's own origins (…)`, with the three ways out: set `serverURL` (the right fix, it also fills Payload's `csrf` list), or `twoFactor: { sameOrigin: { origins: ['https://…'] } }`, or make the proxy -send `X-Forwarded-Host` (`proxy_set_header Host $host;` in nginx). `reportRefusedOrigin` is the building block. `ipal-doctor` warns (`csrf-empty`) when the config sets neither `serverURL` nor +send `X-Forwarded-Host` (`proxy_set_header Host $host;` in nginx). `reportRefusedOrigin` is the building block. `iapl-doctor` warns (`csrf-empty`) when the config sets neither `serverURL` nor `csrf` — Payload then accepts the login cookie from any origin. **What is NOT covered — the complete list.** (1) Anonymous requests: the access function decides. (2) Accounts @@ -588,9 +590,9 @@ cannot read is refused. e.g. a health record the panel reads before the code is entered), operation by operation: ```ts -// the 2FA package's own key — it leaves the operation unwrapped, and so does ipal-kit +// the 2FA package's own key — it leaves the operation unwrapped, and so does IAPL { slug: 'notices', custom: { totp: { disableAccessWrapper: { read: true } } }, … } -// ipal-kit's key — the same, and it also works for entities the package never sees +// IAPL's key — the same, and it also works for entities the package never sees { slug: 'notices', custom: { ipal: { secondFactor: { read: false } } }, … } // or secondFactor: false = every operation ``` @@ -599,12 +601,12 @@ Operations: `create`, `delete`, `read`, `readVersions`, `unlock`, `update` (coll (`{ notifications: { custom: { ipal: { secondFactor: { read: false } } } } }`) — and note that the plugin's staff rules (`userMeetsRole`) ask for the second factor themselves, so also give that operation your own `access` function there. `disableAccessWrapper: true` passed to the package's factory turns all access -wrapping off, ipal-kit's included; the endpoints stay guarded. +wrapping off, IAPL's included; the endpoints stay guarded. **The 2FA package's endpoints.** The package takes `req.user` from whatever auth collection it comes and then acts on the 2FA collection by id: `/api/setup-totp` writes the TOTP secret under the **caller's** id. With numeric ids (Postgres, SQLite) an account of another auth collection could therefore set the secret of the -staff account that has the same id, and whoever knew that staff password then passed 2FA. ipalKit wraps every +staff account that has the same id, and whoever knew that staff password then passed 2FA. iapl wraps every endpoint the package registers: a logged-in account of another collection gets `403`; remove and the admin reset / remove endpoints also need the second factor, so a password alone cannot reset TOTP and enrol again. This guard is on whenever 2FA is on, also with `twoFactor.guard: false`. @@ -628,11 +630,11 @@ handler: async (req) => { access: { read: requireSecondFactor(({ req }) => isAdmin(req.user, req.payload)) } ``` -**Fails closed.** At startup ipalKit checks that the injected 2FA plugin added what the check reads (the +**Fails closed.** At startup iapl checks that the injected 2FA plugin added what the check reads (the `totpSecret` and `hasTotp` fields and the `totp` auth strategy on the 2FA collection). When it did not — a -package version with another shape — startup stops with `[ipal] twoFactor: the injected 2FA plugin did not +package version with another shape — startup stops with `[iapl] twoFactor: the injected 2FA plugin did not add …`. Tested with `@clocklimited/payload-2fa` 3.0.0-beta.1 and 3.0.0-beta.7 (the versions in between are not run in the plugin's tests). `twoFactor.guard: false` switches -ipal-kit's check off and leaves the package's wrapper alone; the plugin's own data is then open to a password +IAPL's check off and leaves the package's wrapper alone; the plugin's own data is then open to a password without the code again, so use it only to get a site started while the package is being sorted out. **Check** (replace the address and the account): @@ -649,7 +651,7 @@ done ### Import map (required) The 2FA screens and the redirect to them are admin components. After adding `twoFactor`, and after every -ipal-kit upgrade, run: +IAPL upgrade, run: ```bash pnpm generate:importmap @@ -664,7 +666,7 @@ pnpm generate:importmap The setup and verify screens and the user field read their texts through Payload's i18n (`totpPlugin:*`), in the user's admin language (*Account → Language*; without a choice, the browser's language — an English browser sees English screens on a Polish site). The package's own texts are long and informal, -so ipal-kit merges `TOTP_TEXTS` (English and Polish, per `docs/dev/admin-ux.md`) over them, e.g. +so IAPL merges `TOTP_TEXTS` (English and Polish, per `docs/dev/admin-ux.md`) over them, e.g. "Two-step verification" / "Weryfikacja dwuetapowa", "Enter the 6-digit code from the app:" / "Wpisz 6-cyfrowy kod z aplikacji:". The browser tab reads "Weryfikacja dwuetapowa — <site> | Panel" (`TOTP_VIEW_TITLE` in the site's default language: Payload's view title is a plain string). @@ -680,7 +682,7 @@ so ipal-kit merges `TOTP_TEXTS` (English and Polish, per `docs/dev/admin-ux.md`) The package's own admin provider decides on the server where to send the user, from an `x-pathname` request header. Nothing sets that header on `/admin` (the `createProxy` matcher skips `/admin`), so up to 1.14.1 a user without TOTP was sent to `/admin/setup-totp?back=null`, and the setup screen redirected -to itself forever. Since 1.14.2, ipal-kit swaps in its own provider, +to itself forever. Since 1.14.2, IAPL swaps in its own provider, `TotpRedirectProvider`: it reads the path in the browser, never redirects away from the setup or verify screen or from logout, and renders nothing while a redirect is pending, so the panel does not flash. No project change is needed apart from `generate:importmap`. @@ -703,10 +705,10 @@ link with an outside address sent the user off the site straight after a real lo fixed this in `payload-totp` 3.0.5 (GHSA-rffw-fq79-g3ch); `@clocklimited/payload-2fa` (beta.1 to beta.7) has not. The panel's CSP does not stop it: the admin needs inline script. -ipal-kit closes it without changing the package. `SafeTotpView` (`@intecion/ipal-kit/admin`) is registered in +IAPL closes it without changing the package. `SafeTotpView` (`@intecion/ipal-kit/admin`) is registered in place of the package's four views (`setup-totp`, `verify-totp`, each with and without a leading slash). It checks `back` on the server and renders the package's view with the checked value. The package's views stay in the -import map through `admin.dependencies`, so ipal-kit still never imports the package. +import map through `admin.dependencies`, so IAPL still never imports the package. The rule (`safeAdminBack`, the same as upstream's): `back` is resolved the way a browser resolves it and kept only when it stays on the site's origin, over HTTP(S), without credentials, inside the admin route @@ -734,16 +736,16 @@ guarded. The same holds when the project also lists `payloadTotp(...)` in `plugi **Your own 2FA screen.** Two ways, both keep the check: - Through the wrapped factory (the pattern from "Resetting 2FA"): set `views.VerifyTOTP.Component` (or `SetupTOTP`) - on the config the factory returns. ipal-kit puts `SafeTotpView` in front of it. A server component gets every + on the config the factory returns. IAPL puts `SafeTotpView` in front of it. A server component gets every server prop with `searchParams.back` checked. A client component (`'use client'`) gets Payload's client props, your `clientProps`, and `back` plus `searchParams` — both checked; read `back` from the props, not from `useSearchParams()`, which still holds the raw query value. -- From a plugin listed after `ipalKit`, or under another key or route: that view is yours and is not wrapped. Use - `wrapTotpViews` or `safeAdminBack` in it. `ipal-doctor` warns when the config uses the package's own view +- From a plugin listed after `iapl`, or under another key or route: that view is yours and is not wrapped. Use + `wrapTotpViews` or `safeAdminBack` in it. `iapl-doctor` warns when the config uses the package's own view (`@clocklimited/payload-2fa/rsc#TOTPVerify` / `#TOTPSetup`) as a view's `Component`; the same path as the `ipalTotpView` of `SafeTotpView`, or in `admin.dependencies`, is fine. - Wrapping views yourself, for a project that runs the 2FA package without `ipalKit`'s `twoFactor` (all from + Wrapping views yourself, for a project that runs the 2FA package without `iapl`'s `twoFactor` (all from `@intecion/ipal-kit`): ```ts const before = copyViews(config.admin?.components?.views) // copies: the factory's views are then never "the same object" @@ -760,13 +762,13 @@ guarded. The same holds when the project also lists `payloadTotp(...)` in `plugi passes and the site starts, but Payload renders nothing for a path its map lacks: the 2FA setup and verify screens have no code form (HTTP 200), so nobody can sign in to the panel. Payload's only trace is `getFromImportMap: PayloadComponent not found in importMap` in the server log. Development is not affected (Payload -regenerates the map there). ipal-kit reports it in three places: -- **Before deploy:** `pnpm exec ipal-doctor` reports `import map lacks @intecion/ipal-kit/admin#SafeTotpView` (error). -- **At every start in production:** the log has `[ipal] The admin import map may be out of date: … was not found +regenerates the map there). IAPL reports it in three places: +- **Before deploy:** `pnpm exec iapl-doctor` reports `import map lacks @intecion/ipal-kit/admin#SafeTotpView` (error). +- **At every start in production:** the log has `[iapl] The admin import map may be out of date: … was not found in <file> …`. - **On the screen:** a notice above the 2FA screen, "Two-step verification may not be available", with what a developer has to run. With a really stale map the notice is all the user sees (the form is missing); it is - shown by ipal-kit's `TotpRedirectProvider` only — with your own `twoFactor.provider`, or `provider: false`, + shown by IAPL's `TotpRedirectProvider` only — with your own `twoFactor.provider`, or `provider: false`, there is the log line alone. The start-up check is a guess, and is built so that a wrong guess costs a wrong notice and nothing else: it @@ -781,7 +783,7 @@ not found is not reported. Building in place (Coolify's Nixpacks) reads the same **Fix for a really stale map:** `pnpm payload generate:importmap`, commit `importMap.js`, rebuild, redeploy. A second error exists for the opposite case — the wrapper is in the map but the package's view is not: -`[ipal] The admin import map has no "@clocklimited/payload-2fa/rsc#TOTPVerify"` (same fix). +`[iapl] The admin import map has no "@clocklimited/payload-2fa/rsc#TOTPVerify"` (same fix). **Check:** log in with the password only, open `/admin/verify-totp?back=https%3A%2F%2Fexample.com%2F`, enter the code: you must land on `/admin`, not on @@ -813,7 +815,7 @@ show the QR code. `back=null` or a page that keeps reloading means the import ma An admin resets another user's 2FA (a lost phone) or reopens setup for a blocked account on that account's page in the panel: **Two-step verification** in the sidebar → "Reset two-step verification" / "Reopen setup". Behind it: `POST /api/ipal/two-factor/reset` `{ userId }`. The account must set TOTP up again within a new window. -The endpoint comes with ipal-kit's own check: with `twoFactor.guard: false` it does not exist (404), and neither +The endpoint comes with IAPL's own check: with `twoFactor.guard: false` it does not exist (404), and neither does the control in the panel. - **Who may reset.** By default a staff admin whose session has **entered its own TOTP code**. An admin on an API @@ -852,13 +854,13 @@ setup". Two ways out, both need a deploy or shell access — which is the point: administrators have, put the option back and deploy again. Accounts that still have not set TOTP up are blocked again from that moment (their start did not move). -Avoid it: at least two administrators with 2FA, and `ipal-doctor --url <site>` before an upgrade. +Avoid it: at least two administrators with 2FA, and `iapl-doctor --url <site>` before an upgrade. The 2FA package has its own reset, off unless you turn it on — through -`adminManageAccess` in the @clocklimited configuration. ipalKit passes it only `collection`, +`adminManageAccess` in the @clocklimited configuration. iapl passes it only `collection`, `forceSetup` and `issuer`; pass other options by wrapping the injected factory: `plugin: (opts) => payloadTotp({ ...opts, adminManageAccess: ({ req }) => isAdmin(req.user, req.payload) })`. -ipal-kit's guard on those endpoints adds the rest: the caller must be an account of the 2FA collection that has +IAPL's guard on those endpoints adds the rest: the caller must be an account of the 2FA collection that has passed the second factor itself. After a reset the account is "not set up" again — have its owner set TOTP up at once (see the note above). @@ -867,7 +869,7 @@ at once (see the note above). Chosen because it wraps ACCESS CONTROL (TOTP before data access) + forceSetup (enforced for everyone). Other 2FA plugins for Payload only gate /admin navigation — a user with a password can bypass them through REST/GraphQL/Bearer. @clocklimited protects -data access, not just the UI — for what is in the config when it runs; ipal-kit's own check covers the rest +data access, not just the UI — for what is in the config when it runs; IAPL's own check covers the rest ("What the second factor covers"). ## 1.9.1 — security review results @@ -918,7 +920,7 @@ size while reading, content signature, container and macro checks, an optional ` - Injected auth collection with roles: a `user` account reads and edits only itself; only an admin creates and deletes. Before, any logged-in account could change an admin's email/password. - 2FA without `collectionSlug` wraps the panel login collection (`admin.user`, else the first auth - collection), not the literal `'users'`. Plugin startup fails with `[ipal] twoFactor…` when the target is not + collection), not the literal `'users'`. Plugin startup fails with `[iapl] twoFactor…` when the target is not an auth collection or differs from `admin.user` — deliberate exception: `twoFactor.allowCollectionMismatch: true`. - Injected auth collection with roles: `unlock` is admin-only too. You can override all of it: `access.authAccess`, `access.firstUserAdmin: false`, `globalOverrides`, `forms.formOverrides`. @@ -959,7 +961,7 @@ SMTP when Graph is not configured, and for attachments Graph cannot take. A chan asks for nothing. Values are compared exactly (`587` and `'587'` are the same; another letter case or a space is a change), and a value never saved — or a `NULL` in a SQL row — counts as the field's default, so saving the form unchanged asks for nothing. Server code — a seed, a script with the Local API and access control off -— is not asked. `ipalKit({ secrets: { reenterOnChange: false } })` = the stored password follows the new +— is not asked. `iapl({ secrets: { reenterOnChange: false } })` = the stored password follows the new server, as before. A stolen admin session, or any way past the global's read rule, no longer yields a working mailbox password. @@ -978,7 +980,7 @@ document, the fields under `version`, where field hooks do not run: the global's - **What an existing site sees after the upgrade:** nothing to do. The stored values stay; the panel shows "a value is set"; the API returns the mask. Code of your own that read the secret over REST / GraphQL as an admin must read it on the server with the Local API instead. -- **Off:** `ipalKit({ secrets: { writeOnly: false } })` — the value is returned to whoever may read the global. +- **Off:** `iapl({ secrets: { writeOnly: false } })` — the value is returned to whoever may read the global. - **Your own secret fields:** `writeOnlySecret({ name: 'apiToken', type: 'text', admin: { components: { Field: '@intecion/ipal-kit/admin#MaskedField' } } })`, or `writeOnlySecrets(fields, ['apiToken'])` for fields inside tabs / rows / groups; the hooks `maskSecretAfterRead` / `keepSecretBeforeValidate`, `SECRET_MASK`, @@ -1000,7 +1002,7 @@ The plugin's dashboard alerts read data that only some roles may read (with acce so each decides who sees it. **Integration alerts** (Site integrations is admin-only): an admin sees what is failing and the link; an editor sees "An integration needs attention. Ask an administrator to look at it."; anyone else sees nothing. **Cookie alerts** (crawl result, cookies waiting): editors and above. A session that still owes -its second factor sees none of them. `ipalKit({ dashboardAlerts: { integrations: 'editor' | 'all', cookies: 'all' } })` +its second factor sees none of them. `iapl({ dashboardAlerts: { integrations: 'editor' | 'all', cookies: 'all' } })` loosens it. **`'all'` checks nothing** — no role and no second factor: whoever the dashboard is drawn for sees the full text, as before. The components take the same as props (`details`, `audience`). @@ -1024,7 +1026,7 @@ the full text, as before. The components take the same as props `buildSetupFields`, `stampSetupFrom`, `backfillSetupFrom`, `buildTwoFactorResetEndpoint`, `countAccountsWithoutTotp`, `resolveRequireSetup`, `strictExempt`, `SETUP_FROM_FIELD`. - **2FA check:** per entity `custom.ipal.secondFactor` / `custom.totp.disableAccessWrapper` (one operation or - all); `twoFactor.guard: false` turns ipal-kit's own second-factor check off everywhere (not recommended); + all); `twoFactor.guard: false` turns IAPL's own second-factor check off everywhere (not recommended); `requireSecondFactor` / `secondFactorPassed` are exported for your own access functions and endpoints. - **Turn off:** headers — do not call `buildSecurityHeaders`, or `null` / `false` per header (`frameOptions`, `referrerPolicy`, `permissionsPolicy`, `coop`), `hsts: false`; CSP — leave out `csp` (the default); @@ -1042,4 +1044,4 @@ the full text, as before. The components take the same as props or collector; `buildUploadSecurityHeaders({ collections })` for your own upload collections. - **Check:** `curl -sI https://domain/pl | grep -iE "strict-transport|x-frame|referrer|permissions|cross-origin|content-security|x-powered-by"` (no `x-powered-by`; `content-security-policy-report-only` while rolling out); - on staging also `x-robots-tag`; startup with a wrong `twoFactor.collectionSlug` fails with `[ipal] twoFactor…`. + on staging also `x-robots-tag`; startup with a wrong `twoFactor.collectionSlug` fails with `[iapl] twoFactor…`. diff --git a/docs/seeding.md b/docs/seeding.md index d73579e..d02ac1b 100644 --- a/docs/seeding.md +++ b/docs/seeding.md @@ -4,16 +4,16 @@ > 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). -A seed is a script that puts content into the database: pages, forms, globals. ipal-kit ships two +A seed is a script that puts content into the database: pages, forms, globals. IAPL ships two templates. Copy them into the project and fill them from the brief: | Template | Copy to | Seeds | |---|---|---| -| `docs/agent/skills/ipal-site/resources/seed-content.template.ts` | `scripts/seed-content.ts` | pages (or another collection with a slug) and globals, every language | -| `docs/agent/skills/ipal-form/resources/seed-form.template.ts` | `scripts/seed-form-<name>.ts` | one form: fields, confirmation, both e-mails, every language | +| `docs/agent/skills/iapl-site/resources/seed-content.template.ts` | `scripts/seed-content.ts` | pages (or another collection with a slug) and globals, every language | +| `docs/agent/skills/iapl-form/resources/seed-form.template.ts` | `scripts/seed-form-<name>.ts` | one form: fields, confirmation, both e-mails, every language | Both are thin scripts over the seed helper `createSeeder` from `@intecion/ipal-kit/seed` ([The seed helper](#the-seed-helper)), which implements every rule below. A seed you write yourself @@ -36,7 +36,7 @@ should use it too; if it does not, it must follow the rules by hand. 4. **After launch, named records only.** Before launch the seed may build the whole site. After launch a seed lists exactly the records it may touch (`only`, `SEED_ONLY`) — everything else is reported as `skip (not listed)` and never read for writing. A full run against a live database needs the owner's explicit - OK and `IPAL_SEED_ALLOW_FULL=1`. Record the launch date in `AGENTS.md` → "Project decisions". + OK and `IAPL_SEED_ALLOW_FULL=1`. Record the launch date in `AGENTS.md` → "Project decisions". 5. **Never seed users, passwords or secrets.** SMTP, Turnstile, API keys and tokens stay in the panel or in env vars. The first admin is created on the first-user screen. 6. **Globals: fill only empty fields.** A field that already has content is kept. @@ -97,7 +97,7 @@ A seed may update a record on production only when **both** are true: Anything an editor changed is always skipped and reported as `skip (edited)`. `SEED_UPDATE=1` is **refused** when `NODE_ENV=production` or when the database is not local. It runs only -when `IPAL_SEED_ALLOW_PROD_UPDATE=1` is also set. The refusal message tells you to back up first. +when `IAPL_SEED_ALLOW_PROD_UPDATE=1` is also set. The refusal message tells you to back up first. A database counts as local when `DATABASE_URI` is a SQLite file (`file:…`), a Unix socket, or a URL whose host is `localhost`, `127.0.0.1` or `::1`. Everything else is not local, including Docker service names @@ -116,7 +116,7 @@ hash field. The seed helper uses it automatically when the collection or global that name; the stored hash then decides instead of the timestamps. ```ts -// a collection (pages) or a global — for forms use ipalKit({ forms: { formOverrides: { fields } } }) +// a collection (pages) or a global — for forms use iapl({ forms: { formOverrides: { fields } } }) { name: 'seedHash', type: 'text', admin: { hidden: true } } ``` @@ -157,8 +157,8 @@ Pass them in `context` on every `create`, `update` and `updateGlobal` (`createSe The seed script and its dependencies must be in the image. Env vars (`DATABASE_URI`, `PAYLOAD_SECRET`, …) must be available at runtime, not only at build time. The container already has `NODE_ENV=production`, so -`SEED_UPDATE=1` is refused there unless you add `IPAL_SEED_ALLOW_PROD_UPDATE=1`, and a run without `SEED_ONLY` -is refused unless you add `IPAL_SEED_ALLOW_FULL=1` (only with the owner's explicit OK). +`SEED_UPDATE=1` is refused there unless you add `IAPL_SEED_ALLOW_PROD_UPDATE=1`, and a run without `SEED_ONLY` +is refused unless you add `IAPL_SEED_ALLOW_FULL=1` (only with the owner's explicit OK). ## Seeds or migrations? @@ -166,7 +166,7 @@ is refused unless you add `IPAL_SEED_ALLOW_FULL=1` (only with the owner's explic |---|---| | Schema: new field, new collection, changed type | Payload migration: `pnpm payload migrate:create`, runs on deploy ([deployment.md §4.3](./deployment.md)) | | Data fix that must run exactly once on every database | Payload migration | -| Field rename or move that must keep content | the **ipal-migrate-fields** skill | +| Field rename or move that must keep content | the **iapl-migrate-fields** skill | | Content: pages, forms, globals from a brief | seed | A seed never changes the schema. A migration never fills editorial content from a brief. @@ -277,8 +277,8 @@ the script: | `SEED_DRY_RUN=1` / `--dry-run` | `dryRun` | off | no writes, print the plan | | `SEED_UPDATE=1` | `update` | off | update records nobody edited since seeding | | `SEED_ONLY` | `only` | all records | the records the run may touch: `pages:kontakt`, `forms:Contact form`, `global:header`, `pages:*` (comma-separated in env) | -| `IPAL_SEED_ALLOW_FULL=1` | `guard.allowFull` | off | allow a run without `only` on production or a non-local database (a full re-seed — owner's OK only) | -| `IPAL_SEED_ALLOW_PROD_UPDATE=1` | `guard.allowProdUpdate` | off | allow `update` on production or a non-local database | +| `IAPL_SEED_ALLOW_FULL=1` | `guard.allowFull` | off | allow a run without `only` on production or a non-local database (a full re-seed — owner's OK only) | +| `IAPL_SEED_ALLOW_PROD_UPDATE=1` | `guard.allowProdUpdate` | off | allow `update` on production or a non-local database | | `SEED_FORCE=1` | `force` | off | with `update`: overwrite edited records too. Local database only (`guard.forceOnlyLocal: false` lifts that) | | `SEED_LOCAL_HOSTS` | `guard.localHosts` | — | extra hosts that count as local, comma-separated (e.g. a Docker Compose `db` service) | | `SEED_DB_URL_ENV` | `guard.databaseUrl` | `DATABASE_URI` | the env var that holds the database URL / the URL itself | diff --git a/docs/seo.md b/docs/seo.md index 977897d..e877ae1 100644 --- a/docs/seo.md +++ b/docs/seo.md @@ -18,7 +18,7 @@ components and do not render without the importMap. ## Config (payload.config.ts) ```ts -ipalKit({ +iapl({ seo: { collections: ['pages', 'posts'], // which collections get meta // generateTitle: ({ doc }) => `${doc.title}`, // optional @@ -761,7 +761,7 @@ import { NoSnippet } from '@intecion/ipal-kit/rsc' // in a client component: / - Wrap: the footer, the contact bar, a CTA section repeated on every page ("Umów się na konsultację"). **Never `<main>`** — the snippet should come from it. - The plugin's components do this themselves: `CookieBanner`, `LanguageSwitcher`. -- The effect shows after a recrawl (days–weeks). `ipal-seo-check` warns about a footer without +- The effect shows after a recrawl (days–weeks). `iapl-seo-check` warns about a footer without `data-nosnippet` and about duplicated descriptions. ## Sitelinks — brand search signals @@ -1218,7 +1218,7 @@ export const dynamic = 'force-dynamic' - Exceptions from the panel are added to `robots.aiBotRules` from code (the panel comes last, so it wins). - A user agent from the panel: one token (`[\w\-.*/]`), no spaces or newlines — an entry "Bot\nDisallow: /" is rejected and cannot inject a rule. -- Database unavailable → the options from code. `IPAL_NOINDEX=1` still wins over everything. +- Database unavailable → the options from code. `IAPL_NOINDEX=1` still wins over everything. - `robots` (sync) stays unchanged — it ignores the panel. ## Sitemap — readable in the browser, zero files in the project @@ -1265,7 +1265,7 @@ Both are equally good for Google — it is about readability for humans, not SEO ## Search engines — Search Console verification, AI bots, llms.txt note (1.13) The **Site settings → Search engines** tab (on by default; empty fields change -nothing; `ipalKit({ searchSettings: false })` removes it — also without `seo` (`seo: { searchSettings }` still works; the top-level option wins); the function +nothing; `iapl({ searchSettings: false })` removes it — also without `seo` (`seo: { searchSettings }` still works; the top-level option wins); the function `searchSettings: (fields) => fields` gets the plugin's fields and returns your own — add, remove, relabel; the helpers read the names `searchVerification` / `aiCrawlers` / `llmsIntro`): @@ -1416,22 +1416,22 @@ It complements Markdown/llms: the assistant extracts the page's key content more Metadata has an X/Twitter card, image dimensions and alt, and entries get `og:type=article` with dates. - **Sitemap with images** (`<image:image>`): by default the page's SEO image; your own source: `createContentHelpers({ sitemapImages: (doc) => [...] })`. -- **IndexNow:** `ipalKit({ indexNow: true })` + the route `src/app/indexnow-key.txt/route.ts` +- **IndexNow:** `iapl({ indexNow: true })` + the route `src/app/indexnow-key.txt/route.ts` (`createIndexNowKeyRoute`). After a page/entry is published, its addresses in all languages go to Bing & co. (ChatGPT Search and Copilot use Bing's index). Production with public https only. Key: Site integrations → IndexNow (generated on save) or `INDEXNOW_KEY`. Google does not support IndexNow — for Google, use the sitemap. Key route from `lib/content`: `export { indexNowKeyRoute as GET } from '@/lib/content'`. By hand (e.g. content imported by a script): `submitToIndexNow({ payload, urls })` (key: `getIndexNowKey(payload)`) - — never throws, only logs. With `IPAL_NOINDEX=1` (staging) it sends nothing, even with + — never throws, only logs. With `IAPL_NOINDEX=1` (staging) it sends nothing, even with `NODE_ENV=production` (1.13). - **llms.txt / llms-full.txt** cover content collection entries (`content`) and all languages; MCP `list_pages` too. Shared source: `collectSiteIndex`. ## noindex — staging, Markdown, protection (1.9.1) -- **`IPAL_NOINDEX=1`** in the staging/preview env: robots `Disallow: /`, `noindex, nofollow` in meta, - `X-Robots-Tag` in `buildSecurityHeaders`. Never on production (`ipal-seo-check` reports it). +- **`IAPL_NOINDEX=1`** in the staging/preview env: robots `Disallow: /`, `noindex, nofollow` in meta, + `X-Robots-Tag` in `buildSecurityHeaders`. Never on production (`iapl-seo-check` reports it). - Markdown versions (`/md/…`) and the llms files have `X-Robots-Tag: noindex`; Markdown also has `Link: <html-url>; rel="canonical"` — AI reads it, Google sees no duplicates. - `buildNoindexField` does not allow ticking noindex on the home page and archive pages. @@ -1439,7 +1439,7 @@ It complements Markdown/llms: the assistant extracts the page's key content more ## Turn off, override, extend -- **Turn off the module:** leave out `seo` in `ipalKit()` — no SEO tab and no auto-fill. The Site settings → +- **Turn off the module:** leave out `seo` in `iapl()` — no SEO tab and no auto-fill. The Site settings → Search engines tab stays (remove it with the top-level `searchSettings: false`). The front helpers (`buildMetadata`, `buildRobots`, the JSON-LD builders) are plain functions and work without it. - **Auto-fill:** `autoFill: false` turns it off; `autoFill: { title, description, content, descriptionLength }` remaps the source fields. Skip it for one save with `context: { [SKIP_AUTO_FILL]: true }`. @@ -1447,9 +1447,9 @@ It complements Markdown/llms: the assistant extracts the page's key content more points it at another global/field. - **Titles and descriptions:** `generateTitle` / `generateDescription` replace plugin-seo's generators; `fields` adds your own fields to the SEO group. Per page, **Exact page title** beats the composed title. -- **Search engines tab:** `ipalKit({ searchSettings: false })` removes it (with or without `seo`); `searchSettings: (fields) => fields` adds, removes or +- **Search engines tab:** `iapl({ searchSettings: false })` removes it (with or without `seo`); `searchSettings: (fields) => fields` adds, removes or relabels fields (keep `searchVerification` / `aiCrawlers` / `llmsIntro`, or read your own fields in your routes). -- **The Site settings global itself** (where the SEO fields live): `ipalKit({ globalOverrides: { 'site-settings': … } })` +- **The Site settings global itself** (where the SEO fields live): `iapl({ globalOverrides: { 'site-settings': … } })` — an object is merged over the plugin's global (`access`, `admin` and `hooks` key by key: your access rules win, your hooks run after the plugin's; other keys such as `fields` replace the plugin's); a function `(global) => global` gives full control (drop a plugin hook, append fields). The same works for @@ -1459,4 +1459,4 @@ It complements Markdown/llms: the assistant extracts the page's key content more `robots: { disallowParams, extraDisallow, adminRoute, disallow, aiBots, aiBotRules, … }`, `summaryField`, `pageJsonLd.entries`. Or skip the factory handlers and build your own routes from the low-level builders (`buildSitemapEntries`, `buildRobots`, `buildLlmsTxt`, `createSitemapRouteHandler`). -- **IndexNow:** off unless `ipalKit({ indexNow: true })`. +- **IndexNow:** off unless `iapl({ indexNow: true })`. diff --git a/docs/slug.md b/docs/slug.md index 6b7ccd4..52cc1a9 100644 --- a/docs/slug.md +++ b/docs/slug.md @@ -79,6 +79,6 @@ toSlug('Strona główna') // 'strona-glowna' ## Turn off, override, extend -- The module has no option in `ipalKit()` — you add the field yourself; turning off = a plain `text` field instead of `buildSlugField`. +- The module has no option in `iapl()` — you add the field yourself; turning off = a plain `text` field instead of `buildSlugField`. - Override: `name`, `from`, `required`, `localized`, `overrides` (e.g. `{ unique: true }`, your own `admin`, your own `hooks`). - The normalization rules (`slugify` with `lower`, `strict`, `trim`) are currently fixed — a different format needs your own hook; you can use `toSlug` as a building block. diff --git a/docs/stats.md b/docs/stats.md index 708d7e1..fe63ed4 100644 --- a/docs/stats.md +++ b/docs/stats.md @@ -28,7 +28,7 @@ This is not legal advice — for an unusual project (sensitive data, children) c ## Config ```ts -ipalKit({ +iapl({ // … stats: true, // or: @@ -51,7 +51,7 @@ Adds: - the `stats-visits` collection (group *Statistics*, read and delete: admin; `create`/`update` via API blocked — written only by the endpoint with `overrideAccess`), - `POST /api/ipal/hit`, -- the **`<adminRoute>/stats`** view (default `/admin/stats`; it uses `ipalKit({ adminRoute })`, not +- the **`<adminRoute>/stats`** view (default `/admin/stats`; it uses `iapl({ adminRoute })`, not `routes.admin` set by hand in the config) + a nav link *Statistics overview* (`StatsNavLink`, hidden for users who cannot read `stats-visits`), its browser tab reads *Statistics* / *Statystyki* in the admin language (set after load through `DocumentTitle`, because Payload's view `meta.title` is one fixed string — i18n.md), @@ -88,7 +88,22 @@ error, a rejection and when the limit of 60 requests/min per IP is exceeded — stored only when the request's consent cookie has `analytics: true` under the current *Policy version* (version read from Cookie banner, cached 1 min). Path: must start with `/`, max 300 characters; visit: max 200 page views. `locale` is stored when it matches `xx` / `xx-XX`. -`VISITOR_COOKIE` (`'ipal_vid'`) from `/client` — the cookie name, e.g. for your own cookie table. +`VISITOR_COOKIE` (`'ipal_vid'`) and `IAPL_VISITOR_COOKIE` (`'iapl_vid'`) from `/client` (also from the root, with +`visitorCookieFor(storageNames)`) — the cookie names, e.g. for your own cookie table. + +### Which cookie name a site has + +One name per site, for its whole life: + +| Site | Config | Layout | Cookie | +|---|---|---|---| +| made before 1.17.0 (and the default) | nothing | `<PageStats />` | `ipal_vid` | +| made since (`iapl create` writes this) | `iapl({ storageNames: 'iapl' })` | `<PageStats visitorCookie={IAPL_VISITOR_COOKIE} />`, or `<SiteProviders stats={{ locale, visitorCookie: IAPL_VISITOR_COOKIE }}>` | `iapl_vid` | + +`storageNames` is what the cookie scanner declares (the row it proposes for the cookie list); the prop is what the +browser sets. They must agree: `iapl-doctor` rule `storage-names`. Withdrawing consent deletes the cookie under either +name. **Do not switch on a live site**: every visitor's history starts again and the cookie list has to be approved +again. Wherever this page says `ipal_vid`, a site with `storageNames: 'iapl'` has `iapl_vid`. CSP: the endpoint is on the same domain — `connect-src 'self'` is enough. diff --git a/docs/storage.md b/docs/storage.md index 7c45283..7776bb5 100644 --- a/docs/storage.md +++ b/docs/storage.md @@ -37,7 +37,7 @@ import { s3Storage } from '@payloadcms/storage-s3' export default buildConfig({ // ... plugins: [ - ipalKit({ /* ... */ }), + iapl({ /* ... */ }), buildR2Storage(['media'], { s3Storage }), // collection slugs + the INJECTED adapter ], }) @@ -69,7 +69,7 @@ always registered — without R2 as disabled (`enabled: false`, local disk). sto adds its `S3ClientUploadHandler` to the import map then, so `pnpm dev` / `generate:importmap` without `R2_*` writes the same `importMap.js` as production. Up to 1.12.1, dev without R2 removed that entry, and the production admin panel (with R2) rendered a **blank page** with no console error. -`ipal-audit` reports an import map without the handler. +`iapl-audit` reports an import map without the handler. This is the "degrade gracefully" pattern — like mailAdapter, which falls back to SMTP when there is no Graph. The project works whether or not R2 is configured. @@ -102,7 +102,7 @@ Requirements and consequences: - **Public read on the upload collection** — the file route checks the collection's `read` access, and Payload's default is "logged-in users only" → anonymous visitors (and next/image) get 403. Add `access: { read: () => true }` to `Media` (and every other public upload collection). -- **Env validation** — nothing to change: `ipalEnvRules({ storage: true })` treats `R2_PUBLIC_URL` as optional +- **Env validation** — nothing to change: `iaplEnvRules({ storage: true })` treats `R2_PUBLIC_URL` as optional (`storage: { requirePublicUrl: true }` makes it required, for projects that always use a media domain). - next/image treats the URLs as local images; CSP `img-src 'self'` already covers them; `MediaPreconnect` renders nothing (same origin); the plugin's sitemap / JSON-LD helpers make relative image URLs absolute. diff --git a/docs/theme.md b/docs/theme.md index ec81777..ff7ee98 100644 --- a/docs/theme.md +++ b/docs/theme.md @@ -21,7 +21,7 @@ widget theme that matches the page. | | | |---|---| | Default key | `theme`, values `light` / `dark` — the key and values next-themes uses (`THEME_STORAGE_KEY`) | -| Own key | `ipalKit({ theme: { storageKey: 'acme-theme' } })` → `getSiteShell(locale).theme.storageKey` → `<ThemeScript>` uses it and puts it on `<html data-theme-storage>`, so `useTheme` / `<ThemeSwitcher>` use the same key with no extra prop (`<ThemeSwitcher storageKey>` / `useTheme({ storageKey })` to set it by hand) | +| Own key | `iapl({ theme: { storageKey: 'acme-theme' } })` → `getSiteShell(locale).theme.storageKey` → `<ThemeScript>` uses it and puts it on `<html data-theme-storage>`, so `useTheme` / `<ThemeSwitcher>` use the same key with no extra prop (`<ThemeSwitcher storageKey>` / `useTheme({ storageKey })` to set it by hand) | | Old key | before this change the key was `ipal-theme` (`LEGACY_THEME_STORAGE_KEY`). When the current key is empty and `ipal-theme` holds `light` / `dark`, `<ThemeScript>` moves it **before the first paint** (no flash) and removes `ipal-theme`; `useTheme` / `<ThemeSwitcher>` do the same on pages without the script (`migrateThemeStorage(key)`). A choice already under the current key wins; the old key is removed anyway | | next-themes | a project that also runs next-themes shares the key `theme` with it — one choice for both. To keep them apart, give the plugin its own key (`theme.storageKey`) | | CSP | the inline script runs with the CSP nonce (`<ThemeScript nonce>`, `SiteProviders` passes it); no script hash to update | @@ -84,7 +84,7 @@ Custom switcher: `useTheme({ storageKey? })` → `{ theme, setTheme, toggle }` ( `migrateThemeStorage(key)`, the constants `THEME_ATTRIBUTE`, `THEME_STORAGE_KEY`, `LEGACY_THEME_STORAGE_KEY`, `THEME_STORAGE_ATTRIBUTE`, `THEME_SWITCHING_ATTRIBUTE`, `isTheme` from `/client`. From the root entry also `isThemeSetting` and `themeScript({ allowToggle, defaultTheme, storageKey })` (the script text only), and the -type `ThemeOptions` (`ipalKit({ theme })`). +type `ThemeOptions` (`iapl({ theme })`). ## CSS (Tailwind 4) @@ -118,5 +118,5 @@ redraws the widget (the token must be obtained again). A fixed theme: `turnstile `ThemeSwitcher` — `classNames`, `label`, `renderIcon`; `applyTheme(..., { persist, transitionMs })`. - **Extend:** your own switcher on `useTheme()`; `themeScript()` as script text for your own tag; `themeConfigFrom(settings)` to read the settings. - Your own fields in Site settings (e.g. extra tokens) — `ipalKit({ siteSettingsFields })`, they go to the + Your own fields in Site settings (e.g. extra tokens) — `iapl({ siteSettingsFields })`, they go to the *More* tab. diff --git a/docs/turnstile.md b/docs/turnstile.md index 9d71ebe..c7a65fd 100644 --- a/docs/turnstile.md +++ b/docs/turnstile.md @@ -13,8 +13,8 @@ set", never the value ([security.md](./security.md) "Stored secrets"). Env fallb > **Deprecated: `TURNSTILE_SECRET_KEY` from the environment.** It still works when the panel field is empty, > and will be removed in a later release that the changelog names in advance. A site that relies on it logs -> `[ipal] Deprecated: the Turnstile secret key comes from the TURNSTILE_SECRET_KEY environment variable…` once -> per start, and `ipal-doctor --url` reports it (`turnstile-env-key`). **Move it:** copy the key into Site +> `[iapl] Deprecated: the Turnstile secret key comes from the TURNSTILE_SECRET_KEY environment variable…` once +> per start, and `iapl-doctor --url` reports it (`turnstile-env-key`). **Move it:** copy the key into Site > integrations → Spam protection → Secret key, send a test form, then remove the variable from the environment > (Coolify). Local development with Cloudflare's test keys in `.env` keeps working until the removal. @@ -69,19 +69,19 @@ if (!ok) { `verifyTurnstile` reads the secret from SiteIntegrations (Local API), and when the field is empty — from the **`TURNSTILE_SECRET_KEY`** variable (deprecated, see Config; the same one -`ipalEnvRules({ turnstile: true })` names). It returns `true` for `pass`, `false` for `reject`, +`iaplEnvRules({ turnstile: true })` names). It returns `true` for `pass`, `false` for `reject`, and for `degraded` (a problem on our side, see below) — depending on `onConfigError`: **by default `'allow'` → `true`**, `'reject'` → `false`. No token → `false`. Every result other than `pass` is **logged** in the server logs: | Log | Cause | Result | |---|---|---| -| `[ipal] Turnstile degraded (missing-secret): …` | no secret in the panel or in env (on every verification) | `degraded` | -| `[ipal] Turnstile degraded (invalid-input-secret): …` | wrong secret, or a site key / secret pair from different widgets | `degraded` | -| `[ipal] Turnstile: siteverify request failed: …` + `degraded (network-error)` | the container cannot reach `challenges.cloudflare.com` (8 s timeout) | `degraded` | -| `[ipal] Turnstile degraded (internal-error \| bad-response)` | Cloudflare returned 5xx / an internal error / an unexpected response | `degraded` | -| `[ipal] Turnstile rejected: timeout-or-duplicate` | token used twice or older than 300 s | `reject` | -| `[ipal] Turnstile rejected: invalid-input-response` | broken / empty token from the frontend | `reject` | +| `[iapl] Turnstile degraded (missing-secret): …` | no secret in the panel or in env (on every verification) | `degraded` | +| `[iapl] Turnstile degraded (invalid-input-secret): …` | wrong secret, or a site key / secret pair from different widgets | `degraded` | +| `[iapl] Turnstile: siteverify request failed: …` + `degraded (network-error)` | the container cannot reach `challenges.cloudflare.com` (8 s timeout) | `degraded` | +| `[iapl] Turnstile degraded (internal-error \| bad-response)` | Cloudflare returned 5xx / an internal error / an unexpected response | `degraded` | +| `[iapl] Turnstile rejected: timeout-or-duplicate` | token used twice or older than 300 s | `reject` | +| `[iapl] Turnstile rejected: invalid-input-response` | broken / empty token from the frontend | `reject` | `verifyTurnstile` / `checkTurnstile` options: `token`, `payload` (required), `ip?`, `sendRemoteIp?` (`false`), `hostnames?`, and for `verifyTurnstile` only — `onConfigError?` (`'allow'`). @@ -99,7 +99,7 @@ and for `degraded` (a problem on our side, see below) — depending on **`forms.turnstileOnConfigError`** sets what `degraded` means, once for the project: ```ts -ipalKit({ forms: { +iapl({ forms: { // turnstileOnConfigError: 'reject', // every form fails closed // turnstileOnConfigError: 'allow', // every form keeps working, forms with files too // turnstileOnConfigError: { text: 'allow', files: 'allow' }, // per kind @@ -111,11 +111,11 @@ with a file puts an attachment into a mailbox. A value at a call site (`turnstil `createSubmitAction` / `submitForm`, `attachments.submit.turnstileOnConfigError`) still wins. Not involved while Turnstile is off (no keys). **What an existing site sees:** nothing while Turnstile works; while it is degraded, forms with a File field answer "verification failed" instead of sending — fix the keys (the dashboard alert and -`ipal-doctor --url`, rule `turnstile-degraded`, say so), or set `{ files: 'allow' }`. +`iapl-doctor --url`, rule `turnstile-degraded`, say so), or set `{ files: 'allow' }`. > Note: where the policy is `'allow'`, a wrong secret in the panel (`invalid-input-secret`) > means forms accept submissions **without effective verification** — -> visible as an alert in the panel, in the log, and in `ipal-doctor --url` (`turnstile-degraded`: a warning, +> visible as an alert in the panel, in the log, and in `iapl-doctor --url` (`turnstile-degraded`: a warning, > an error after a day). `submitForm` checks Turnstile only > when both keys are set (`getTurnstileConfig().enabled`); then a missing token > always → `reason: 'turnstile'`. @@ -260,7 +260,7 @@ full control or have an unusual case. The provider is a convenience layer over i env `TURNSTILE_SECRET_KEY` (**deprecated**, see Config). `turnstileSecretFromEnv(integrations)` and `TURNSTILE_SECRET_ENV` are exported. - **Access to the keys:** Site integrations is admin-only (read and update); change it with - `ipalKit({ globalOverrides: { 'site-integrations': { access: … } } })` — keep `read` restricted, the secret lives there. + `iapl({ globalOverrides: { 'site-integrations': { access: … } } })` — keep `read` restricted, the secret lives there. - **Look:** `theme` on `<Turnstile>` / `<TurnstileWidget theme>`, `turnstileTheme` in `RenderForm` / `BuilderForm`. - **Your own integration:** `checkTurnstile` (full `pass` / `reject` / `degraded` classification), `verifyTurnstile`, `getTurnstileConfig`, `<Turnstile>`, `useTurnstile` / `useOptionalTurnstile`. diff --git a/docs/white-label.md b/docs/white-label.md index 90a83f4..a731ddc 100644 --- a/docs/white-label.md +++ b/docs/white-label.md @@ -10,7 +10,7 @@ Related: [security.md](./security.md) (adminRoute), [accessibility.md](./accessi ```ts // payload.config.ts -ipalKit({ +iapl({ i18n: { /* … */ }, whiteLabel: true, }) @@ -69,8 +69,8 @@ the same one the panel's link preview uses (below). On by default with `whiteLabel`. Control: ```ts -ipalKit({ agency: { name: 'Studio X', url: 'https://studio.example' } }) // another agency, everywhere -ipalKit({ agency: false }) // no agency anywhere +iapl({ agency: { name: 'Studio X', url: 'https://studio.example' } }) // another agency, everywhere +iapl({ agency: false }) // no agency anywhere whiteLabel: { credit: false } // hide the line (both places) whiteLabel: { credit: { text: 'Powered by Intecion', url: 'https://intecion.com' } } // own text/url ``` @@ -102,7 +102,7 @@ image. The plugin now fills the panel's `<head>` from Site settings, **with or w name the site shows anyway. Fields: `whiteLabel.settingsSlug` / `nameField` / `logoField` / `iconField`. - **No import map step** — no new admin components (endpoints only). - **Search engines:** besides the `noindex, nofollow` meta, `getRobots()` already disallows `/admin` - (and `/api`) in robots.txt; `IPAL_NOINDEX=1` adds `X-Robots-Tag` to every response on staging. + (and `/api`) in robots.txt; `IAPL_NOINDEX=1` adds `X-Robots-Tag` to every response on staging. - **Building blocks:** `buildAdminMeta`, `adminMetaForSite`, `syncAdminMeta`, `buildAdminImageEndpoints`, `DEFAULT_AGENCY`, `ADMIN_META_TEXTS`; types `AdminMetaOptions`, `AgencyOption`, `ResolvedAdminMeta`. - **Verify:** `curl -s $URL/admin/login | grep -E 'og:|robots|<title'` → `noindex, nofollow`, @@ -139,7 +139,7 @@ through `AdminIcon`. ## Checklist -- [ ] `ipalKit({ whiteLabel: true })` +- [ ] `iapl({ whiteLabel: true })` - [ ] The editor uploaded `logo` and `favicon` in SiteSettings (+ `siteName`) - [ ] `pnpm generate:importmap` - [ ] Restart dev / rebuild → the panel shows the client's brand on login and in the nav diff --git a/reference/.agents/skills/ipal-audit/SKILL.md b/reference/.agents/skills/iapl-audit/SKILL.md similarity index 74% rename from reference/.agents/skills/ipal-audit/SKILL.md rename to reference/.agents/skills/iapl-audit/SKILL.md index 044a8a5..015a7f8 100644 --- a/reference/.agents/skills/ipal-audit/SKILL.md +++ b/reference/.agents/skills/iapl-audit/SKILL.md @@ -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) diff --git a/reference/.agents/skills/ipal-audit/resources/smoke.spec.template.ts b/reference/.agents/skills/iapl-audit/resources/smoke.spec.template.ts similarity index 100% rename from reference/.agents/skills/ipal-audit/resources/smoke.spec.template.ts rename to reference/.agents/skills/iapl-audit/resources/smoke.spec.template.ts diff --git a/reference/.agents/skills/ipal-audit/scripts/audit.sh b/reference/.agents/skills/iapl-audit/scripts/audit.sh similarity index 92% rename from reference/.agents/skills/ipal-audit/scripts/audit.sh rename to reference/.agents/skills/iapl-audit/scripts/audit.sh index f134ae6..d95976a 100644 --- a/reference/.agents/skills/ipal-audit/scripts/audit.sh +++ b/reference/.agents/skills/iapl-audit/scripts/audit.sh @@ -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 ] diff --git a/reference/.agents/skills/ipal-audit/scripts/html-check.mjs b/reference/.agents/skills/iapl-audit/scripts/html-check.mjs similarity index 100% rename from reference/.agents/skills/ipal-audit/scripts/html-check.mjs rename to reference/.agents/skills/iapl-audit/scripts/html-check.mjs diff --git a/reference/.agents/skills/ipal-audit/scripts/jsx-text.mjs b/reference/.agents/skills/iapl-audit/scripts/jsx-text.mjs similarity index 100% rename from reference/.agents/skills/ipal-audit/scripts/jsx-text.mjs rename to reference/.agents/skills/iapl-audit/scripts/jsx-text.mjs diff --git a/reference/.agents/skills/ipal-audit/scripts/panel-check.mjs b/reference/.agents/skills/iapl-audit/scripts/panel-check.mjs similarity index 100% rename from reference/.agents/skills/ipal-audit/scripts/panel-check.mjs rename to reference/.agents/skills/iapl-audit/scripts/panel-check.mjs diff --git a/reference/.agents/skills/ipal-audit/scripts/polish-literals.mjs b/reference/.agents/skills/iapl-audit/scripts/polish-literals.mjs similarity index 97% rename from reference/.agents/skills/ipal-audit/scripts/polish-literals.mjs rename to reference/.agents/skills/iapl-audit/scripts/polish-literals.mjs index 3aebbdb..51a1b27 100644 --- a/reference/.agents/skills/ipal-audit/scripts/polish-literals.mjs +++ b/reference/.agents/skills/iapl-audit/scripts/polish-literals.mjs @@ -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) { diff --git a/reference/.agents/skills/ipal-block/SKILL.md b/reference/.agents/skills/iapl-block/SKILL.md similarity index 83% rename from reference/.agents/skills/ipal-block/SKILL.md rename to reference/.agents/skills/iapl-block/SKILL.md index 087eb45..8d7e5ed 100644 --- a/reference/.agents/skills/ipal-block/SKILL.md +++ b/reference/.agents/skills/iapl-block/SKILL.md @@ -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). diff --git a/reference/.agents/skills/ipal-block/resources/section-code.md b/reference/.agents/skills/iapl-block/resources/section-code.md similarity index 98% rename from reference/.agents/skills/ipal-block/resources/section-code.md rename to reference/.agents/skills/iapl-block/resources/section-code.md index c175bb8..676a760 100644 --- a/reference/.agents/skills/ipal-block/resources/section-code.md +++ b/reference/.agents/skills/iapl-block/resources/section-code.md @@ -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"; ``` diff --git a/reference/.agents/skills/ipal-collection/SKILL.md b/reference/.agents/skills/iapl-collection/SKILL.md similarity index 84% rename from reference/.agents/skills/ipal-collection/SKILL.md rename to reference/.agents/skills/iapl-collection/SKILL.md index 1c666ae..84e5400 100644 --- a/reference/.agents/skills/ipal-collection/SKILL.md +++ b/reference/.agents/skills/iapl-collection/SKILL.md @@ -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. diff --git a/reference/.agents/skills/ipal-consent-check/SKILL.md b/reference/.agents/skills/iapl-consent-check/SKILL.md similarity index 87% rename from reference/.agents/skills/ipal-consent-check/SKILL.md rename to reference/.agents/skills/iapl-consent-check/SKILL.md index d93fe65..fa75eb3 100644 --- a/reference/.agents/skills/ipal-consent-check/SKILL.md +++ b/reference/.agents/skills/iapl-consent-check/SKILL.md @@ -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 diff --git a/reference/.agents/skills/ipal-consent-check/scripts/consent-check.mjs b/reference/.agents/skills/iapl-consent-check/scripts/consent-check.mjs similarity index 94% rename from reference/.agents/skills/ipal-consent-check/scripts/consent-check.mjs rename to reference/.agents/skills/iapl-consent-check/scripts/consent-check.mjs index 286be82..c2b5364 100644 --- a/reference/.agents/skills/ipal-consent-check/scripts/consent-check.mjs +++ b/reference/.agents/skills/iapl-consent-check/scripts/consent-check.mjs @@ -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) diff --git a/reference/.agents/skills/ipal-consent-check/scripts/cookie-scan.mjs b/reference/.agents/skills/iapl-consent-check/scripts/cookie-scan.mjs similarity index 98% rename from reference/.agents/skills/ipal-consent-check/scripts/cookie-scan.mjs rename to reference/.agents/skills/iapl-consent-check/scripts/cookie-scan.mjs index bd6125b..e01ef02 100644 --- a/reference/.agents/skills/ipal-consent-check/scripts/cookie-scan.mjs +++ b/reference/.agents/skills/iapl-consent-check/scripts/cookie-scan.mjs @@ -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) diff --git a/reference/.agents/skills/ipal-consent-check/scripts/import-cookies.ts b/reference/.agents/skills/iapl-consent-check/scripts/import-cookies.ts similarity index 97% rename from reference/.agents/skills/ipal-consent-check/scripts/import-cookies.ts rename to reference/.agents/skills/iapl-consent-check/scripts/import-cookies.ts index 57a7179..65523be 100644 --- a/reference/.agents/skills/ipal-consent-check/scripts/import-cookies.ts +++ b/reference/.agents/skills/iapl-consent-check/scripts/import-cookies.ts @@ -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) * diff --git a/reference/.agents/skills/ipal-debug/SKILL.md b/reference/.agents/skills/iapl-debug/SKILL.md similarity index 82% rename from reference/.agents/skills/ipal-debug/SKILL.md rename to reference/.agents/skills/iapl-debug/SKILL.md index a205f46..3c97619 100644 --- a/reference/.agents/skills/ipal-debug/SKILL.md +++ b/reference/.agents/skills/iapl-debug/SKILL.md @@ -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`. diff --git a/reference/.agents/skills/ipal-doctor/SKILL.md b/reference/.agents/skills/iapl-doctor/SKILL.md similarity index 59% rename from reference/.agents/skills/ipal-doctor/SKILL.md rename to reference/.agents/skills/iapl-doctor/SKILL.md index 1abdaf5..d732dd6 100644 --- a/reference/.agents/skills/ipal-doctor/SKILL.md +++ b/reference/.agents/skills/iapl-doctor/SKILL.md @@ -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. diff --git a/reference/.agents/skills/ipal-form/SKILL.md b/reference/.agents/skills/iapl-form/SKILL.md similarity index 92% rename from reference/.agents/skills/ipal-form/SKILL.md rename to reference/.agents/skills/iapl-form/SKILL.md index 70828d8..27dafe3 100644 --- a/reference/.agents/skills/ipal-form/SKILL.md +++ b/reference/.agents/skills/iapl-form/SKILL.md @@ -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 | diff --git a/reference/.agents/skills/ipal-form/resources/CustomForm.example.tsx b/reference/.agents/skills/iapl-form/resources/CustomForm.example.tsx similarity index 100% rename from reference/.agents/skills/ipal-form/resources/CustomForm.example.tsx rename to reference/.agents/skills/iapl-form/resources/CustomForm.example.tsx diff --git a/reference/.agents/skills/ipal-form/resources/FormBlock.tsx b/reference/.agents/skills/iapl-form/resources/FormBlock.tsx similarity index 92% rename from reference/.agents/skills/ipal-form/resources/FormBlock.tsx rename to reference/.agents/skills/iapl-form/resources/FormBlock.tsx index 8b17807..89afdce 100644 --- a/reference/.agents/skills/ipal-form/resources/FormBlock.tsx +++ b/reference/.agents/skills/iapl-form/resources/FormBlock.tsx @@ -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' diff --git a/reference/.agents/skills/ipal-form/resources/actions.ts b/reference/.agents/skills/iapl-form/resources/actions.ts similarity index 86% rename from reference/.agents/skills/ipal-form/resources/actions.ts rename to reference/.agents/skills/iapl-form/resources/actions.ts index d6d80db..3d1b587 100644 --- a/reference/.agents/skills/ipal-form/resources/actions.ts +++ b/reference/.agents/skills/iapl-form/resources/actions.ts @@ -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' diff --git a/reference/.agents/skills/ipal-form/resources/formClasses.ts b/reference/.agents/skills/iapl-form/resources/formClasses.ts similarity index 100% rename from reference/.agents/skills/ipal-form/resources/formClasses.ts rename to reference/.agents/skills/iapl-form/resources/formClasses.ts diff --git a/reference/.agents/skills/ipal-form/resources/seed-form.template.ts b/reference/.agents/skills/iapl-form/resources/seed-form.template.ts similarity index 99% rename from reference/.agents/skills/ipal-form/resources/seed-form.template.ts rename to reference/.agents/skills/iapl-form/resources/seed-form.template.ts index 0baf6f7..90ad9ff 100644 --- a/reference/.agents/skills/ipal-form/resources/seed-form.template.ts +++ b/reference/.agents/skills/iapl-form/resources/seed-form.template.ts @@ -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). diff --git a/reference/.agents/skills/ipal-locale-add/SKILL.md b/reference/.agents/skills/iapl-locale-add/SKILL.md similarity index 82% rename from reference/.agents/skills/ipal-locale-add/SKILL.md rename to reference/.agents/skills/iapl-locale-add/SKILL.md index 4fde345..fe3e787 100644 --- a/reference/.agents/skills/ipal-locale-add/SKILL.md +++ b/reference/.agents/skills/iapl-locale-add/SKILL.md @@ -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 diff --git a/reference/.agents/skills/ipal-locale-add/scripts/locale-coverage.ts b/reference/.agents/skills/iapl-locale-add/scripts/locale-coverage.ts similarity index 95% rename from reference/.agents/skills/ipal-locale-add/scripts/locale-coverage.ts rename to reference/.agents/skills/iapl-locale-add/scripts/locale-coverage.ts index 876d035..79b0d34 100644 --- a/reference/.agents/skills/ipal-locale-add/scripts/locale-coverage.ts +++ b/reference/.agents/skills/iapl-locale-add/scripts/locale-coverage.ts @@ -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 diff --git a/reference/.agents/skills/ipal-migrate-fields/SKILL.md b/reference/.agents/skills/iapl-migrate-fields/SKILL.md similarity index 92% rename from reference/.agents/skills/ipal-migrate-fields/SKILL.md rename to reference/.agents/skills/iapl-migrate-fields/SKILL.md index d456042..2557432 100644 --- a/reference/.agents/skills/ipal-migrate-fields/SKILL.md +++ b/reference/.agents/skills/iapl-migrate-fields/SKILL.md @@ -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 diff --git a/reference/.agents/skills/ipal-migrate-fields/resources/migrate-block-fields.template.ts b/reference/.agents/skills/iapl-migrate-fields/resources/migrate-block-fields.template.ts similarity index 98% rename from reference/.agents/skills/ipal-migrate-fields/resources/migrate-block-fields.template.ts rename to reference/.agents/skills/iapl-migrate-fields/resources/migrate-block-fields.template.ts index 71346f7..0c722d1 100644 --- a/reference/.agents/skills/ipal-migrate-fields/resources/migrate-block-fields.template.ts +++ b/reference/.agents/skills/iapl-migrate-fields/resources/migrate-block-fields.template.ts @@ -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 diff --git a/reference/.agents/skills/ipal-nav/SKILL.md b/reference/.agents/skills/iapl-nav/SKILL.md similarity index 76% rename from reference/.agents/skills/ipal-nav/SKILL.md rename to reference/.agents/skills/iapl-nav/SKILL.md index b8d767d..8632608 100644 --- a/reference/.agents/skills/ipal-nav/SKILL.md +++ b/reference/.agents/skills/iapl-nav/SKILL.md @@ -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). diff --git a/reference/.agents/skills/ipal-nav/resources/nav-code.md b/reference/.agents/skills/iapl-nav/resources/nav-code.md similarity index 98% rename from reference/.agents/skills/ipal-nav/resources/nav-code.md rename to reference/.agents/skills/iapl-nav/resources/nav-code.md index 18b23cf..de8b874 100644 --- a/reference/.agents/skills/ipal-nav/resources/nav-code.md +++ b/reference/.agents/skills/iapl-nav/resources/nav-code.md @@ -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) diff --git a/reference/.agents/skills/ipal-plugin-gap/SKILL.md b/reference/.agents/skills/iapl-plugin-gap/SKILL.md similarity index 79% rename from reference/.agents/skills/ipal-plugin-gap/SKILL.md rename to reference/.agents/skills/iapl-plugin-gap/SKILL.md index df7cdf0..a98d72b 100644 --- a/reference/.agents/skills/ipal-plugin-gap/SKILL.md +++ b/reference/.agents/skills/iapl-plugin-gap/SKILL.md @@ -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 diff --git a/reference/.agents/skills/ipal-reference/SKILL.md b/reference/.agents/skills/iapl-reference/SKILL.md similarity index 88% rename from reference/.agents/skills/ipal-reference/SKILL.md rename to reference/.agents/skills/iapl-reference/SKILL.md index 9acae2a..187cdde 100644 --- a/reference/.agents/skills/ipal-reference/SKILL.md +++ b/reference/.agents/skills/iapl-reference/SKILL.md @@ -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 === 'dpo@acme.pl' } }` — 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`) | diff --git a/reference/.agents/skills/ipal-reference/resources/api.md b/reference/.agents/skills/iapl-reference/resources/api.md similarity index 92% rename from reference/.agents/skills/ipal-reference/resources/api.md rename to reference/.agents/skills/iapl-reference/resources/api.md index 57afbeb..3137f81 100644 --- a/reference/.agents/skills/ipal-reference/resources/api.md +++ b/reference/.agents/skills/iapl-reference/resources/api.md @@ -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`. diff --git a/reference/.agents/skills/ipal-seo-check/SKILL.md b/reference/.agents/skills/iapl-seo-check/SKILL.md similarity index 79% rename from reference/.agents/skills/ipal-seo-check/SKILL.md rename to reference/.agents/skills/iapl-seo-check/SKILL.md index 054d205..f283de2 100644 --- a/reference/.agents/skills/ipal-seo-check/SKILL.md +++ b/reference/.agents/skills/iapl-seo-check/SKILL.md @@ -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`. diff --git a/reference/.agents/skills/ipal-seo-check/scripts/seo-check.mjs b/reference/.agents/skills/iapl-seo-check/scripts/seo-check.mjs similarity index 97% rename from reference/.agents/skills/ipal-seo-check/scripts/seo-check.mjs rename to reference/.agents/skills/iapl-seo-check/scripts/seo-check.mjs index 59c7189..bd2985e 100644 --- a/reference/.agents/skills/ipal-seo-check/scripts/seo-check.mjs +++ b/reference/.agents/skills/iapl-seo-check/scripts/seo-check.mjs @@ -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) diff --git a/reference/.agents/skills/ipal-setup/SKILL.md b/reference/.agents/skills/iapl-setup/SKILL.md similarity index 89% rename from reference/.agents/skills/ipal-setup/SKILL.md rename to reference/.agents/skills/iapl-setup/SKILL.md index 3ca0a81..4062f51 100644 --- a/reference/.agents/skills/ipal-setup/SKILL.md +++ b/reference/.agents/skills/iapl-setup/SKILL.md @@ -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**). diff --git a/reference/.agents/skills/ipal-setup/resources/DESIGN.md b/reference/.agents/skills/iapl-setup/resources/DESIGN.md similarity index 93% rename from reference/.agents/skills/ipal-setup/resources/DESIGN.md rename to reference/.agents/skills/iapl-setup/resources/DESIGN.md index 9e48864..bf36ef1 100644 --- a/reference/.agents/skills/ipal-setup/resources/DESIGN.md +++ b/reference/.agents/skills/iapl-setup/resources/DESIGN.md @@ -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> ``` diff --git a/reference/.agents/skills/ipal-setup/resources/tokens.ts b/reference/.agents/skills/iapl-setup/resources/tokens.ts similarity index 95% rename from reference/.agents/skills/ipal-setup/resources/tokens.ts rename to reference/.agents/skills/iapl-setup/resources/tokens.ts index 91c7aac..ad7d914 100644 --- a/reference/.agents/skills/ipal-setup/resources/tokens.ts +++ b/reference/.agents/skills/iapl-setup/resources/tokens.ts @@ -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' diff --git a/reference/.agents/skills/ipal-site/SKILL.md b/reference/.agents/skills/iapl-site/SKILL.md similarity index 78% rename from reference/.agents/skills/ipal-site/SKILL.md rename to reference/.agents/skills/iapl-site/SKILL.md index 78c2de7..18ae99c 100644 --- a/reference/.agents/skills/ipal-site/SKILL.md +++ b/reference/.agents/skills/iapl-site/SKILL.md @@ -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. diff --git a/reference/.agents/skills/ipal-site/resources/seed-content.template.ts b/reference/.agents/skills/iapl-site/resources/seed-content.template.ts similarity index 95% rename from reference/.agents/skills/ipal-site/resources/seed-content.template.ts rename to reference/.agents/skills/iapl-site/resources/seed-content.template.ts index 1287aac..b2c71cc 100644 --- a/reference/.agents/skills/ipal-site/resources/seed-content.template.ts +++ b/reference/.agents/skills/iapl-site/resources/seed-content.template.ts @@ -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: [...] }] } diff --git a/reference/.agents/skills/ipal-upgrade/SKILL.md b/reference/.agents/skills/iapl-upgrade/SKILL.md similarity index 85% rename from reference/.agents/skills/ipal-upgrade/SKILL.md rename to reference/.agents/skills/iapl-upgrade/SKILL.md index 8730eb3..455abbe 100644 --- a/reference/.agents/skills/ipal-upgrade/SKILL.md +++ b/reference/.agents/skills/iapl-upgrade/SKILL.md @@ -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 next@16.4.6 eslint-config-next@16.4.6 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 next@16.4.6 eslint-config-next@16.4.6`, `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. diff --git a/reference/.env.example b/reference/.env.example index 0936964..ef76460 100644 --- a/reference/.env.example +++ b/reference/.env.example @@ -1,7 +1,7 @@ # @starter:if demo # Example Studio — reference site for @intecion/ipal-kit. Copy to .env for local work. # @starter:else -#: # Example Studio — copy to .env for local work (`ipal-kit create` already wrote one with a fresh PAYLOAD_SECRET). +#: # Example Studio — copy to .env for local work (`iapl create` already wrote one with a fresh PAYLOAD_SECRET). # @starter:endif # Production values live in the Coolify app → Environment Variables (docs/DEPLOY.md), never in the repo. @@ -13,9 +13,9 @@ PAYLOAD_SECRET= NEXT_PUBLIC_SERVER_URL=http://localhost:3000 # Client IP header for rate limits and consent records (x-forwarded-for behind Coolify's proxy) -IPAL_IP_HEADER=x-forwarded-for +IAPL_IP_HEADER=x-forwarded-for # 1 only on a staging copy (noindex everywhere, no IndexNow) -IPAL_NOINDEX= +IAPL_NOINDEX= # Local and CI production builds only (pnpm build && pnpm start without R2): 1 = media on local disk. # NEVER set in Coolify — production requires R2. @@ -42,8 +42,8 @@ TURNSTILE_SECRET_KEY=1x0000000000000000000000000000000AA # @starter:if crawl # Cookie scanner "Crawl site" — the shared services/cookie-crawler deployment -IPAL_COOKIE_SCAN_URL= -IPAL_COOKIE_SCAN_TOKEN= +IAPL_COOKIE_SCAN_URL= +IAPL_COOKIE_SCAN_TOKEN= # @starter:endif # IndexNow key (or generate one in Site integrations) diff --git a/reference/AGENTS.md b/reference/AGENTS.md index 7cfceaa..53ebc54 100644 --- a/reference/AGENTS.md +++ b/reference/AGENTS.md @@ -3,17 +3,17 @@ **Project:** Example Studio (`Pracownia Przykład`, made up) · example-studio.pl · market PL · industry architecture and interior design **Languages:** pl (default), en · **Media:** R2 in production, local disk in dev · **Email:** SMTP from Site integrations -> This is the **ipal-kit reference site** (`reference/` in the plugin repo). Every file shows a convention from -> `docs/agent/AGENT.md`; the company and all content are invented. The project starter (`ipal-kit create`) is +> This is the **IAPL reference site** (`reference/` in the plugin repo). Every file shows a convention from +> `docs/agent/AGENT.md`; the company and all content are invented. The project starter (`iapl create`) is > generated from this folder (`starter.manifest.json`). ## Rules 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. @@ -32,7 +32,7 @@ Write everything in this file in English. <!-- starter:decisions --> ## Project decisions - Languages: pl (default) and en, every language with a URL prefix (`/pl/…`, `/en/…`); `/` redirects to `/pl`. -- Styling: the ipal-kit token standard — `src/design/tokens.ts` → `pnpm tokens` → `src/design/tokens.css`; fluid-wide; brand sage green + terracotta accent, sharp radius; Inter (body) + Fraunces (headings) via next/font. +- Styling: the IAPL token standard — `src/design/tokens.ts` → `pnpm tokens` → `src/design/tokens.css`; fluid-wide; brand sage green + terracotta accent, sharp radius; Inter (body) + Fraunces (headings) via next/font. - Pages and content: Pages from library blocks only (all 15 turned on for the showcase); collections `posts` and `caseStudies` with archive pages. - Forms: Contact form and Quote form (step-by-step), seeded; e-mail to the company (Company → E-mail) and a confirmation to the sender; SMTP from Site integrations; Turnstile on. - Analytics and consent: GA4/GTM wired but off until IDs are entered; Consent Mode advanced (default); banner `settings="detailed"`, `controls="switch"`, `equalChoice`; consent log on; cookie scanner with crawl (shared cookie-crawler service). @@ -46,17 +46,17 @@ Write everything in this file in English. - Approved exception: `ALLOW_LOCAL_MEDIA=1` (instrumentation.ts, next.config.ts) lets a production build run without R2 for local checks and CI only; never set in Coolify. <!-- /starter:decisions --> -<!-- ipal-kit:start --> -## ipal-kit 1.16.8 — agent guide +<!-- iapl:start --> +## IAPL 1.16.8 — agent guide -<!-- Managed by `pnpm exec ipal-skills` — edits between the markers are overwritten. --> +<!-- Managed by `pnpm exec iapl-skills` — edits between the markers are overwritten. --> This project is built on `@intecion/ipal-kit` (a Payload CMS 3 plugin). Before you write code: 1. Rules: `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md`. -2. Everything the plugin provides (options, env vars, routes, layout, hooks, collections, globals, every export): the `ipal-reference` skill — `.agents/skills/ipal-reference/SKILL.md`. -3. New project or missing foundation: the `ipal-setup` skill; a whole site: `ipal-site`. All skills: `.agents/skills/`. +2. Everything the plugin provides (options, env vars, routes, layout, hooks, collections, globals, every export): the `iapl-reference` skill — `.agents/skills/iapl-reference/SKILL.md`. +3. New project or missing foundation: the `iapl-setup` skill; a whole site: `iapl-site`. All skills: `.agents/skills/`. 4. Module details: `node_modules/@intecion/ipal-kit/docs/<module>.md`. -5. ipal-kit first: if the plugin has it, use it. Broken or not enough → report it with the `ipal-plugin-gap` skill and wait for the owner — no hand-built replacement, never patch `node_modules`. +5. IAPL first: if the plugin has it, use it. Broken or not enough → report it with the `iapl-plugin-gap` skill and wait for the owner — no hand-built replacement, never patch `node_modules`. 6. Before you set up a site: ask the owner the architecture questions (AGENT.md "Ask before you build") and wait for the answers; record them under "Project decisions". -7. ipal-kit docs, this guide and the skills are in English; write rules, AGENTS.md entries and gap reports in English. -<!-- ipal-kit:end --> +7. IAPL docs, this guide and the skills are in English; write rules, AGENTS.md entries and gap reports in English. +<!-- iapl:end --> diff --git a/reference/DESIGN.md b/reference/DESIGN.md index a1aed5a..f27d707 100644 --- a/reference/DESIGN.md +++ b/reference/DESIGN.md @@ -1,7 +1,7 @@ # DESIGN.md — Example Studio 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. ## 1. Brand in one sentence A small architecture and interior studio: calm, precise, natural materials. Audience: families building a house, @@ -21,7 +21,7 @@ sage-green surfaces. Everything else stays quiet. | surface-muted | oklch(0.955 0.012 85) | oklch(0.25 0.012 160) | alternate sections, footer | | secondary, surface, borders, text | default | default | — | -Contrast (`pnpm exec ipal-tokens --report`): 74 of 74 pairs pass, light and dark, the inverse scope included. +Contrast (`pnpm exec iapl-tokens --report`): 74 of 74 pairs pass, light and dark, the inverse scope included. ## 3. Type Body: Inter 400/500 (`--font-family-body`). Headings: Fraunces 600 (`--font-family-heading`). diff --git a/reference/README.md b/reference/README.md index 2af9208..ef95dc4 100644 --- a/reference/README.md +++ b/reference/README.md @@ -1,11 +1,11 @@ -# Example Studio — the ipal-kit reference site +# Example Studio — the IAPL reference site One complete client site on `@intecion/ipal-kit` that uses every convention in `docs/agent/AGENT.md`, kept current with each plugin release. The company, people, numbers and texts are **made up**; `example-studio.pl` is a placeholder domain. - **Agents** copy patterns from here (index: `docs/agent/reference-site/INDEX.md` in the plugin package). -- **The project starter** (`ipal-kit create`) is generated from this folder; `starter.manifest.json` says what +- **The project starter** (`iapl create`) is generated from this folder; `starter.manifest.json` says what it keeps, drops or turns into placeholders. - **The plugin's CI** builds it, seeds it and runs the smoke tests on every change (`.gitea/workflows/ci.yml`). @@ -29,7 +29,7 @@ What only a built site shows, with both bundlers — from the plugin repository' ```bash pnpm e2e:built # webpack, then Turbopack: build with the late-staff fixture, check the public files, run the specs ``` -It checks the account rules of a staff collection that a plugin listed after ipalKit adds or copies +It checks the account rules of a staff collection that a plugin listed after iapl adds or copies (`e2e/late-staff-fixture.ts`, on only with `E2E_LATE_STAFF=1`; `e2e/late-staff.spec.ts`) and that no package manifest is among the public files. Unit tests run unminified code and cannot see what a bundle renames or publishes. Without `E2E_LATE_STAFF=1` the fixture adds nothing and the spec is skipped. Rebuild with `pnpm build` afterwards. diff --git a/reference/docs/DEPLOY.md b/reference/docs/DEPLOY.md index c5748fe..35c3b06 100644 --- a/reference/docs/DEPLOY.md +++ b/reference/docs/DEPLOY.md @@ -11,7 +11,7 @@ pnpm generate:types && pnpm generate:importmap # committed files up to date (g pnpm typecheck pnpm build # page routes ● (SSG), needs the local database ALLOW_LOCAL_MEDIA=1 PORT=3100 pnpm start # production build on local disk (never set in Coolify) -pnpm exec ipal-doctor --strict # 0 findings (when the doctor ships) +pnpm exec iapl-doctor --strict # 0 findings (when the doctor ships) pnpm test:e2e # smoke tests, after `pnpm payload run e2e/create-test-admin.ts` ``` @@ -51,9 +51,9 @@ pnpm test:e2e # smoke tests, after `pnpm pay <!-- @starter:if graph --> #: | `GRAPH_TENANT_ID`, `GRAPH_CLIENT_ID`, `GRAPH_CLIENT_SECRET`, `GRAPH_SENDER` | | ✓ | e-mail through Microsoft Graph (all four) | <!-- @starter:endif --> -| `IPAL_IP_HEADER` | | ✓ | `x-forwarded-for` behind Coolify's proxy (`cf-connecting-ip` behind Cloudflare) | +| `IAPL_IP_HEADER` | | ✓ | `x-forwarded-for` behind Coolify's proxy (`cf-connecting-ip` behind Cloudflare) | <!-- @starter:if crawl --> -| `IPAL_COOKIE_SCAN_URL`, `IPAL_COOKIE_SCAN_TOKEN` | | ✓ | the shared cookie-crawler service | +| `IAPL_COOKIE_SCAN_URL`, `IAPL_COOKIE_SCAN_TOKEN` | | ✓ | the shared cookie-crawler service | <!-- @starter:endif --> | `INDEXNOW_KEY` | | ✓ | or generate the key in Site integrations | | `ALLOW_LOCAL_MEDIA` | — | — | **never set here** (local / CI only) | @@ -68,7 +68,7 @@ SEED_ONLY="pages:kontakt" SEED_DRY_RUN=1 pnpm seed # 1. read the plan SEED_ONLY="pages:kontakt" pnpm seed # 3. the real run ``` Keys: `pages:<pl slug>`, `forms:<title>`, `global:<slug>`. A run without `SEED_ONLY` is refused on production -(`IPAL_SEED_ALLOW_FULL=1` only with the owner's explicit OK). The container is built from the whole repo, so the +(`IAPL_SEED_ALLOW_FULL=1` only with the owner's explicit OK). The container is built from the whole repo, so the Payload CLI and `src/seed/` are there. ## 6. DNS (the team adds the records; check with `dig`) diff --git a/reference/e2e/late-staff-fixture.ts b/reference/e2e/late-staff-fixture.ts index a8f16e4..025bcf3 100644 --- a/reference/e2e/late-staff-fixture.ts +++ b/reference/e2e/late-staff-fixture.ts @@ -1,9 +1,9 @@ import type { Config, Plugin } from 'payload' /** - * Test fixture, on only with E2E_LATE_STAFF=1 (e2e/late-staff.spec.ts): a plugin listed AFTER ipalKit that adds + * Test fixture, on only with E2E_LATE_STAFF=1 (e2e/late-staff.spec.ts): a plugin listed AFTER iapl that adds * a staff collection (`late-staff`, named in `access.staffCollections`) and a visitor collection with open - * sign-up. ipalKit has already run when these collections appear, so it must give them its account rules when + * sign-up. iapl has already run when these collections appear, so it must give them its account rules when * the config goes live — and it must do so in a BUILT site too, where bundlers rename every function. * Never part of a real site: the starter drops `e2e/` and the lines that use this file. */ @@ -13,7 +13,7 @@ export const E2E_LATE_STAFF = process.env.E2E_LATE_STAFF === '1' export const E2E_STAFF_SLUGS = ['late-staff', 'e2e-crew', 'e2e-late-text', 'e2e-staff', 'e2e-team', 'e2e-copy', 'e2e-copy-own-rules', 'e2e-copy-cross-op', 'e2e-copy-values', 'e2e-copy-team-admin', 'e2e-copy-opt-out'] /** - * Listed BEFORE ipalKit: a staff collection of the project's own, without rules, whose roles are the plugin's values + * Listed BEFORE iapl: a staff collection of the project's own, without rules, whose roles are the plugin's values * PLUS one more. `admin` on an account of it makes a plugin admin, so its accounts must not hand that value out. */ export const e2eEarlyStaff: Plugin = (config: Config) => @@ -56,7 +56,7 @@ export const e2eLateStaff: Plugin = (config: Config) => collections: [ ...(config.collections ?? []), ...copies(config), - // no access rules at all: Payload's defaults ("any logged-in user") are what ipalKit must replace + // no access rules at all: Payload's defaults ("any logged-in user") are what iapl must replace { slug: 'late-staff', auth: true, fields: [{ name: 'roles', type: 'select', hasMany: true, options: ['user', 'editor', 'admin'], saveToJWT: true }], versions: true }, // a late staff collection whose `roles` is a text field: any value can be written there, `admin` included { slug: 'e2e-late-text', auth: true, fields: [{ name: 'roles', type: 'text', hasMany: true }] }, diff --git a/reference/e2e/late-staff.spec.ts b/reference/e2e/late-staff.spec.ts index 314f091..3e8c23b 100644 --- a/reference/e2e/late-staff.spec.ts +++ b/reference/e2e/late-staff.spec.ts @@ -4,7 +4,7 @@ import { randomUUID } from 'node:crypto' import { secondTestAdmin, totp } from './totp' /** - * The account rules on a BUILT site, for a staff collection that a plugin listed after ipalKit adds + * The account rules on a BUILT site, for a staff collection that a plugin listed after iapl adds * (e2e/late-staff-fixture.ts). Unit tests run unminified code; a production bundle renames every function, and a * rule that told Payload's default access function by its name was silently skipped there. Run it against both * bundlers (README "Production check"): diff --git a/reference/e2e/two-factor-back.spec.ts b/reference/e2e/two-factor-back.spec.ts index 182e58c..e8de549 100644 --- a/reference/e2e/two-factor-back.spec.ts +++ b/reference/e2e/two-factor-back.spec.ts @@ -5,7 +5,7 @@ import { totp } from './totp' /** * The `back` link of the 2FA screens (twoFactor.safeBack, security.md). The 2FA package sends the browser to - * `back` after a valid code; ipal-kit checks the value first. A prepared link must end on the admin root: + * `back` after a valid code; IAPL checks the value first. A prepared link must end on the admin root: * no script in the panel, no other site. Run against a built site with the test admin (create-test-admin.ts). * * Two verify attempts for the test admin here; the smoke spec makes two more (the limit is 5 in 10 minutes). diff --git a/reference/ipal-doctor.json b/reference/iapl-doctor.json similarity index 100% rename from reference/ipal-doctor.json rename to reference/iapl-doctor.json diff --git a/reference/next.config.ts b/reference/next.config.ts index 73b1b98..c85a789 100644 --- a/reference/next.config.ts +++ b/reference/next.config.ts @@ -14,7 +14,7 @@ import { withPayload } from '@payloadcms/next/withPayload' const csp = { mode: 'enforce', r2Url: process.env.R2_PUBLIC_URL, reportUri: '/api/csp-report' } as const // @starter:else //: // CSP step 1: report-only. Read the [csp] lines in the logs, add a flag or `extra` per report, then switch to -//: // mode: 'enforce' (security.md → "ROLL OUT CSP"; ipal-doctor.json silences the report-only finding until then). +//: // mode: 'enforce' (security.md → "ROLL OUT CSP"; iapl-doctor.json silences the report-only finding until then). //: const csp = { mode: 'report-only', r2Url: process.env.R2_PUBLIC_URL, reportUri: '/api/csp-report' } as const // @starter:endif diff --git a/reference/package.json b/reference/package.json index d88ce41..cabb885 100644 --- a/reference/package.json +++ b/reference/package.json @@ -17,8 +17,8 @@ "seed": "payload run src/seed/index.ts", "seed:base": "cross-env SEED_LAYER=base payload run src/seed/index.ts", "seed:demo": "cross-env SEED_LAYER=demo payload run src/seed/index.ts", - "tokens": "ipal-tokens", - "ipal:skills": "ipal-skills", + "tokens": "iapl-tokens", + "iapl:skills": "iapl-skills", "typecheck": "tsc --noEmit", "test:e2e": "playwright test" }, diff --git a/reference/src/app/(frontend)/[locale]/actions.ts b/reference/src/app/(frontend)/[locale]/actions.ts index 78ebe04..05b8a92 100644 --- a/reference/src/app/(frontend)/[locale]/actions.ts +++ b/reference/src/app/(frontend)/[locale]/actions.ts @@ -1,5 +1,5 @@ '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' diff --git a/reference/src/app/(frontend)/[locale]/design/page.tsx b/reference/src/app/(frontend)/[locale]/design/page.tsx index 020c145..f43d622 100644 --- a/reference/src/app/(frontend)/[locale]/design/page.tsx +++ b/reference/src/app/(frontend)/[locale]/design/page.tsx @@ -13,7 +13,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="light" and data-theme="dark" diff --git a/reference/src/collections/CaseStudies.ts b/reference/src/collections/CaseStudies.ts index 5c0cc78..4d9ee4f 100644 --- a/reference/src/collections/CaseStudies.ts +++ b/reference/src/collections/CaseStudies.ts @@ -9,7 +9,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' }, diff --git a/reference/src/components/design/TokenPanel.tsx b/reference/src/components/design/TokenPanel.tsx index 5cc0453..6294e1d 100644 --- a/reference/src/components/design/TokenPanel.tsx +++ b/reference/src/components/design/TokenPanel.tsx @@ -1,7 +1,7 @@ import { buttonClass } from '@intecion/ipal-kit/blocks/rsc' -import { COLOR_DEFAULTS, FLUID_TOKENS, IPAL_TOKENS, type IpalTokenName, STATIC_DEFAULTS } from '@intecion/ipal-kit/tokens' +import { COLOR_DEFAULTS, FLUID_TOKENS, IAPL_TOKENS, type IaplTokenName, STATIC_DEFAULTS } from '@intecion/ipal-kit/tokens' -const COLORS = Object.keys(COLOR_DEFAULTS) as IpalTokenName[] +const COLORS = Object.keys(COLOR_DEFAULTS) as IaplTokenName[] const TYPE = ['text-display', 'text-h1', 'text-h2', 'text-h3', 'text-h4', 'text-lead', 'text-base', 'text-sm', 'text-xs'] const RADII = ['rounded-sm', 'rounded-control', 'rounded-card', 'rounded-media', 'rounded-full'] const SHADOWS = ['shadow-sm', 'shadow-md', 'shadow-lg'] @@ -9,7 +9,7 @@ const SHADOWS = ['shadow-sm', 'shadow-md', 'shadow-lg'] type Props = { inverse?: boolean; theme?: 'dark' | 'light'; title: string } /** - * One panel of the styleguide. Swatches read IPAL_TOKENS (`var(--ipal-…)` strings from the plugin), so a new + * One panel of the styleguide. Swatches read IAPL_TOKENS (`var(--ipal-…)` strings from the plugin), so a new * token appears here with no code change. Inline styles are the one place raw vars are fine: this page shows them. */ export function TokenPanel({ inverse, theme, title }: Props) { @@ -27,7 +27,7 @@ export function TokenPanel({ inverse, theme, title }: Props) { <ul className="grid grid-cols-2 gap-3 sm:grid-cols-3"> {COLORS.map((name) => ( <li className="flex items-center gap-3" key={name}> - <span className="size-8 shrink-0 rounded-sm border border-border" style={{ background: IPAL_TOKENS[name] }} /> + <span className="size-8 shrink-0 rounded-sm border border-border" style={{ background: IAPL_TOKENS[name] }} /> <code className="text-xs text-fg-muted">{name}</code> </li> ))} diff --git a/reference/src/components/forms/formClasses.ts b/reference/src/components/forms/formClasses.ts index f381a10..46b29d8 100644 --- a/reference/src/components/forms/formClasses.ts +++ b/reference/src/components/forms/formClasses.ts @@ -4,7 +4,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'), diff --git a/reference/src/components/layout/Header.tsx b/reference/src/components/layout/Header.tsx index 7dde2a3..8c6241c 100644 --- a/reference/src/components/layout/Header.tsx +++ b/reference/src/components/layout/Header.tsx @@ -14,7 +14,7 @@ import { MobileNav } from './MobileNav' type Props = { header: HeaderData; locale: string; settings: null | Record<string, unknown>; themeLabel: null | string } -/** Site header: logo and name from Site settings, menu from the Header global (ipal-nav). */ +/** Site header: logo and name from Site settings, menu from the Header global (iapl-nav). */ export async function Header({ header, locale, settings, themeLabel }: Props) { const items = await resolveNav(header.navItems, locale) const cta = header.links?.[0]?.link ? await resolveLink(header.links[0].link, locale) : null diff --git a/reference/src/components/layout/MobileNav.tsx b/reference/src/components/layout/MobileNav.tsx index 529e701..47acaf0 100644 --- a/reference/src/components/layout/MobileNav.tsx +++ b/reference/src/components/layout/MobileNav.tsx @@ -4,7 +4,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(() => { diff --git a/reference/src/design/tokens.css b/reference/src/design/tokens.css index d1a1be7..a59d171 100644 --- a/reference/src/design/tokens.css +++ b/reference/src/design/tokens.css @@ -1,6 +1,6 @@ /* - * 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 { diff --git a/reference/src/globals/Footer.ts b/reference/src/globals/Footer.ts index cab8124..3900a68 100644 --- a/reference/src/globals/Footer.ts +++ b/reference/src/globals/Footer.ts @@ -3,7 +3,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 }, diff --git a/reference/src/globals/Header.ts b/reference/src/globals/Header.ts index 880f47a..863fc16 100644 --- a/reference/src/globals/Header.ts +++ b/reference/src/globals/Header.ts @@ -3,7 +3,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 }, diff --git a/reference/src/instrumentation.ts b/reference/src/instrumentation.ts index 668280d..82601e5 100644 --- a/reference/src/instrumentation.ts +++ b/reference/src/instrumentation.ts @@ -1,18 +1,18 @@ -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 diff --git a/reference/src/lib/content.ts b/reference/src/lib/content.ts index d610d57..9c1047b 100644 --- a/reference/src/lib/content.ts +++ b/reference/src/lib/content.ts @@ -57,10 +57,10 @@ export const { mcp: { serverName: 'example-studio-site' }, pageJsonLd: { faq: (doc) => faqItemsFromLayout(doc) }, // FAQ blocks → FAQPage rich results // @starter:if aiBotsBlockTraining - //: robots: { aiBots: 'block-training' }, // client decision — AGENTS.md → Project decisions (ipal-audit-skip: aibots) + //: robots: { aiBots: 'block-training' }, // client decision — AGENTS.md → Project decisions (iapl-audit-skip: aibots) // @starter:endif // @starter:if aiBotsDisallow - //: robots: { aiBots: 'disallow' }, // client decision — AGENTS.md → Project decisions (ipal-audit-skip: aibots) + //: robots: { aiBots: 'disallow' }, // client decision — AGENTS.md → Project decisions (iapl-audit-skip: aibots) // @starter:endif // @starter:if localBusiness // LocalBusiness from the Company global (replaces the default WebSite + Organization from Site settings) diff --git a/reference/src/lib/globals.ts b/reference/src/lib/globals.ts index 1379415..cb2dcdf 100644 --- a/reference/src/lib/globals.ts +++ b/reference/src/lib/globals.ts @@ -4,7 +4,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 })) diff --git a/reference/src/payload.config.ts b/reference/src/payload.config.ts index 8b05dd3..c5ab8f9 100644 --- a/reference/src/payload.config.ts +++ b/reference/src/payload.config.ts @@ -1,7 +1,7 @@ // @starter:if twoFactor import { payloadTotp } from '@clocklimited/payload-2fa' // @starter:endif -import { buildR2Storage, ipalKit, mailAdapter } from '@intecion/ipal-kit' +import { buildR2Storage, iapl, mailAdapter } from '@intecion/ipal-kit' import { lexicalEditor } from '@payloadcms/richtext-lexical' import { s3Storage } from '@payloadcms/storage-s3' import { revalidatePath } from 'next/cache' @@ -37,7 +37,7 @@ export default buildConfig({ }, // absolute URLs in form e-mails (logo, links) serverURL: process.env.NEXT_PUBLIC_SERVER_URL, - // ipalKit injects `users` (roles + 2FA) + // iapl injects `users` (roles + 2FA) collections: [ Pages, // @starter:if posts @@ -59,8 +59,11 @@ export default buildConfig({ // @starter:if demo e2eEarlyStaff, // a test fixture, a no-op without E2E_LATE_STAFF=1 (e2e/late-staff-fixture.ts) // @starter:endif - ipalKit({ + iapl({ i18n: i18nConfig, + // a site made since 1.17.0: the 2FA counter key and the statistics cookie carry the new spelling (docs/stats.md); + // with `stats` on, the layout passes visitorCookie={IAPL_VISITOR_COOKIE} to match + storageNames: 'iapl', // @starter:if demo // (the staffCollections entry exists only for e2e/late-staff.spec.ts, with E2E_LATE_STAFF=1) access: { authCollection: 'users', ...(E2E_LATE_STAFF ? { staffCollections: E2E_STAFF_SLUGS } : {}) }, @@ -89,7 +92,7 @@ export default buildConfig({ // @starter:if twoFactor twoFactor: { issuer: 'Example Studio', plugin: payloadTotp }, // @starter:else - //: twoFactor: false, // turned off by the owner — AGENTS.md → Project decisions, ipal-doctor.json + //: twoFactor: false, // turned off by the owner — AGENTS.md → Project decisions, iapl-doctor.json // @starter:endif // @starter:if whiteLabel whiteLabel: true, @@ -105,7 +108,7 @@ export default buildConfig({ // @starter:endif indexNow: true, consentLog: true, - // Privacy → Cookie review: scan + approval; crawl needs IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN + // Privacy → Cookie review: scan + approval; crawl needs IAPL_COOKIE_SCAN_URL / IAPL_COOKIE_SCAN_TOKEN // @starter:if crawl cookieScanner: { crawl: true }, // @starter:endif diff --git a/reference/src/seed/demo.ts b/reference/src/seed/demo.ts index d048623..72b92be 100644 --- a/reference/src/seed/demo.ts +++ b/reference/src/seed/demo.ts @@ -143,7 +143,7 @@ const CASES = [ const META: Record<string, { en: string; pl: string }> = { 'architektura-domow': tx('Projekty domów jednorodzinnych: analiza działki, koncepcja w trzech wariantach, projekt budowlany i wykonawczy. Example Studio, Warszawa.', 'Family house design: site analysis, a concept in three options, permit and construction drawings. Example Studio, Warsaw.'), blog: tx('Blog pracowni Example Studio: jak wybrać działkę, ile trwa projekt domu, z czego budować. Odpowiedzi na pytania klientów, bez żargonu.', 'The Example Studio blog: choosing a plot, how long a house design takes, what to build with. Answers to clients’ questions, no jargon.'), - bloki: tx('Strona testowa biblioteki bloków ipal-kit: każdy blok w każdym wariancie, także na odwróconym tle. Niewidoczna dla wyszukiwarek.', 'The ipal-kit block library test page: every block in every variant, also on the inverted background. Hidden from search engines.'), + bloki: tx('Strona testowa biblioteki bloków IAPL: każdy blok w każdym wariancie, także na odwróconym tle. Niewidoczna dla wyszukiwarek.', 'The IAPL block library test page: every block in every variant, also on the inverted background. Hidden from search engines.'), kontakt: tx('Napisz do Example Studio: odpowiadamy w ciągu jednego dnia roboczego. Pierwsza rozmowa o domu, wnętrzu albo nadzorze jest bezpłatna.', 'Write to Example Studio: we reply within one working day. The first conversation about a house, an interior or supervision is free.'), 'nadzor-autorski': tx('Nadzór autorski: cotygodniowe wizyty na budowie, odbiory etapów i raport ze zdjęciami po każdej wizycie. Example Studio.', 'Site supervision: weekly site visits, stage inspections and a photo report after every visit. Example Studio.'), 'nie-znaleziono': tx('Nie znaleziono strony w serwisie Example Studio. Przejdź na stronę główną albo skorzystaj z menu.', 'Page not found on the Example Studio site. Go to the home page or use the menu.'), @@ -152,7 +152,7 @@ const META: Record<string, { en: string; pl: string }> = { 'polityka-prywatnosci': tx('Polityka prywatności Example Studio: kto przetwarza dane z formularzy, w jakim celu i jakie masz prawa.', 'The Example Studio privacy policy: who processes form data, for what purpose and what your rights are.'), 'projektowanie-wnetrz': tx('Projektowanie wnętrz mieszkań, domów i biur: układ, meble na wymiar, materiały z próbkami i wizualizacje każdego pomieszczenia.', 'Interior design for flats, houses and offices: layout, built-in furniture, materials from samples and renderings of every room.'), realizacje: tx('Realizacje Example Studio: dom pod lasem, przebudowa kamienicy i kawiarnia z czytelnią — założenia, decyzje, materiały i czas realizacji.', 'Example Studio case studies: a house by the forest, a tenement conversion and a café with a reading room — brief, decisions, materials, timing.'), - regulamin: tx('Regulamin serwisu Example Studio — przykładowa treść strony referencyjnej ipal-kit.', 'Terms of service of the Example Studio site — sample text on the ipal-kit reference site.'), + regulamin: tx('Regulamin serwisu Example Studio — przykładowa treść strony referencyjnej IAPL.', 'Terms of service of the Example Studio site — sample text on the IAPL reference site.'), start: tx('Example Studio — pracownia architektury i wnętrz z Warszawy. Projektujemy domy i wnętrza z naturalnych materiałów, które dobrze się starzeją.', 'Example Studio — an architecture and interior studio in Warsaw. We design houses and interiors in natural materials that age well.'), uslugi: tx('Usługi Example Studio: projekty domów, projektowanie wnętrz i nadzór autorski. Zakres, proces i orientacyjne ceny.', 'Example Studio services: house design, interior design and site supervision. Scope, process and indicative prices.'), wycena: tx('Poproś o wycenę projektu: trzy krótkie kroki, odpowiedź z wyceną i harmonogramem w ciągu trzech dni roboczych.', 'Ask for a project quote: three short steps, a reply with the price and schedule within three working days.'), @@ -172,8 +172,8 @@ export async function seedDemoGlobals(seed: Seeder, media: Record<string, string defaultTheme: 'system', favicon: media['icon-example-studio'], llmsIntro: tx( - 'Example Studio to fikcyjna pracownia architektury i wnętrz z Warszawy, stworzona jako strona referencyjna ipal-kit. Projektuje domy jednorodzinne, wnętrza i prowadzi nadzór autorski.', - 'Example Studio is a made-up architecture and interior studio from Warsaw, built as the ipal-kit reference site. It designs family houses and interiors and provides site supervision.', + 'Example Studio to fikcyjna pracownia architektury i wnętrz z Warszawy, stworzona jako strona referencyjna IAPL. Projektuje domy jednorodzinne, wnętrza i prowadzi nadzór autorski.', + 'Example Studio is a made-up architecture and interior studio from Warsaw, built as the IAPL reference site. It designs family houses and interiors and provides site supervision.', ), siteDescription: tx('Pracownia architektury i wnętrz: domy, wnętrza, nadzór autorski. Projekty, które dobrze się starzeją.', 'Architecture and interior studio: houses, interiors, site supervision. Designs that age well.'), siteName: 'Example Studio', @@ -466,6 +466,6 @@ export async function seedDemoNavigation(seed: Seeder) { { heading: tx('Pracownia', 'Studio'), items: [link(tx('O nas', 'About'), 'o-nas'), link(tx('Realizacje', 'Case studies'), 'realizacje'), link(tx('Blog', 'Blog'), 'blog')] }, { heading: tx('Kontakt', 'Contact'), items: [link(tx('Napisz do nas', 'Write to us'), 'kontakt'), link(tx('Wycena', 'Get a quote'), 'wycena')] }, ], - note: tx('Strona referencyjna ipal-kit — firma i treści są fikcyjne.', 'ipal-kit reference site — the company and content are made up.'), + note: tx('Strona referencyjna IAPL — firma i treści są fikcyjne.', 'IAPL reference site — the company and content are made up.'), }) } diff --git a/reference/src/seed/forms.ts b/reference/src/seed/forms.ts index 99ee940..c5c1c4f 100644 --- a/reference/src/seed/forms.ts +++ b/reference/src/seed/forms.ts @@ -13,7 +13,7 @@ const consent = { width: 100, } -/** The two e-mails every form sends: a notification to the company and a confirmation to the sender (ipal-form). */ +/** The two e-mails every form sends: a notification to the company and a confirmation to the sender (iapl-form). */ function emails(notifyTo: string, subject: Localized, confirmationSubject: Localized) { return [ { emailTo: notifyTo, message: rich(tx('Nowe zgłoszenie z formularza:\n\n{{*:table}}', 'New form submission:\n\n{{*:table}}')), replyTo: '{{email}}', subject }, diff --git a/reference/src/seed/index.ts b/reference/src/seed/index.ts index 8f47f4a..74882de 100644 --- a/reference/src/seed/index.ts +++ b/reference/src/seed/index.ts @@ -2,14 +2,14 @@ * Seeds of the reference site — rules: node_modules/@intecion/ipal-kit/docs/seeding.md. * * pnpm seed # the reference site: demo layer first (filled pages win), then the base layer; - * # a site made by `ipal-kit create`: the base layer only + * # a site made by `iapl create`: the base layer only * pnpm seed:base # only what every new site keeps * pnpm seed:demo # reference site only: the made-up company's content (needs the base forms) * SEED_DRY_RUN=1 pnpm seed # print the plan, write nothing * * VERY IMPORTANT — after launch: never the whole seed again. Name the records the run may touch: * SEED_ONLY="pages:kontakt" SEED_DRY_RUN=1 pnpm seed → Backup now (Coolify) → the same without SEED_DRY_RUN - * createSeeder refuses a run without SEED_ONLY on production or a non-local database (IPAL_SEED_ALLOW_FULL=1 + * createSeeder refuses a run without SEED_ONLY on production or a non-local database (IAPL_SEED_ALLOW_FULL=1 * only with the owner's explicit OK). Pages are create-only; an edited record is skipped. */ import config from '@payload-config' diff --git a/reference/starter.manifest.json b/reference/starter.manifest.json index 8d55902..890c01a 100644 --- a/reference/starter.manifest.json +++ b/reference/starter.manifest.json @@ -1,5 +1,5 @@ { - "$comment": "How `ipal-kit create` turns this reference site into a new project (docs/project-starter.md). reference/ is the only hand-edited tree; the starter keeps no template files of its own. Paths are relative to reference/. Roles: drop = left out; generate = written by the starter from the owner's answers; template = copied with the placeholders below replaced; keep = copied as is (and must hold no fake value). variants = whole files that exist only with a flag on. In-file variants: `// @starter:if <flag>` … `// @starter:else` … `// @starter:endif` ({/* */} in TSX, # in env files, <!-- --> in Markdown); inside a kept block a `//: ` / `#: ` line is uncommented — that is how this site carries code it does not run itself. Flags: src/modules/starter/answers.ts (flagsFromAnswers).", + "$comment": "How `iapl create` turns this reference site into a new project (docs/project-starter.md). reference/ is the only hand-edited tree; the starter keeps no template files of its own. Paths are relative to reference/. Roles: drop = left out; generate = written by the starter from the owner's answers; template = copied with the placeholders below replaced; keep = copied as is (and must hold no fake value). variants = whole files that exist only with a flag on. In-file variants: `// @starter:if <flag>` … `// @starter:else` … `// @starter:endif` ({/* */} in TSX, # in env files, <!-- --> in Markdown); inside a kept block a `//: ` / `#: ` line is uncommented — that is how this site carries code it does not run itself. Flags: src/modules/starter/answers.ts (flagsFromAnswers).", "schema": 1, "placeholders": { "{{domain}}": "example-studio.pl", @@ -32,7 +32,7 @@ ], "generate": [ "DESIGN.md", - "ipal-doctor.json", + "iapl-doctor.json", "src/design/tokens.ts", "src/i18n.config.ts" ], diff --git a/scripts/starter-gate.mjs b/scripts/starter-gate.mjs index 1fe7ac8..9608630 100644 --- a/scripts/starter-gate.mjs +++ b/scripts/starter-gate.mjs @@ -60,7 +60,7 @@ function fullSeedRefused(site, env, tries = 3) { const output = `${run.stdout ?? ''}${run.stderr ?? ''}` process.stdout.write(output) if (/full seed refused/.test(output)) {return run.status !== 0} - if (/\[ipal\] Plugin initialized/.test(output)) { + if (/\[iapl\] Plugin initialized/.test(output)) { log(`Payload initialized but the seed was not refused (exit ${run.status})`) return false } @@ -128,7 +128,7 @@ async function main() { check('iapl create (install, skills, tokens, types, import map, typecheck, secret check, first commit)', created === 0, `${((Date.now() - started) / 1000).toFixed(0)} s`) const site = join(work, 'release-checkexample-web') // the site was made by THIS tarball: the bundle hash and commit the generator recorded, and the plugin it installed - const made = JSON.parse(readFileSync(join(site, '.ipal', 'starter.json'), 'utf8')) + const made = JSON.parse(readFileSync(join(site, '.iapl', 'starter.json'), 'utf8')) check('generated by this tarball (bundle sha256, plugin version)', made.source?.bundleSha256 === bundleSha256 && made.iapl === version, `${bundleSha256.slice(0, 12)} · ${version}`) check('bundle built from this commit', (made.source?.commit ?? '').replace(/-dirty$/, '') === commit, made.source?.commit ?? 'none') const installed = join(site, 'node_modules', '@intecion', 'IAPL') diff --git a/src/modules/doctor/rules/tooling.ts b/src/modules/doctor/rules/tooling.ts index 2d62bd6..26f7d92 100644 --- a/src/modules/doctor/rules/tooling.ts +++ b/src/modules/doctor/rules/tooling.ts @@ -39,6 +39,10 @@ export const AUDIT_RULE_MAP: Array<[RegExp, string]> = [ [/^hardcoded text in (blocks|components\/layout)$|^hardcoded Polish text in code$/, 'i18n-literals'], [/^hex colors in (classes|inline styles)$|^design-token standard not wired$|^iapl-tokens --check$/, 'blocks-tokens'], [/^own block renderer switch$/, 'blocks-registry'], + // Titles that named the plugin before 1.17.0: the rule ids stay what they were, so a setting in a project's doctor file still matches. + [/^iapl-tokens not installed$/, 'audit:ipal-tokens-not-installed'], + [/^missing: forms in iapl$/, 'audit:missing-forms-in-ipalkit'], + [/^missing: IAPL_IP_HEADER in \.env\.example$/, 'audit:missing-ipal-ip-header-in-env-example'], ] /** Rules the doctor already reports itself — the audit copy is dropped instead of reported twice. */ diff --git a/test/docsConsistency.test.ts b/test/docsConsistency.test.ts index 54ce7da..13bb2f4 100644 --- a/test/docsConsistency.test.ts +++ b/test/docsConsistency.test.ts @@ -133,8 +133,10 @@ describe('docs ↔ code', () => { // The plugin, or a script/template shipped in the skills (e.g. IAPL_SEED_ALLOW_PROD_UPDATE). const shipped = docs.filter((f) => f.startsWith('docs/agent/skills/') && /\.(?:mjs|ts|tsx)$/.test(f)) const code = [...srcFiles(), ...shipped].map(read).join('\n') - const named = new Set([...docs, 'README.md'].flatMap((f) => [...read(f).matchAll(/\bIPAL_[A-Z0-9_]+/g)].map((m) => m[0]))) - expect([...named].filter((name) => !code.includes(name))).toEqual([]) + // docs/dev/rename-iapl-plan.md is the rename's inventory: it also lists the repository's own test variables. + const named = new Set([...docs, 'README.md'].filter((f) => f !== 'docs/dev/rename-iapl-plan.md').flatMap((f) => [...read(f).matchAll(/\bI(?:AP|PA)L_[A-Z0-9_]+/g)].map((m) => m[0]))) + // IPAL_<NAME> (the spelling before 1.17.0) is read through its IAPL_<NAME> twin: src/modules/shared/envName.ts + expect([...named].filter((name) => !code.includes(name.replace(/^IPAL_/, 'IAPL_')))).toEqual([]) }) test('relative links between docs point at existing files', () => {