Docs: reconcile agent, developer and module docs with the code
- AGENT.md, skills, PROGRAMISTA, vibe, README and module pages checked against src/ and package.json; every mismatch fixed (consent/analytics loading, revalidation scope, generateStaticParams, construction gating, Turnstile fail modes, email/Graph, MCP, i18n, links, slug, hooks, ...) - New pages: frontend.md, media.md, integrations.md; docs/README.md now indexes every page - Main rule (plugin helps, never limits) at the top of AGENT.md, PROGRAMISTA.md, docs/README.md, README and the setup/plugin-gap skills; module pages gain a "Wyłączenie, nadpisanie, rozszerzenie" section - README/PROGRAMISTA: stop telling projects to install packages ipal-kit already depends on; peer table; publish flow matches prepublishOnly - ipal-skills: refuse --dest without a value or pointing at the project root (previously could delete ipal-* folders in cwd) - docsConsistency: option keys, IPAL_* env names, relative links, README index, AGENT.md section refs, skill frontmatter, frontend.md helper keys, no `pnpm add` of own dependencies Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
12fbd424a5
commit
6e0f59c62b
+27
-8
@@ -20,11 +20,12 @@ fields: [
|
||||
| Opcja | Domyślnie | Co robi |
|
||||
|---|---|---|
|
||||
| `name` | `'link'` / `'links'` | nazwa pola |
|
||||
| `relationTo` | `'pages'` | kolekcja dla typu „Page” |
|
||||
| `relationTo` | `'pages'` | kolekcja dla typu „Page”; tablica = relacja polimorficzna (niżej) |
|
||||
| `uploadTo` | `'media'` | kolekcja dla typu „File” (PDF, dokumenty) |
|
||||
| `appearances` | `['primary','secondary','link']` | style do wyboru — **dowolne nazwy projektu**, np. `['primary', { label: 'Highlighted', value: 'highlight' }]` (menu z wyróżnioną pozycją, przycisk w kolorze marki); `false` = bez pola |
|
||||
| `disableLabel` | `false` | bez etykiety (link owija kartę / obraz) — tylko `buildLinkField` |
|
||||
| `required` | `false` | wymagane pola celu i etykiety |
|
||||
| `interfaceName` | `CmsLink` / `CmsLinkPlain` / `CmsLinkNoLabel` / `CmsLinkPlainNoLabel` | nazwa typu w `payload-types.ts` |
|
||||
| `maxRows` | `2` | tylko `buildLinksField` |
|
||||
| `labels` | `{ singular: 'Button', plural: 'Buttons' }` | tylko `buildLinksField` — panel: „Add Button”; lista linków: `{ singular: 'Link', plural: 'Links' }` |
|
||||
|
||||
@@ -45,12 +46,12 @@ import { rowLabel } from '@intecion/ipal-kit'
|
||||
fields: [/* … */],
|
||||
}
|
||||
```
|
||||
`rowLabel(fields, fallback)` — ścieżki w wierszu (np. `'heading'`, `['name', 'link.label']`),
|
||||
pierwsza niepusta wygrywa (relacja/upload → `title`/`name`/`alt`/`filename`); wszystkie
|
||||
puste → „Feature 02”. Komponent: `@intecion/ipal-kit/admin#RowLabel`. Zasady panelu: AGENT.md §6.5a.
|
||||
`rowLabel(fields, fallback = 'Item')` — ścieżki w wierszu (np. `'heading'`, `['name', 'link.label']`),
|
||||
pierwsza niepusta wygrywa (relacja/upload → `title`/`name`/`label`/`alt`/`filename`); wszystkie
|
||||
puste → „Feature 02” (`{fallback} {numer}`). Komponent: `@intecion/ipal-kit/admin#RowLabel`. Zasady panelu: AGENT.md §6.5a.
|
||||
|
||||
Wartość linku: `type` (`internal` strona · `external` URL, `mailto:`, `tel:`,
|
||||
`#anchor` · `file` upload), `page`, `url`, `file`, `label` (localized), `newTab`,
|
||||
Wartość linku: `type` (`internal` strona — domyślnie · `external` URL `https://`/`http://`, `mailto:`, `tel:`,
|
||||
`#anchor` — walidowane w panelu · `file` upload), `page`, `url`, `file`, `label` (localized), `newTab`,
|
||||
`appearance`. W `payload-types.ts` powstaje typ **`CmsLink`**; link bez stylu (`appearances: false`)
|
||||
ma typ `CmsLinkPlain`, bez etykiety (`disableLabel`) — `CmsLinkNoLabel`, oba naraz — `CmsLinkPlainNoLabel`
|
||||
(od 1.11.1; wcześniej wszystkie nazywały się `CmsLink` i typ zależał od kolejności pól). Każdy z nich
|
||||
@@ -65,7 +66,9 @@ Strona, kategoria, produkt — jedno pole: `buildLinkField({ relationTo: ['pages
|
||||
`/{locale}/{strona-archiwum}/{wpis}` — `resolveLink` / `resolveNav` / `getLinkOptions` z `lib/content`
|
||||
same biorą archiwa z Site Settings (`archives: { categories: 'kategorie' }`). Bez lib/content:
|
||||
`resolveLinkHref(link, { config, locale, archives, pagesSlug })`. Wpis bez przypisanego archiwum → `null`
|
||||
(link się nie renderuje). Zmiana `relationTo` na tablicę zmienia kształt danych (`page` → `{ relationTo, value }`):
|
||||
(link się nie renderuje). Ścieżka wpisu powstaje z `buildEntryPath`, który **zawsze**
|
||||
dokłada `/{locale}` — na stronie jednojęzycznej link do wpisu dostaje zbędny prefiks `/pl/…`
|
||||
(`src/modules/links/resolveLinkHref.ts` ~94). Zmiana `relationTo` na tablicę zmienia kształt danych (`page` → `{ relationTo, value }`):
|
||||
istniejące linki trzeba przenieść (ipal-migrate-fields).
|
||||
|
||||
## href
|
||||
@@ -75,9 +78,14 @@ import { resolveLinkHref } from '@intecion/ipal-kit'
|
||||
|
||||
resolveLinkHref(link, { locale, config: i18nConfig, homeSlug })
|
||||
// internal → '/en/about' (strona główna → '/en') · external → URL · file → URL pliku
|
||||
// null → pusty link, brak strony w tym języku, strona niezpopulowana (sam ID), brak pliku
|
||||
// null → pusty link, brak strony w tym języku, strona niezpopulowana (sam ID), brak pliku,
|
||||
// URL spoza https?:// mailto: tel: sms: # / (np. javascript:) — safeHref
|
||||
```
|
||||
|
||||
Opcje: `locale`, `config` (wymagane), `homeSlug`, `pagesSlug` (`'pages'`), `archives`
|
||||
(`{ kolekcja: slugArchiwum }`). `safeHref(url)` jest eksportowany osobno (filtr URL-i).
|
||||
URL pliku (`file.url`) nie przechodzi przez `safeHref`.
|
||||
|
||||
Linki wewnętrzne wymagają **zpopulowanej** strony (`depth ≥ 2` w bloku).
|
||||
`homeSlug` — slug strony głównej (string albo mapa per język, np. z
|
||||
`SiteSettings.homepage`), żeby zwinąć ją do `/{locale}`.
|
||||
@@ -126,6 +134,8 @@ nazwę i styl zniknie; `ipal-audit` zgłasza to jako ERROR.
|
||||
|
||||
## Linki prawne — `getSystemLinks`
|
||||
|
||||
Domyślne role: `privacyPolicy`, `cookiePolicy`, `termsOfService`.
|
||||
|
||||
```ts
|
||||
const legal = await getSystemLinks(locale) // z lib/content
|
||||
// [{ role: 'privacyPolicy', href: '/pl/polityka-prywatnosci', label: 'Polityka prywatności', internal, targetProps }, …]
|
||||
@@ -141,6 +151,7 @@ nie ma tekstów („Polityka prywatności” na sztywno psuje wersję EN). Niepr
|
||||
const items = await resolveNav(header.navItems, locale) // z lib/content
|
||||
// resolveNav(items, { locale, config: i18nConfig, homeSlug, linkField: 'link', childrenField: 'subItems' })
|
||||
// → NavItem[]: { href, label, internal, newTab, targetProps, appearance?, children: NavItem[] }
|
||||
// domyślnie linkField: 'link', childrenField: 'subItems'
|
||||
```
|
||||
Dowolna głębokość, kształt pozycji konfigurowalny (`linkField`, `childrenField`), pozycje z martwym
|
||||
linkiem albo bez etykiety pominięte (zamiast `href="#"`). Wynik to zwykłe dane — idzie wprost do
|
||||
@@ -162,3 +173,11 @@ bazy nie jest potrzebna**:
|
||||
3. usuń `src/fields/link.ts` i `src/lib/links.ts`, `pnpm generate:types`.
|
||||
4. `lib/navigation.ts` z własnym `resolveNav` → `resolveNav` z `lib/content` (te same dane +
|
||||
`internal`, `targetProps`; `subItems` nazywa się teraz `children`).
|
||||
|
||||
## Wyłączenie, nadpisanie, rozszerzenie
|
||||
|
||||
- Moduł nie ma opcji w `ipalKit()` — pola i resolvery używasz w swoich kolekcjach albo nie.
|
||||
- Pola: `name`, `relationTo` (string albo tablica), `uploadTo`, `appearances` (własne nazwy albo `false`), `disableLabel`, `required`, `interfaceName`; `buildLinksField` dodatkowo `maxRows`, `labels`.
|
||||
- Typy linku (`internal` / `external` / `file`) i dozwolone schematy URL są obecnie stałe; inny kształt pola mapujesz na `LinkValue` przed `resolveLink`.
|
||||
- Klocki do własnego renderu: `resolveLinkHref`, `resolveLink`, `resolveNav` (`linkField`, `childrenField`), `resolveSystemLinks` (`roles`), `homeSlugFrom`, `safeHref`.
|
||||
- Wygląd (`CMSLink`, warianty przycisków) jest zawsze po stronie projektu.
|
||||
|
||||
Reference in New Issue
Block a user