feat(kitchen): compiler writing hints (&ingredient, Cooklang %, cookware temperature) #277
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram!277
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/compiler-hints"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR 4 of the DX & authoring-aids plan (compiler hints, § 1B). Three common mistakes, often made by AI models that know Cooklang better than Gram, are now reported with the fix to make:
REFERENCE_TO_INGREDIENT(kitchen, new code,warning):&flouron an ingredient written earlier as@flour{…}warns, withdata.suggestion: "@&flour". The check reads the registry entry: silent on an intermediate (->&in a step or a section, even sharing an ingredient's name), on an unresolved@usebinding (is_intermediate), on a stocked import's leaf (is_module_synthetic) and on a spliced module's renamed->&. Covered by kitchen tests (EN + FR) and by real compositions inpackages/modules/tests/reference-to-ingredient.test.ts;compose.ts,rename.tsandyield.tsare untouched.%separator:~{15%min}keeps itsINVALID_DURATIONand now carriesdata.suggestion: "15 min"(only when Gram reads the corrected duration).@flour{200%g}, read until now as an unknown unit%gwith no mass and no warning, raisesINVALID_UNITwithreason: "cooklangSeparator"andsuggestion: "g"; only for a mass or volume unit ({70 % cacao},{2%cloves}stay silent). OtherINVALID_DURATIONwarnings keep their JSON unchanged.#oven{180°C}) now saysa temperature is written ^oven{180°C}.isPreferredQuick Fixes inquantityQuickFix, read fromdiag.dataanddiag.code(no regex on the message); applying them and recompiling never brings the code back.Also:
fuzz/src/normalize.ts: the existing SPACED_COMPOSITE rule (#208) now also lowercases REFERENCE_TO_INGREDIENT'sdata.suggestion, which quotes the name as written while the formatter lowercases ids (rule 1). Found by the 50k run (--seed 616880811 --index 24905), replays clean now.llms-full.txtregenerated: it also catches up with PR 2a's frontmatter table.Changeset
minor(kitchen,parser,language-server); it mentions thatgram check --strictnow fails on these mistakes. Docs en + fr:warnings.mdx(new section,datalist,INVALID_UNITfourth case,INVALID_DURATIONsuggestion),ai-generation-notes.mdx(cookware temperature, a new Cooklang%section, "Gram now warns" on&vs@&).Checks: tests red before, green after (kitchen 15, parser 3, LSP 6, modules 4); typecheck, biome, full
bun test(4144 pass, 1 skip, 0 fail); conformance 148/148, only thewarningsof059-sigil-only-namechanged, 4 new cases (warn-026…028,err-017);bun run fuzz --iterations 50000clean; audit unchanged (127 flags); AI spec examples and SKILL.md examples unaffected.