From 465c5706f8086773d37e60cd3c289fdd44c9e15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Smoli=C5=84ski?= Date: Thu, 22 Oct 2026 17:19:50 +0200 Subject: [PATCH] Agent guide: complete plugin coverage, full ipal-setup, pointer block - New skill ipal-reference: every ipalKit option (incl. nested keys) with default and how to turn it off/override it, what the plugin injects (collections, globals, endpoints, import-map components), every file the project wires with a minimal example and a check, every env var; resources/api.md indexes all 432 exports with import path and purpose - ipal-setup rewritten as a complete start-to-finish install: steps, code, verification and off/override per stage - ipal-skills writes a marked pointer block into AGENTS.md (creates it if missing) and CLAUDE.md (or creates CLAUDE.md with @AGENTS.md); only the marked block is ever rewritten; --no-pointer skips. tsconfig exclude check now matches whole entries - AGENT.md, PROGRAMISTA, README, docs index: point at ipal-reference and run `pnpm exec ipal-skills` right after install - docsConsistency: the agent guide must mention every export (runtime and types), every plugin option incl. nested keys, every env var the code reads and every @/lib/content helper Co-Authored-By: Claude Opus 5.5 --- README.md | 12 + bin/ipal-skills.mjs | 56 +- docs/README.md | 2 +- docs/agent/AGENT.md | 27 +- docs/agent/skills/ipal-reference/SKILL.md | 192 ++++++ .../skills/ipal-reference/resources/api.md | 576 ++++++++++++++++++ docs/agent/skills/ipal-setup/SKILL.md | 518 ++++++++++++++-- docs/dev/PROGRAMISTA.md | 8 +- docs/dev/vibe.md | 2 +- docs/hooks.md | 6 +- test/docsConsistency.test.ts | 63 ++ 11 files changed, 1390 insertions(+), 72 deletions(-) create mode 100644 docs/agent/skills/ipal-reference/SKILL.md create mode 100644 docs/agent/skills/ipal-reference/resources/api.md diff --git a/README.md b/README.md index cd38d57..4650c46 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,18 @@ placeholders also use the `sharp` you pass to `buildConfig({ sharp })` > uses `lucide-react` at another version (e.g. `0.5xx` or `1.x`), you end up with two > copies and confusing type errors. Pin your project to `~0.400.0` too. +**Working with an AI agent?** Run this right after installing (and after every upgrade): + +```bash +pnpm exec ipal-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 +the markers is ever rewritten. `--no-pointer` skips that step. There is no `postinstall` script. + From here, the guide takes over: **[docs/dev/PROGRAMISTA.md](./docs/dev/PROGRAMISTA.md)** — from an empty project to a working site. diff --git a/bin/ipal-skills.mjs b/bin/ipal-skills.mjs index 3e9155b..9ad2a4d 100755 --- a/bin/ipal-skills.mjs +++ b/bin/ipal-skills.mjs @@ -3,19 +3,23 @@ // pnpm ipal-skills → ./.agents/skills/ipal-* // pnpm ipal-skills --dry-run → show what would change // pnpm ipal-skills --dest .claude/skills +// pnpm ipal-skills --no-pointer → skills only, leave AGENTS.md / CLAUDE.md alone // Only folders named ipal-* are touched; the project's own skills stay as they are. // ipal-* folders that no longer exist in the package are removed (renamed/retired skills). +// AGENTS.md (and CLAUDE.md) get a marked ipal-kit block pointing at the guide — only the +// text between the markers is ever rewritten; the project's own content stays as it is. -import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync } from 'node:fs' +import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs' import { dirname, join, relative, resolve } from 'node:path' import { fileURLToPath } from 'node:url' const args = process.argv.slice(2) if (args.includes('--help') || args.includes('-h')) { - console.log('Usage: ipal-skills [--dest ] [--dry-run]\nDefault dest: .agents/skills') + console.log('Usage: ipal-skills [--dest ] [--dry-run] [--no-pointer]\nDefault dest: .agents/skills') process.exit(0) } const dryRun = args.includes('--dry-run') +const pointer = !args.includes('--no-pointer') const destArg = args.indexOf('--dest') const destValue = destArg >= 0 ? args[destArg + 1] : '.agents/skills' // A missing value would resolve to cwd and remove every ipal-* folder there. @@ -56,6 +60,51 @@ for (const name of retired) { } console.log(`${dryRun ? '[dry-run] ' : ''}${shipped.length} skill(s) → ${dest}`) +// Pointer block: an agent opening the project must find the guide without being told. +// AGENTS.md is read by Codex/Cursor/Antigravity, CLAUDE.md by Claude Code (which also +// follows `@AGENTS.md` imports, so a CLAUDE.md that imports AGENTS.md needs no copy). +if (pointer) { + const START = '' + const END = '' + const version = JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8')).version + const skillsDir = relative(process.cwd(), dest).split('\\').join('/') + const block = [ + START, + `## ipal-kit ${version} — przewodnik dla agenta`, + '', + '', + 'Ten projekt stoi na `@intecion/ipal-kit` (plugin Payload CMS 3). Zanim napiszesz kod:', + '', + '1. Reguły: `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md`.', + `2. Wszystko, co daje plugin (opcje, env, trasy, layout, hooki, kolekcje, globale, każdy eksport): skill \`ipal-reference\` — \`${skillsDir}/ipal-reference/SKILL.md\`.`, + `3. Nowy projekt albo brak fundamentu: skill \`ipal-setup\`; cała strona: \`ipal-site\`. Lista skilli: \`${skillsDir}/\`.`, + '4. Szczegóły modułu: `node_modules/@intecion/ipal-kit/docs/.md`.', + '5. Funkcja istnieje w pluginie → użyj jej. Brakuje opcji → skill `ipal-plugin-gap`, nigdy łatka w `node_modules`.', + END, + ].join('\n') + const upsert = (file, { create }) => { + const path = join(process.cwd(), file) + const text = existsSync(path) ? readFileSync(path, 'utf8') : null + let next + if (text === null) { + if (!create) return + next = create === 'import' ? '@AGENTS.md\n' : `# ${file.replace('.md', '')}\n\n${block}\n` + } else if (text.includes(START) && text.includes(END)) { + next = text.slice(0, text.indexOf(START)) + block + text.slice(text.indexOf(END) + END.length) + } else { + next = `${text.replace(/\s*$/, '')}\n\n${block}\n` + } + if (next === text) return console.log(`ok ${file}`) + console.log(`${text === null ? 'create' : 'update'} ${file}`) + if (!dryRun) writeFileSync(path, next) + } + upsert('AGENTS.md', { create: 'block' }) + const claude = join(process.cwd(), 'CLAUDE.md') + const importsAgents = existsSync(claude) && /^@AGENTS\.md\s*$/m.test(readFileSync(claude, 'utf8')) + // CLAUDE.md that imports AGENTS.md already sees the block — don't duplicate it. + if (!importsAgents) upsert('CLAUDE.md', { create: 'import' }) +} + // Skills ship .ts/.tsx templates and scripts. A Next tsconfig ("include": ["**/*.tsx"]) would // type-check them as project code and break `tsc` / `next build` → they must be excluded. const tsconfig = join(process.cwd(), 'tsconfig.json') @@ -63,7 +112,8 @@ const top = relative(process.cwd(), dest).split(/[\\/]/)[0] if (existsSync(tsconfig) && top && !top.startsWith('..')) { const text = readFileSync(tsconfig, 'utf8') const exclude = text.match(/"exclude"\s*:\s*\[([^\]]*)\]/)?.[1] ?? '' - if (!exclude.includes(top)) { + const entries = [...exclude.matchAll(/"([^"]*)"/g)].map((m) => m[1].replace(/^\.\//, '').replace(/\/(\*\*)?$/, '')) + if (!entries.includes(top)) { console.warn(`\n⚠ tsconfig.json does not exclude "${top}" — skill templates would be type-checked and break the build.`) console.warn(` Add it: "exclude": ["node_modules", "${top}"]`) process.exitCode = 1 diff --git a/docs/README.md b/docs/README.md index 025dd1b..8e26e5a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,7 +9,7 @@ modułu ma sekcję „Wyłączenie, nadpisanie, rozszerzenie” — opisuje stan | Kim jesteś | Czytaj | |---|---| | **Agent AI** pracujący w projekcie | [AGENT.md](./agent/AGENT.md) — reguły, struktura, budowa sekcji, kontrole przed „gotowe” | -| **Agent AI — skille** | [agent/skills/](./agent/skills) — 14 skilli `ipal-*` dla Antigravity/Claude Code, w tym `ipal-site` (strona od briefu do raportu) i skrypty kontrolne (kopiowane do projektu: `pnpm exec ipal-skills`, AGENT.md §14) | +| **Agent AI — skille** | [agent/skills/](./agent/skills) — 15 skilli `ipal-*` dla Antigravity/Claude Code, w tym `ipal-reference` (pełna mapa pluginu i każdy eksport), `ipal-setup` (kompletna instalacja), `ipal-site` (strona od briefu do raportu) i skrypty kontrolne (kopiowane do projektu: `pnpm exec ipal-skills`, AGENT.md §14) | | **Programista** | [PROGRAMISTA.md](./dev/PROGRAMISTA.md) — instalacja, nowy projekt, env, wdrożenie, aktualizacja, publikacja pluginu, Gitea; wdrożenie i health check: [deployment.md](./deployment.md) | | **Osoba prowadząca agenta AI** | [vibe.md](./dev/vibe.md) — tryb autonomiczny (`/ipal-site`) i gotowe polecenia krok po kroku | diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index d4b8999..0fab635 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -9,8 +9,13 @@ > **W projekcie:** > - w roocie krótki `AGENTS.md` (szablon w §13), który wskazuje na ten plik w > `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` — nie kopiuj reguł, kopia się zestarzeje; +> (`pnpm exec ipal-skills` dopisuje/odświeża w nim blok `ipal-kit:start…end` z tym wskaźnikiem); > - skille w `.agents/skills/` (§14) — kopiowane z pakietu jedną komendą, odświeżane -> po każdej aktualizacji ipal-kit. +> po każdej aktualizacji ipal-kit; +> - **pełna mapa pluginu** — każda opcja, zmienna env, trasa, komponent layoutu, wpis +> import mapy, hook, kolekcja, global i każdy eksport: skill **`ipal-reference`** +> (`.agents/skills/ipal-reference/SKILL.md` + `resources/api.md`). Zanim napiszesz +> cokolwiek „od zera”, sprawdź tam. --- @@ -1066,7 +1071,12 @@ Cokolwiek wymaga dewelopera → przenieś do panelu. | Nagłówki, CSP, 2FA, ścieżka panelu | [security.md](../security.md) | | SEO, metadata, sitemap, JSON-LD, llms.txt | [seo.md](../seo.md) | | Auto-slug | [slug.md](../slug.md) | -| Media, R2 | [storage.md](../storage.md) | +| Media: kolekcja, nazwy plików, optymalizacja, placeholdery | [media.md](../media.md) | +| R2, `buildImagesConfig`, YouTube | [storage.md](../storage.md) | +| Front: `createContentHelpers` (`@/lib/content`), `createPageRoute`, `SiteProviders` | [frontend.md](../frontend.md) | +| Integracje (global `site-integrations`, statusy, test e-maila) | [integrations.md](../integrations.md) | +| Wdrożenie, env produkcyjne, health check | [deployment.md](../deployment.md) | +| Meta Pixel / GA4 przez GTM | [gtm-meta-pixel.md](../gtm-meta-pixel.md) | | Turnstile | [turnstile.md](../turnstile.md) | | White-label panelu | [white-label.md](../white-label.md) | @@ -1098,7 +1108,10 @@ ipal-kit pomaga, nie ogranicza: najpierw opcja / eksportowany builder pluginu; b ``` **Claude Code** czyta `CLAUDE.md`, nie `AGENTS.md` — dodaj w roocie `CLAUDE.md` z jedną -linią `@AGENTS.md` (import), zamiast kopiować treść. +linią `@AGENTS.md` (import), zamiast kopiować treść. `pnpm exec ipal-skills` robi to sam: +dopisuje do `AGENTS.md` blok `…` (wskaźnik na +AGENT.md, `ipal-reference`, `ipal-setup`), a brakujący `CLAUDE.md` tworzy z `@AGENTS.md`. +Przy każdym uruchomieniu podmienia tylko tekst między znacznikami — własnej treści nie rusza. --- @@ -1111,7 +1124,8 @@ zadanie pasuje — ręcznie: `/`. | Skill | Kiedy | |---|---| | `ipal-site` | **cała strona od briefu do raportu** — prowadzi przez pozostałe skille (§0a) | -| `ipal-setup` | nowy projekt od zera (fundament) | +| `ipal-reference` | **pełna mapa pluginu**: opcje `ipalKit`, env, trasy, proxy, layout, import mapa, hooki, kolekcje, globale + `resources/api.md` (każdy eksport) — zanim napiszesz coś sam | +| `ipal-setup` | nowy projekt od zera (fundament) — kompletna instalacja etap po etapie | | `ipal-block` | nowa albo poprawiana sekcja (blok) — schemat, panel (§6.5a), komponent | | `ipal-collection` | „potrzebny blog / produkty / …” — zanim powstanie plik w `src/collections` | | `ipal-nav` | nagłówek, menu, stopka, dane firmy | @@ -1135,7 +1149,12 @@ komenda (`bin`) pakietu: pnpm exec ipal-skills # → .agents/skills/ipal-* pnpm exec ipal-skills --dry-run # tylko pokaż, co się zmieni pnpm exec ipal-skills --dest .claude/skills # Claude Code szuka skilli w .claude/skills +pnpm exec ipal-skills --no-pointer # same skille, bez ruszania AGENTS.md / CLAUDE.md ``` +Oprócz skilli komenda utrzymuje wskaźnik do przewodnika: blok `ipal-kit:start…end` w +`AGENTS.md` (tworzy plik, gdy go brak) i w `CLAUDE.md` (gdy brak — tworzy `CLAUDE.md` +z `@AGENTS.md`; gdy `CLAUDE.md` już importuje `@AGENTS.md` — nie dubluje). Uruchom ją +**zaraz po `pnpm add @intecion/ipal-kit`** — plugin nie ma skryptu `postinstall`. Kopiuje tylko foldery `ipal-*`: dodaje nowe, podmienia istniejące w całości, usuwa wycofane. Własne skille projektu nazywaj **bez** prefiksu `ipal-` — zostaną nietknięte. `--dest` musi być podkatalogiem projektu. Commituj skopiowane `ipal-*` do repo projektu. diff --git a/docs/agent/skills/ipal-reference/SKILL.md b/docs/agent/skills/ipal-reference/SKILL.md new file mode 100644 index 0000000..1911408 --- /dev/null +++ b/docs/agent/skills/ipal-reference/SKILL.md @@ -0,0 +1,192 @@ +--- +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". +--- + +# ipal-reference + +## Jak używać +- **Najpierw tutaj**, potem kod. Szukasz funkcji → `grep -n "" resources/api.md` + (`resources/api.md` — każdy eksport: import, do czego). Opis modułu: + `node_modules/@intecion/ipal-kit/docs/.md` (kolumna „szczegóły”). +- **Plugin pomaga, nie ogranicza:** każdy moduł da się wyłączyć, każdy domyślny element nadpisać, + config projektu wygrywa, klocki (`build*`, `create*`) są eksportowane — złożysz z nich własną wersję. +- Brak opcji / zachowanie niezgodne z docs → skill **ipal-plugin-gap** (raport). Nigdy nie łataj `node_modules`. +- Stan opisany wg kodu 1.12.x. „obecnie zawsze” = nie ma dziś opcji wyłączenia (luka → ipal-plugin-gap). + +## 1. Opcje `ipalKit({...})` (`IpalOptions`, `dist/types.d.ts`) + +| opcja | domyślnie | co dodaje / zmienia | jak wyłączyć / nadpisać | +|---|---|---|---| +| `i18n` **(wymagane)** | — | `config.localization` (zawsze nadpisywane); walidacja od razu przy `ipalKit()` (rzuca przy złym configu) | jedno źródło: `src/i18n.config.ts`; własne `localization` w configu i tak zostanie nadpisane | +| `i18n.defaultLocale` | — | `localization.defaultLocale`, przekierowanie `/` w proxy | musi być w `locales` | +| `i18n.fallback` | `true` | `localization.fallback` | `false` | +| `i18n.locales[]` `{ code, label, rtl? }` | — | lista języków (min. 1); `rtl: true` → `rtl` w Payload | dodanie języka: skill **ipal-locale-add** | +| `access` | brak | pole `roles` (`user` < `editor` < `admin`, `saveToJWT`) w kolekcji auth | pomiń → **brak ról**: nikt nie jest adminem dla Site Integrations, test e-maila, statystyk, consent-records; `form-submissions` czyta tylko editor+ | +| `access.authCollection` | — (wymagane w `access`) | kolekcja, do której trafia `roles`; też slug wstrzykiwanej kolekcji auth | własna kolekcja o tym slugu wygrywa | +| `access.defaultRole` | `'user'` | `defaultValue` pola `roles` | `'editor'` / `'admin'` | +| `adminRoute` | `'/admin'` | `config.routes.admin`; link i widoki statystyk, `IntegrationAlerts` | projekt sam przenosi `app/(payload)//` i wpisuje route w matcher proxy (security.md) | +| `twoFactor` | **brak = błąd** | `@clocklimited/payload-2fa` z `forceSetup: true` (TOTP wymuszone, sprawdzane też w API) | `twoFactor: false` (odradzane); pominięcie opcji rzuca `[ipal] twoFactor.issuer is required` | +| `twoFactor.issuer` | — (wymagane) | nazwa w aplikacji uwierzytelniającej | — | +| `twoFactor.plugin` | — (wymagane) | wstrzyknięty `payloadTotp` (plugin nie importuje peera) | brak funkcji → rzuca | +| `twoFactor.collectionSlug` | `'users'` | kolekcja z 2FA | **nie** bierze `access.authCollection` — przy innym slugu podaj oba | +| `whiteLabel` | brak | `admin.components.graphics.Logo/Icon` (`AdminLogo`/`AdminIcon`) z Site Settings + kredyt dostawcy | pomiń / `false`; `true` = domyślne | +| `whiteLabel.settingsSlug` | `'site-settings'` | global, z którego czyta logo/nazwę | — | +| `whiteLabel.logoField` / `iconField` / `nameField` | `'logo'` / `'favicon'` / `'siteName'` | pola w Site Settings | dowolne pole upload/tekst | +| `whiteLabel.titleSuffix` | brak | `admin.meta.titleSuffix` (tytuł karty) | — | +| `whiteLabel.credit` | wł. | `IntecionCredit` w `afterLogin` i `afterNavLinks` | `false`; `{ text, url }` nadpisuje | +| `pages` | brak | Site Settings → zakładki **System Pages** (role stron) i **Under construction** | pomiń → brak obu zakładek | +| `pages.slug` | — (wymagane w `pages`) | kolekcja stron projektu (relacje System Pages, construction, IndexNow) | — | +| `pages.roles` | wszystkie: `homepage`, `notFound`, `privacyPolicy`, `cookiePolicy`, `termsOfService` | które przypisania pokazać | podzbiór tablicy | +| `content` | brak | pole `Archive` w System Pages per kolekcja (URL wpisów = slug strony archiwum) | **bez `pages` ignorowane** (brak pól archiwum; IndexNow nadal działa) | +| `content.collections[]` `{ slug, label?, perPage? }` | `label` = slug, `perPage` 10 | wpis do archiwum; ta sama wartość idzie do `createContentHelpers({ content })` | kolekcję tworzy projekt (skill **ipal-collection**) | +| `seo` | brak | `@payloadcms/plugin-seo` (grupa `meta` + `titleOverride`), zakładki Content/SEO, hook auto-fill | pomiń | +| `seo.collections` | — (wymagane) | kolekcje z `meta` | — | +| `seo.autoFill` | `{ title: 'title', content: 'layout', descriptionLength: 155 }` | `beforeChange`: pusty `meta.title/description` z pól dokumentu | `false`; obiekt `{ title, description, content, descriptionLength }` | +| `seo.descriptionCheck` | wł. (`settingsSlug: 'site-settings'`, `siteDescriptionField: 'siteDescription'`) | pole UI `MetaDescriptionCheck` pod opisem (pusty / powtórzony) | `false`; obiekt nadpisuje slug/pole | +| `seo.fields` | `[]` | dodatkowe pola w grupie SEO | — | +| `seo.generateTitle` / `generateDescription` | plugin-seo | podgląd / generowanie w panelu | własna funkcja `({ doc }) => string` | +| — (brak opcji) | `uploadsCollection: 'media'` | obraz meta z kolekcji `media` | obecnie zawsze `media` (luka) | +| `forms` | brak | `@payloadcms/plugin-form-builder`: kolekcje `forms`, `form-submissions` | pomiń | +| `forms.adminGroup` | `'Forms'` | grupa w sidebarze | `false` = domyślna Payloada; `admin.group` w overrides wygrywa | +| `forms.fields.*` | wł.: `checkbox`, `checkboxGroup`, `country`, `date`, `email`, `message`, `number`, `radio`, `select`, `state`, `step`, `text`, `textarea`, `time`; wył.: `payment` | typy bloków w kreatorze (wszystkie z „Show only when”) | `: false`; obiekt bloku podmienia; `payment: true` **nic nie robi** (przefiltrowane) — podaj obiekt bloku | +| `forms.formOverrides` | etykiety Form/Forms, `emails` czytelne tylko dla zalogowanych | nadpisanie kolekcji `forms` (`fields: ({ defaultFields }) => …`, `slug`, `admin`, `access`…) | dowolny `CollectionConfig` | +| `forms.formSubmissionOverrides` | create: zalogowani, read: editor+, delete: admin | nadpisanie `form-submissions` | `access.create` itd. wygrywa | +| `forms.redirectRelationships` | brak | kolekcje, do których formularz przekierowuje | `['pages']` | +| `forms.emailLayout` | `false` | `beforeEmail` z layoutem (logo, kolor, stopka) + zakładka Site Settings → **Emails**; `{{*:table}}` czytelne | `true` | +| `forms.beforeEmail` | brak | własna modyfikacja maili (po layoucie) | funkcja form-buildera | +| `forms.consentFieldName` | (`'consent'`) | **obecnie nieużywane przez plugin** — nazwę pola zgody podajesz w `createSubmitAction({ consentFieldName })` / `submitForm` | — | +| `consentLog` | wył. | kolekcja `consent-records` + `POST /api/ipal/consent` (rate limit 20/min) | `true` / `{ retentionDays }` (domyślnie 1095) | +| `stats` | wył. | kolekcja `stats-visits`, `POST /api/ipal/hit`, widok `//stats`, link w nav, wykres na dashboardzie | `true` / obiekt | +| `stats.retentionDays` / `timeZone` / `dashboard` | 90 / `'Europe/Warsaw'` / `true` | czas przechowania, granica dnia, `StatsWidget` | `dashboard: false` chowa wykres | +| `indexNow` | `false` | hook `afterChange` (publikacja → IndexNow, tylko produkcja + https) w kolekcji `pages.slug ?? 'pages'` i każdej z `content` | `true` + trasa `indexnow-key.txt` | +| `siteSettingsFields` | brak | zakładka **Custom** w Site Settings | `Field[]` | +| `integrationsFields` | brak | zakładka **Custom** w Site Integrations | `Field[]` | +| `enabled` | `true` | `false` → plugin **zwraca config bez zmian**: znikają wstrzyknięte kolekcje, globale, endpointy, 2FA, role (dane w bazie zostają, panel ich nie widzi); `i18n` i tak walidowane | `false` | + +## 2. Co plugin wstrzykuje sam + +| element | co | kontroluje | wyłączenie dziś | +|---|---|---|---| +| kolekcja auth (`users`) | `{ slug, auth: true, useAsTitle: 'email' }`, gdy projekt jej nie ma (slug: `access.authCollection` → `twoFactor.collectionSlug` → `admin.user` → `'users'`) | własna kolekcja o tym slugu | własna wygrywa | +| `forms`, `form-submissions` | form-builder + ipal bloki `step`, `checkboxGroup`, `time` | `forms` | pomiń `forms` | +| `consent-records` | dowód zgody (id, wybory, wersja polityki) | `consentLog` | domyślnie wył. | +| `stats-visits` | wizyty bez IP (admin czyta/usuwa) | `stats` | domyślnie wył. | +| global `site-settings` | General, Theme, [System Pages], [Emails], [Under construction], [Custom]; publiczny odczyt | `pages`, `content`, `forms.emailLayout`, `siteSettingsFields` | **obecnie zawsze** | +| global `site-integrations` | Analytics, Turnstile, SMTP, IndexNow, [Custom]; tylko admin | `integrationsFields` | **obecnie zawsze** | +| global `cookie-settings` | teksty banera, kategorie, lista cookies | — | **obecnie zawsze** | +| global `notifications` | komunikaty formularzy per język | — | **obecnie zawsze** | +| `POST /api/ipal/test-email` | test SMTP/Graph (tylko admin) | — | **obecnie zawsze** | +| `POST /api/ipal/consent` | zapis zgody | `consentLog` | wył. domyślnie | +| `POST /api/ipal/hit` | odsłona do statystyk | `stats` | wył. domyślnie | +| `localization` | z `i18n` | `i18n` | **obecnie zawsze** | +| `routes.admin` | z `adminRoute` | `adminRoute` | — | +| hook `beforeChange` auto-fill meta | w `seo.collections` | `seo.autoFill` | `autoFill: false` | +| hook `afterChange` IndexNow | pages + content | `indexNow` | wył. domyślnie | +| `onInit` | migracja przycisku Cookie Settings + log `[ipal] Plugin initialized.` (Twój `onInit` leci pierwszy) | — | **obecnie zawsze** | + +**Import map** (`@intecion/ipal-kit/admin#…`) — po każdej zmianie opcji: `pnpm generate:importmap` +(`pnpm payload generate:importmap`), inaczej panel jest pusty / brak komponentu. + +| komponent | gdzie | warunek | +|---|---|---| +| `AdminLogo`, `AdminIcon` | `graphics.Logo/Icon` | `whiteLabel` | +| `IntecionCredit` | `afterLogin`, `afterNavLinks` | `whiteLabel` i `credit !== false` | +| `StatsNavLink`, `StatsView` (`views.ipalStats`, `/stats`), `StatsWidget` (`beforeDashboard`) | nav, widok, dashboard | `stats` (`dashboard: false` bez widgetu) | +| `IntegrationAlerts` | `beforeDashboard` | **obecnie zawsze** (nic nie renderuje, gdy wszystko działa) | +| `IntegrationStatusBanner` | pole UI w zakładkach Site Integrations | zawsze (z globalem) | +| `MaskedField` | sekrety SMTP / Turnstile | zawsze | +| `TestEmailButton` | Site Integrations → SMTP | zawsze | +| `MetaDescriptionCheck` | pod `meta.description` | `seo` i `descriptionCheck !== false` | +| `RowLabel` | etykiety wierszy array | tylko gdy projekt użyje `rowLabel(...)` (admin-ui) | + +## 3. Co projekt podpina sam + +Komplet obowiązkowy: AGENT.md §0b, skill **ipal-setup**; kontrola: **ipal-audit**, **ipal-seo-check**. +`$U` = `NEXT_PUBLIC_SERVER_URL` (np. `http://localhost:3000`). + +| element | plik | minimalny przykład | jak sprawdzić | szczegóły | +|---|---|---|---|---| +| 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 | +| języki | `src/i18n.config.ts` | `export const i18nConfig = { defaultLocale: 'pl', locales: [{ code: 'pl', label: 'Polski' }] } as const satisfies I18nConfig` | `curl -sI $U/` → 3xx na `/pl` | i18n.md | +| proxy | `src/proxy.ts` | `export const proxy = createProxy(i18nConfig, { NextResponse, markdown: true })` + `export const config = { matcher: ['/((?!api\|admin\|_next\|.*\\..*).*)'] }` (literał!) | `curl -sI $U/` → `/pl`; `curl -s -H 'Accept: text/markdown' $U/pl` → Markdown | i18n.md, PROGRAMISTA §2.6 | +| proxy (Next 15 / własny) | `middleware`/`proxy.ts` | `createLocaleMiddleware({ config, … })` (`/next/middleware` lub główny entry) | jw. | i18n.md | +| walidacja env | `src/instrumentation.ts` | `if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true, ipHeader: true }))` z `@intecion/ipal-kit/env` | usuń zmienną → start pada z listą braków | env.md | +| Next config | `next.config.ts` | `withPayload({ images: buildImagesConfig(), htmlLimitedBots: /Googlebot\|Bingbot…/i, headers: async () => [{ source: '/:path*', headers: buildSecurityHeaders({ hsts }) }, ...buildUploadSecurityHeaders()] })` | `curl -sI $U/pl \| grep -i 'x-content-type\|strict-transport'` | security.md, storage.md, PROGRAMISTA §2.9 | +| CSP | `next.config.ts` | `buildCsp({ mode: 'report-only', … })` → potem `enforce` | konsola przeglądarki bez naruszeń | security.md | +| dane / trasy | `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 | +| layout | `app/(frontend)/[locale]/layout.tsx` | `const shell = await getSiteShell(locale)`; `} theme stats>` | HTML: `