From 45a021fb533b9cc5f59b93e4b8dbd1cab0e00435 Mon Sep 17 00:00:00 2001 From: LeanAgent Date: Mon, 12 Oct 2026 16:15:16 +0000 Subject: [PATCH] =?UTF-8?q?chore:=20YAML-Schemas=20in=20Dateik=C3=B6pfe,?= =?UTF-8?q?=20tibi-types=20auf=204c55f82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - yaml-language-server-Schema direkt in jeder api-YAML statt .vscode/yaml.schemas-Mapping (exakter pro Datei, kein Glob-Rätsel) - erweiterte meta.agent-Doku in den Collections - tibi-types-Submodul auf 4c55f82 (meta.agent- + meta.query-Schemas) --- .vscode/settings.json | 11 ----------- api/collections/comment.yml | 1 + api/collections/content.yml | 5 +++-- api/collections/lib/imageFilter.yml | 1 + api/collections/medialib.yml | 7 ++++--- api/collections/navigation.yml | 5 +++-- api/collections/ssr.yml | 1 + api/collections/tag.yml | 1 + api/config.yml | 5 +++-- tibi-types | 2 +- 10 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 491297e..62c93e9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,17 +4,6 @@ "editor.formatOnSave": true, "editor.formatOnPaste": true, "editor.defaultFormatter": "esbenp.prettier-vscode", - "yaml.schemas": { - "./../../cms/tibi-types/schemas/config/project.schema.json": "api/config.y*ml", - // +([^/]) = nur Dateien direkt in api/collections/: der YAML-LS matcht mit - // picomatch { bash: true }, wo "*" auch "/" trifft und sonst fields/, - // fieldLists/ und lib/ fälschlich zusätzlich das Collection-Schema bekämen - "./../../cms/tibi-types/schemas/config/collection.schema.json": "api/collections/+([^/]).y*ml", - "./../../cms/tibi-types/schemas/config/field.schema.json": "api/collections/fields/*.y*ml", - "./../../cms/tibi-types/schemas/config/field-list.schema.json": "api/collections/fieldLists/*.y*ml", - "./../../cms/tibi-types/schemas/config/job.schema.json": "api/jobs/*.y*ml", - "./../../cms/tibi-types/schemas/config/asset.schema.json": "api/assets/*.y*ml" - }, "yaml.customTags": ["!include scalar"], "filewatcher.commands": [ { diff --git a/api/collections/comment.yml b/api/collections/comment.yml index ebd48fd..270f606 100644 --- a/api/collections/comment.yml +++ b/api/collections/comment.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../../tibi-types/schemas/config/collection.schema.json name: comment uploadPath: ../media/comment audit: diff --git a/api/collections/content.yml b/api/collections/content.yml index c9270ed..5e452ac 100644 --- a/api/collections/content.yml +++ b/api/collections/content.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../../tibi-types/schemas/config/collection.schema.json ######################################################################## # Content collection — CMS-managed pages with pagebuilder blocks ######################################################################## @@ -38,8 +39,8 @@ meta: translationKey: "required, e.g. home/ueber-uns/kontakt; unique per lang" blocks: "type selects visible fields via dependsOn $parent.type" examples: [{ name: "Startseite", path: "/", lang: "de", translationKey: "home", active: true }] - workflows: ["filter before create (path+lang) to stay idempotent; 409 means exists", "after PUT/DELETE verify /de and /api/content?lookup; SSR invalidates via clear_cache hooks"] - hints: ["richtext image only renders when _lookup.image.file.src exists", "hero fallback is gradient when no image"] + workflows: ["filter before create (path+lang) to stay idempotent; 409 means exists", "after PUT/DELETE verify /de and anonymous SSR HTML (window.__SSR_CACHE__: navigation count>0, heroImage/image with _lookup); PAT-only lookup success is NOT sufficient; SSR invalidates via clear_cache hooks"] + hints: ["richtext image only renders when _lookup.image.file.src exists", "hero fallback is gradient when no image", "images/nav invisible publicly until their medialib/navigation docs carry active:true (verified incident 2026-10-05)"] hooks: get: diff --git a/api/collections/lib/imageFilter.yml b/api/collections/lib/imageFilter.yml index dd1518f..e8bbbbb 100644 --- a/api/collections/lib/imageFilter.yml +++ b/api/collections/lib/imageFilter.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../../../tibi-types/schemas/config/image-filter.schema.json xs-webp: - width: 100 height: 100 diff --git a/api/collections/medialib.yml b/api/collections/medialib.yml index 80bec97..3f20e57 100644 --- a/api/collections/medialib.yml +++ b/api/collections/medialib.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../../tibi-types/schemas/config/collection.schema.json ######################################################################## # Media library — reusable uploaded assets referenced via foreignMedia ######################################################################## @@ -42,12 +43,12 @@ meta: file.type_like: ^(?!image/|video/|audio/).+ agent: purpose: "Reusable uploads referenced via foreignMedia (blocks.heroImage.image, blocks.image)." - instructions: "Upload file as object {src:'data:;base64,...', path:'name.jpg'} (path optional). Stored as {src:'/name.jpg', path, type}. Never {filename,data}, never file as plain string. Public read URL: /api/medialib// plus ?filter=l-webp for raster images. downscale max 2048px applies on upload." + instructions: "Upload file as object {src:'data:;base64,...', path:'name.jpg'} (path optional). Stored as {src:'/name.jpg', path, type}. Never {filename,data}, never file as plain string. Public read URL: /api/medialib// plus ?filter=l-webp for raster images. downscale max 2048px applies on upload. GOTCHA 2026-10-05: filter_public.js forces active:true on anonymous reads although this schema declares no active field – without stored active:true every medialib lookup stays unresolved publicly (plain IDs, no _lookup, HeroBlock renders gradient fallback and Richtext images vanish) although PAT reads succeed. Always store active:true on every medialib doc." fieldHints: file: "required, widget file, max 50MB" alt: "object {de,en}, used by MedialibImage for accessibility" - examples: [{ title: "Demo Hero 1200", file: { src: "data:image/jpeg;base64,...", path: "demo-hero-1200.jpg" } }] - hints: ["list with select excluding file.data to avoid context bloat", "verify file.src starts with / after create"] + examples: [{ title: "Demo Hero 1200", file: { src: "data:image/jpeg;base64,...", path: "demo-hero-1200.jpg" }, active: true }] + hints: ["list with select excluding file.data to avoid context bloat", "verify file.src starts with / after create", "missing active:true => public lookups unresolved (verified incident 2026-10-05)"] permissions: public: diff --git a/api/collections/navigation.yml b/api/collections/navigation.yml index 1a3d564..450c867 100644 --- a/api/collections/navigation.yml +++ b/api/collections/navigation.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../../tibi-types/schemas/config/collection.schema.json ######################################################################## # Navigation collection — header and footer navigation entries ######################################################################## @@ -51,12 +52,12 @@ meta: label: { de: "Einstellungen", en: "Settings" } agent: purpose: "Header/footer trees per language, rendered by App.svelte from elements." - instructions: "Singletons: type header/footer x language de/en (unique type+language). elements: {name, page->content.id} internal, {name, external:true, externalUrl} external, optional hash without #. Always request lookup elements.page:content; href = localizedPath(_lookup.page.path) + hash." + instructions: "Singletons: type header/footer x language de/en (unique type+language). elements: {name, page->content.id} internal, {name, external:true, externalUrl} external, optional hash without #. Always request lookup elements.page:content; href = localizedPath(_lookup.page.path) + hash. GOTCHA 2026-10-05: filter_public.js forces active:true on anonymous reads although this schema declares no active field – without stored active:true the header/footer query returns count 0 publicly (PAT reads still succeed). Always store active:true on every navigation doc." fieldHints: type: "header or footer" language: "de or en" examples: [{ language: "de", type: "header", elements: [{ name: "Start", page: "" }] }] - hints: ["page holds content.id, resolve via _lookup.page.path", "never hardcode /de prefix in DB"] + hints: ["page holds content.id, resolve via _lookup.page.path", "never hardcode /de prefix in DB", "missing active:true => public nav empty + SSR count 0 (verified incident 2026-10-05)"] hooks: get: diff --git a/api/collections/ssr.yml b/api/collections/ssr.yml index 14efaa7..1cd9a11 100644 --- a/api/collections/ssr.yml +++ b/api/collections/ssr.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../../tibi-types/schemas/config/collection.schema.json ######################################################################## # SSR Dummy collections ######################################################################## diff --git a/api/collections/tag.yml b/api/collections/tag.yml index faf8ef1..cbcc662 100644 --- a/api/collections/tag.yml +++ b/api/collections/tag.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../../tibi-types/schemas/config/collection.schema.json ######################################################################## # Tags — verwaltete Schlagwörter für Mediathek und andere Collections ######################################################################## diff --git a/api/config.yml b/api/config.yml index 78aa46f..fa1e412 100644 --- a/api/config.yml +++ b/api/config.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=../tibi-types/schemas/config/project.schema.json namespace: __TIBI_NAMESPACE__ meta: @@ -8,8 +9,8 @@ meta: lookup: "content: blocks.heroImage.image:medialib, blocks.image:medialib; navigation: elements.page:content; comments via aggregate on comment.contentId" rendering: "App.svelte loads getCachedEntries(content, {lang, path, active:true} + lookup); BlockRenderer maps Hero/Features/Richtext/Accordion/ContactForm; images only via widgets/MedialibImage.svelte" designGuide: "Future free code/HTML blocks: add block type in content.blocks (type + fields with dependsOn $parent.type), Svelte component in frontend/src/blocks/ + case in BlockRenderer.svelte, keep admin preview contract; Svelte 5 runes ($props/$state/$derived, never destructure block), SSR-safe (window guards), MedialibImage is the only image boundary (file.src or data URI, no ?filter on data URIs), Tailwind v4 canonical (bg-linear-to-*, aspect-video/square else arbitrary, trailing ! e.g. bg-brand-600!), i18n via svelte-i18n ($_), always pass foreignMedia lookup explicitly" - workflows: ["Create page (name, path, lang, translationKey, active:true) -> fill blocks -> link navigation -> verify /de plus /api/content?lookup -> respect SSR cache (POST creates, PUT/DELETE invalidate via clear_cache hooks)", "Upload image (medialib file {src:data URI, path}) -> put ID into heroImage.image or blocks.image -> verify with lookup (file.src must be /)"] - hints: ["Public reads need active:true plus publication window (filter_public)", "path pattern ^/[a-z0-9-/]*$ (lowercase, no umlauts)", "translationKey+lang and path+lang are unique: always set translationKey, else second doc collides on null/de", "File upload: {src:'data:;base64,...', path:'n.jpg'} (path optional); stored {src:'/n.jpg', type}; never {filename,data}, never file as plain string", "Reads with select/projection excluding file.data (else context bloat); file.src is enough", "SSR cache lives in ssr collection with dependencies content:/content:*/medialib:*/navigation:*/comment:*; after manual MCP writes use ssr?clear=1 if needed"] + workflows: ["Create page (name, path, lang, translationKey, active:true) -> fill blocks -> link navigation -> set active:true on touched navigation/medialib docs -> verify /de plus anonymous SSR (navigation count>0, _lookup resolved) -> respect SSR cache (POST creates, PUT/DELETE invalidate via clear_cache hooks)", "Upload image (medialib file {src:data URI, path} + active:true) -> put ID into heroImage.image or blocks.image -> verify with anonymous lookup (file.src must be /), PAT-only success is not sufficient"] + hints: ["Public reads need active:true plus publication window (filter_public) – applies to content AND navigation AND medialib. Navigation/medialib schemas declare no active field, yet anonymous/SSR queries return empty without it: always store active:true on those docs too (accepted as extra field). Symptom of missing flag: header/footer nav count 0 and medialib lookups unresolved (plain IDs, no _lookup) although PAT reads succeed", "path pattern ^/[a-z0-9-/]*$ (lowercase, no umlauts)", "translationKey+lang and path+lang are unique: always set translationKey, else second doc collides on null/de", "File upload: {src:'data:;base64,...', path:'n.jpg'} (path optional); stored {src:'/n.jpg', type}; never {filename,data}, never file as plain string", "Reads with select/projection excluding file.data (else context bloat); file.src is enough", "SSR cache lives in ssr collection with dependencies content:/content:*/medialib:*/navigation:*/comment:*; after manual MCP writes use ssr?clear=1 if needed", "Verify public rendering via anonymous SSR HTML (window.__SSR_CACHE__: navigation count>0, heroImage/image with _lookup), never trust PAT-only lookups"] imageUrl: eval: "$projectBase + '_/assets/img/admin-pic.svg'" i18n: diff --git a/tibi-types b/tibi-types index 5e04a1c..4c55f82 160000 --- a/tibi-types +++ b/tibi-types @@ -1 +1 @@ -Subproject commit 5e04a1ca3a58a4c219162726e2289486e6d3f2aa +Subproject commit 4c55f8244637a0ae9b734c9a028962a85ee2276f