feat(kitchen): add a frontmatter key registry and deprecate servings, yield and yields #268

Merged
abiwab merged 2 commits from feat/frontmatter-key-registry into dev/1.6 2026-11-26 12:04:54 +01:00
Owner

PR 2a of the DX plan (.notes/backlog/plan-dx-et-aides-ecriture.md, § 1A). Builds on #267 (merge of main into dev/1.6): merge #267 first, the diff then reduces to this PR's own commit.

What changes

  • Kitchen: FRONTMATTER_KEYS (src/frontmatter.ts), the one registry of the frontmatter keys Gram gives a meaning to ({ key, role, value, example, deprecated? }), with frontmatterKey() and canonicalFrontmatterKeys().
  • Kitchen: new warning DEPRECATED_FRONTMATTER_KEY (warning, so it fails gram check --strict; no loc, data: { key, suggestion }), raised for servings, yield and yields, even next to their canonical key (which still wins).
  • i18n: what each key means and each value kind is, in en and fr (frontmatter.keys.*, frontmatter.values.*), plus renderer.lastUpdated.
  • Renderer: the byline's known keys are derived from the registry; lastUpdated shows as "Updated …" / "Mis à jour le …"; the servings / yield / yields fallbacks are tagged @remove-in: 2.0.0.
  • deprecations.yaml: frontmatter-servings-yield, the first syntax-layer deprecation (warningCode, migration: manual).
  • Modules: a deprecated key in the frontmatter of an imported module raises the same warning on the @use line that imports it (data.specifier names the module; a transitive import is anchored in the file that writes it), like DENSITY_OVERRIDE_SHADOWED.
  • Conformance: warn-025-deprecated-frontmatter-key and mod-034-deprecated-frontmatter-key-in-module (no other golden changes).
  • Docs (en + fr): generated table of keys in document-structure.mdx, a language (BCP 47) section, the deprecation caution, an entry in how-to/deprecations.mdx; warnings.mdx picks the code up from its generated table.

Checks

bun test (4027 pass), bun run conformance (144/144, 24/24), bun run fuzz --iterations 50000 (0 signature), deprecations:check, check-changesets, typecheck, biome.

Known limits

  • The playground chunk goes from 1053.8 KB to 1058.3 KB (budget 1060 KB): the key descriptions ship in both languages.
  • Editor anchoring on the key's line, strikethrough, quick fix and completion come in PR 2b.
PR 2a of the DX plan (`.notes/backlog/plan-dx-et-aides-ecriture.md`, § 1A). Builds on #267 (merge of `main` into `dev/1.6`): merge #267 first, the diff then reduces to this PR's own commit. ## What changes - **Kitchen**: `FRONTMATTER_KEYS` (`src/frontmatter.ts`), the one registry of the frontmatter keys Gram gives a meaning to (`{ key, role, value, example, deprecated? }`), with `frontmatterKey()` and `canonicalFrontmatterKeys()`. - **Kitchen**: new warning `DEPRECATED_FRONTMATTER_KEY` (`warning`, so it fails `gram check --strict`; no `loc`, `data: { key, suggestion }`), raised for `servings`, `yield` and `yields`, even next to their canonical key (which still wins). - **i18n**: what each key means and each value kind is, in `en` and `fr` (`frontmatter.keys.*`, `frontmatter.values.*`), plus `renderer.lastUpdated`. - **Renderer**: the byline's known keys are derived from the registry; `lastUpdated` shows as "Updated …" / "Mis à jour le …"; the `servings` / `yield` / `yields` fallbacks are tagged `@remove-in: 2.0.0`. - **`deprecations.yaml`**: `frontmatter-servings-yield`, the first `syntax`-layer deprecation (`warningCode`, `migration: manual`). - **Modules**: a deprecated key in the frontmatter of an imported module raises the same warning on the `@use` line that imports it (`data.specifier` names the module; a transitive import is anchored in the file that writes it), like `DENSITY_OVERRIDE_SHADOWED`. - **Conformance**: `warn-025-deprecated-frontmatter-key` and `mod-034-deprecated-frontmatter-key-in-module` (no other golden changes). - **Docs (en + fr)**: generated table of keys in `document-structure.mdx`, a `language` (BCP 47) section, the deprecation caution, an entry in `how-to/deprecations.mdx`; `warnings.mdx` picks the code up from its generated table. ## Checks `bun test` (4027 pass), `bun run conformance` (144/144, 24/24), `bun run fuzz --iterations 50000` (0 signature), `deprecations:check`, `check-changesets`, typecheck, biome. ## Known limits - The playground chunk goes from 1053.8 KB to 1058.3 KB (budget 1060 KB): the key descriptions ship in both languages. - Editor anchoring on the key's line, strikethrough, quick fix and completion come in PR 2b.
fix(renderer): stop listing the recipe language among custom byline metadata
All checks were successful
CI / Build & Test (pull_request) Successful in 5m52s
3f20d76d39
docs(syntax): fix frontmatter examples that silently emptied the whole block
All checks were successful
CI / Build & Test (pull_request) Successful in 5m56s
8a2d256804
Reviewed-on: #265
Reviewed-on: #266
chore: merge main into dev/1.6
All checks were successful
CI / Build & Test (pull_request) Successful in 6m22s
092ca8ebfe
feat(kitchen): add a frontmatter key registry and deprecate servings, yield and yields
All checks were successful
CI / Build & Test (pull_request) Successful in 6m20s
e893bae2a7
feat(modules): report deprecated frontmatter keys of imported modules on their @use line
All checks were successful
CI / Build & Test (pull_request) Successful in 6m18s
e397c1b500
abiwab merged commit 6166bea647 into dev/1.6 2026-11-26 12:04:54 +01:00
abiwab deleted branch feat/frontmatter-key-registry 2026-11-26 12:04:54 +01:00
Sign in to join this conversation.
No description provided.