ipal-doctor proposal: block library rules

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 15:33:03 +01:00
co-authored by Claude Opus 5.5
parent 1a3a52a1be
commit 8cd9830a22
+14
View File
@@ -95,6 +95,20 @@ Source tags: **S** = static (files only, no network, no database), **R** = regis
| `i18n-literals` | error in blocks, warning in components | S | no literal UI text where the panel or i18n is expected — runs `ipal-audit`'s `jsx-text.mjs` and its Polish-literal check | move the text to a localized field |
| `audit` | as reported | S | `ipal-audit --quick` from the **installed package** (not the project's copy, which may be stale) — every `[ERROR]` / `[WARNING]` becomes a finding `audit:<title>` | the `ipal-audit` skill |
### 2.5a Block library (from the approved block-library design, `docs/dev/block-library-proposal.md` §5.1, §7.3, §10)
| Id | Sev | Src | Check | Fix hint |
|---|---|---|---|---|
| `blocks-registry` | error | S | `blocks/registry.ts` builds the registry with `createBlockRegistry(content, { ui, components, classNames, extra })` or renders through `RenderBlocks`; no hand-written `switch (blockType)` | blocks.md → Block library |
| `blocks-ui-required` | error | S | without `createBlockRegistry`, `components/ui/` holds the five primitives (Section, SectionHeader, Media, CMSLink, Button); with it, `ui/` is optional | the `ipal-block` skill |
| `blocks-ui-override` | warning | S | every file in `components/ui/` named like a library primitive (Section, SectionHeader, Media, CMSLink, Button, Container, Card) is passed through the registry's `ui` option. Otherwise the library blocks keep the plugin's version and the two looks drift apart | `createBlockRegistry(content, { ui: { Button } })` |
| `blocks-duplicate` | warning | S | a project block whose folder or slug matches a library block (or a variant of one) and is not a declared override or eject | use the library block + variant, or record the eject in "Project decisions" |
| `blocks-helper-copy` | warning | S | no local copies of plugin helpers (`buildItemsField`, `buildActionButtonsField`, `ctaHref`, and the other exported field builders) | import from the plugin |
| `blocks-tokens` | error | S | classes use design tokens only (no hex, no arbitrary colours) — the `ipal-audit` hex rule, extended by the design-token track's names | DESIGN.md / tokens |
The list of library blocks and primitives is read from the installed plugin (an exported manifest), not
hard-coded in the doctor, so a new library block needs no doctor change.
### 2.6 Live checks (`--url`)
`--url` adds the **L** rules above plus: