46 KiB
@gram-lang/kitchen
1.5.0
Minor Changes
073d4f1: Parser & Kitchen: An ingredient or intermediate quantity can now be written as a sum or difference of terms (@flour{1 cup + 1 tbsp},@sugar{1 cup - 2 tbsp},@butter{1 cup + 20 g},&dough{1 kg + 200 g}):- Supports any number of
+/-terms (including fractions and ranges) on ingredients, composite parents (<@oranges{1 lb + 4 oz}), and intermediates (including@usebase yields); scaling multiplies each term, andgram importnow preserves multi-measure sums instead of folding them into decimals. - Steps and section ingredient lists keep sums as written (
100 g + 100 g), while scaled amounts format cleanly for cooking (2 cup + 2 tbsp,2.4 kg); compiled JSON stores terms inparts(withminus: truefor subtraction) and totals inqty/unit(or full text inunitfor mixed unit kinds). - Invalid sums (missing unit, percentage, multiplication, subtracting a range or across unit kinds, zero total) raise
INVALID_QUANTITYwith a suggestion indata;OZ_AFTER_VOLUMEflagsozafter a volume ({1 cup + 2 oz}), andINVALID_UNITsuggests a sum for adjacent quantities ({1 kg 200 g}). - Masses and nutrition weigh each term individually (returning no mass if any term cannot be weighed),
gram diffshows formatted quantities viafromText/toText,@gram-lang/rendererexportsformatUsageQuantity, and@gram-lang/i18nexportstermsTotal,mergeTerms,formatTerms, andTerm.
- Supports any number of
e0f8fbf: Parser & Kitchen: Decimal numbers can now be written with a comma as well as a point ({1,5 kg}and{1.5 kg}):- Supported in all braced numbers (ingredients, ranges, relative quantities, cookware, temperatures, timers, and section anchors) and displayed in the reader's locale.
- Commas followed by exactly three digits (
{1,000 g}) are still read as decimals (1 g), with a newAMBIGUOUS_NUMBERwarning in case a thousand was intended (while{1.000 kg}remains1 kgwithout warning). gram formattrims trailing zeros after a comma ({1,50}→{1,5}) while keeping{1,000}as written.
8d1b62e: Parser & Kitchen: Timers and section anchors now support natural duration syntax in English and French, with or without spaces:- Accepts compound durations (
~{1h30},~{1 hr 30 mins},~{1 heure 30},~{1h + 30min},~{2min30}), clock notation (~{1:30 h},~{0:04:30}), primes (~{5'30"},~{10'}), ranges (~{1h30-2h},~{45 min - 1 h}), section anchors (~{-1h30},~{-1j 12h}), and aliases likehr,hrs, andmn.gram importnow outputs these natural forms and avoids ambiguous notations like~{1:30}. - Ambiguous or invalid durations (
~{1:30},~{1h75}, reversed ranges) raiseINVALID_DURATIONwith a suggested fix and are excluded from total time; anchor warnings now point directly to the anchor. - Compiled timers store the source text in
rawand total minutes inminutes(normalizingquantity/unitto the smallest written unit for new forms) and are scheduled like any other timer. - Exposes
parseDuration(@gram-lang/i18n) andreadAnchor(@gram-lang/kitchen), and addslocto AST section anchors.
- Accepts compound durations (
a9e6231: Kitchen & Rendering: The shopping list merges repeated quantities of an ingredient wherever possible:- Units from the same measuring system combine onto one line in natural cooking units (
1 cupand2 tbspbecome1 cup + 2 tbsp;1 kgand200 gbecome1.2 kg), reducing mixed-unit warnings and supportinggram scale --target. - Different measuring systems (
1 cupand100 ml) or unit kinds (volume and weight) stay on separate lines. - Ranges add by their bounds (
2-3 gand200 gbecome202-203 ginstead of202.5 g). - In compiled JSON, merged entries store the total in the smallest unit written (
18 tbsp,1200 g) and, for ranges, keep the midpoint inqtyalongside a newrangefield.
- Units from the same measuring system combine onto one line in natural cooking units (
f91ec4e: Parser & Kitchen: Steps can now mark inline target states with an optional glued verification note (Whisk until ={ribbon stage}(the batter falls back in a continuous ribbon).):- Only the state sits inside
={…}, with an optional single-line note attached to}; unclosed or empty={raises a syntax error, and braceless@ingredientnames end before a target state (@salt until ={taste}). - Compiled steps emit a
checkpointtoken (state, plus optionalnote) without affecting scaling, scheduling, or the shopping list. - Rendered across HTML, Markdown, plain text, and print views;
gram cookshows checkpoints below each step and reminds you when a step timer rings. gram difftracks added, removed, and changed target states,gram importpreserves them from sources, and editors highlight them.
- Only the state sits inside
238e012: Parser & Kitchen: Temperatures can now carry a glued parenthetical note for oven mode or probe placement (^{160°C}(fan),^oven{180°C}(grill),^{63°C}(internal),^{high heat}(covered)):- Only parentheses touching
}on the same line are parsed as a note; spaced parentheses remain plain step text. - Displayed alongside the temperature in HTML, Markdown, plain text, print, and
gram cook(which now formats temperatures consistently, including word-based ones like^{high}). - Adds an optional
notefield on AST and compiled JSON temperatures, tracks note changes ingram diff, and exportsformatTemperaturefrom@gram-lang/renderer. gram importpreserves oven modes as temperature notes rather than leaving them in prose.
- Only parentheses touching
d5fe9c3: Parser, Kitchen & Analyzer: Ingredients, intermediates, and timers can now be written as unit ratios:- Supports ratios across units or counts on ingredients (
@eggs{1 / 100 g @&flour},@salt{15 g / 1 L @&water}), homemade preparations (&stock{250 ml / 100 g @&rice}, plus percentages like&stock{250% @&rice}), and proportional timers (~{15 min / 500 g @&roast},~{4 min / @&cutlet}). - Resolves compatible units at compile time and cross-family ratios via the ingredient database; incompatible or zero-denominator ratios raise
RELATIVE_QUANTITY_UNKNOWN_MASS(withreason) orINVALID_QUANTITY(reason: "zeroRatioDenominator") instead of guessing. - Whole-use references to a section preparation (
Roll out the &dough) now estimate mass from the producing section, while step-produced intermediates (Mix … ->&dough) require an explicit amount (reason: "stepProducer"); warnings and formulas in imported bases display original author names rather than internal aliases. - Scaling a recipe re-resolves all ratios and recomputes the schedule, total times, and shopping list.
- Views display resolved ratios in tooltips, and the language server provides syntax highlighting, target completion, intermediate renaming, hover previews, and inlay hints.
- Supports ratios across units or counts on ingredients (
Patch Changes
7d15360: Analyzer & Kitchen: Percentages inside alternatives (@butter{10% @&flour}|@oil{8% @&flour}) are now resolved per option (including references to earlier options in the same group) without summing across alternatives, anddetectCyclesnow traverses alternative formulas.f4c6943: Kitchen: Percentages on composite parents (@eggs{3}<@box{50% @&flour}>) now raiseINVALID_QUANTITY(reason: "relativeNotSupported") instead of being silently dropped.92bec33: Kitchen: Fixed relative quantities targeting a step-declared intermediate (->&dough) in an earlier section falsely raisingVARIABLE_NOT_FOUND.4d4b12e: Kitchen & Rendering: Fixed text-only quantities (@sel{une pincée},@pepper{to taste}) disappearing from steps, section ingredient lists, and shopping lists (stored invariable_entriesin compiled JSON).4d5f79f: Parser & Kitchen: Fractions with a zero denominator (@flour{1/0 cup}) now raiseINVALID_QUANTITY(reason: "zeroDenominator") and drop the invalid number (preserving it in ASTinvalidNumber) instead of silently misreading it.- Updated dependencies [
9c86b70] - Updated dependencies [
073d4f1] - Updated dependencies [
e0f8fbf] - Updated dependencies [
8d1b62e] - Updated dependencies [
f91ec4e] - Updated dependencies [
238e012] - Updated dependencies [
0fa8c95] - Updated dependencies [
55188fc] - Updated dependencies [
d5fe9c3] - Updated dependencies [
4d5f79f]- @gram-lang/scheduler@1.5.0
- @gram-lang/parser@1.5.0
- @gram-lang/i18n@1.5.0
1.4.2
Patch Changes
3ecc785: Kitchen, Analyzer, Renderer & CLI: Fixed lost, split, or skipped ingredient quantities across shopping lists, views, and diffs:- Shopping lists now merge different spellings of the same unit (
1 cupand2 cups,1 c.à.sand2 tbsp) onto a single line, which also makes those ingredients work again withgram scale --target. - The HTML view now displays every quantity when an ingredient uses multiple units in the same section (
100 g + 1 cup), instead of showing only the first. gram shopno longer drops ingredients whose quantity cannot be computed (such as a percentage of a missing intermediate) and lists them as written.gram diffnow compares each unit separately when an ingredient appears in multiple units, and ignores changes that only affect how a unit is spelled.
- Shopping lists now merge different spellings of the same unit (
- Updated dependencies [
6620c24]- @gram-lang/parser@1.4.2
- @gram-lang/i18n@1.4.2
- @gram-lang/scheduler@1.4.2
1.4.1
Patch Changes
efbb381: Kitchen: Split quantities across two units (@flour{1 cup 5 tbsp}) or prefixed with words (@flour{about 200g}) now raise anINVALID_UNITwarning instead of being misread or dropped when scaling (while unit-only descriptors like{1 tin of 400 g}or{a pinch}remain valid).- Updated dependencies [
7fbd5c6] - Updated dependencies [
2327de6] - Updated dependencies [
4608f96]- @gram-lang/i18n@1.4.1
- @gram-lang/parser@1.4.1
- @gram-lang/scheduler@1.4.1
1.4.0
Minor Changes
-
Scheduler: The planning engine now lives in its own package,
@gram-lang/scheduler, which@gram-lang/kitchenuses. Compiled recipes keep every field published in 1.3.0, and everything@gram-lang/kitchenexported before is still exported from it:layout(tasks, { miseEnPlace, rests })lays a recipe's list of tasks out on a timeline, for any mise en place plan and any choice of waits, and reports what cannot work (a time paradox, a track contention, a working day pushed before its 24 hours)project(recipes, context)places a recipe on the calendar from a serving time, a time zone and when the cook is available; it stretches or shortens the waits written as a range so the cook's own work avoids the night, and reports what it could not fixrunSheet(plan)groups a plan into the days of the recipe, the visits to the kitchen (with the sections each one cooks and how early it could be done) and the waits that go on without the cookfindServeTimes()ranks the serving times that work over a range of days, with the reasons of the others, andearliestServe()gives the first one that works if the cook starts nowparseAvailability(),parseMealTimes()and the other readers of a project's settings (08:00-22:00,fri=18:00-22:00,2026-10-09=none) are shared by the CLI and the editor
-
Kitchen: Recipes now know when each part of the mise en place should happen:
- New fields on the compiled recipe:
miseEnPlace(how long each section's own preparation takes),tasks(the list of tasks and what each one waits for),schedule(a default timeline, with the preparation right before each section and the shortest rests),days(the working days of a timeline) andgenerator(the version that compiled it). A recipe with no step at all now has a preparation time of 0 - Any other timeline comes from the same list, without compiling again: all the preparation at the start (
upfront) or at the start of each working day (perDay), with the shortest, middle or longest of every rest written as a range (newlayout(), from@gram-lang/scheduler) - A timer is exact (
~_{12h}lasts exactly 12 hours); a rest written as a range (~_{12-24h}) is planned on its shortest figure unless you pick another, and an active timer written as a range (~{20-25min}) on its longest, so dinner is never late. Only an anchor in days (~{-1d}) opens a working day - New warnings:
DAY_OVERFLOWflags a working day pushed before its 24 hours by a long rest,DURATION_OUT_OF_RANGEflags a duration over 1000 years (capped, instead of breaking the timeline with0,InfinityorNaN), and aPASSIVE_OVERLAP_SAME_COOKWAREnotice flags two passive timers that overlap on the same cookware with no named track in common - An intermediate (
&dough) is gathered in the section that uses it, and JSON compiled before 1.4.0 still gets a total and idle time in the renderer outputs, the editor hint andgram diff
Deprecated
- Kitchen:
steps[].timingsandsteps[].backgroundTasks, removed in 2.0.0. Read thestepandpassiveblocks ofschedule.blocksinstead - Kitchen:
metrics.totalTimeandmetrics.idleTime, removed in 2.0.0. Readschedule.totalTimeandschedule.idleTimeinstead (the oldmetrics.totalTimeis the total with every preparation first:layout(tasks, { miseEnPlace: "upfront" })gives the same number unless the recipe has intermediates, which it prepares once they exist) - Kitchen:
metrics.activeTime, removed in 2.0.0. Readschedule.activeTimeinstead (a timer written as a range counts as its average inmetrics.activeTime, and as its longest figure in the schedule) - Kitchen:
metrics.activeBreakdown,metrics.prepBreakdownandmetrics.totalBreakdown, removed in 2.0.0. UsemiseEnPlaceandscheduleinstead - Kitchen: the
breakdownreturned bycalculatePreparationTime, removed in 2.0.0 (the function then returns{ total }, so code readingtotalis unaffected). Read theitemsofcomputeMiseEnPlace()instead - Kitchen: reading the old
metricsfields when compiled JSON has notasks(JSON compiled before 1.4.0), removed in 2.0.0. Compile your recipes again with 1.4.0 or later - Everything above keeps working, with the same values, until 2.0.0. The Deprecated features page shows what to change for each of them: https://gram-lang.org/docs/how-to/deprecations/
- New fields on the compiled recipe:
Patch Changes
- Kitchen: Scaling an already compiled recipe (
applyScale) now also scales the quantity a step quotes for an intermediate (Use &dough{100g}), so it gives the same result as compiling the recipe with that scale factor - Updated dependencies
- Updated dependencies
- Updated dependencies
- @gram-lang/scheduler@1.4.0
- @gram-lang/i18n@1.4.0
- @gram-lang/parser@1.4.0
1.3.0
Patch Changes
95698cc: Modules & Rendering: Intermediates declared inside imported modules now show the name you wrote (for examplepressed) instead of an internal path liketofu$marinated$pressed, ingram view, HTML and Markdown output.- Updated dependencies [
95698cc] - Updated dependencies [
fac320b]- @gram-lang/parser@1.3.0
- @gram-lang/i18n@1.3.0
1.2.1
Patch Changes
- Updated dependencies [
c8c4d49]- @gram-lang/i18n@1.2.1
- @gram-lang/parser@1.2.1
1.2.0
Minor Changes
2bab3cd: Parser & Kitchen: Introduced modular recipes and multi-file imports via the@usedirective:- Import external base recipes directly into a recipe using
@use "./bases/shortcrust-pastry.gram" as &shortcrust. - Imported steps seamlessly interleave into the global ALAP scheduling timeline, preserving resting times and dependencies.
- Automatically scales imported base quantities when referenced with specific yields (e.g.
&shortcrust{250g}halves a 500 g base recipe). - Supports destructured multi-yield imports (e.g.
@use "./bases/tart-elements.gram" as { &crust, &frangipane }) scaling each component independently. - Supports multi-word bindings using bracket notation (e.g.
@use "..." as &pastry dough{}). - Resolves project-root paths (
@/bases/...) and custom path aliases defined underpaths:in.gram/config.yaml. - Added
--stockCLI flag to treat pre-made base imports as stock items (zero timeline overhead, single shopping list line, retaining full nutritional totals). - Supports retro-planning timeline offsets directly on
@useimport lines (e.g.@use "./bases/levain-starter.gram" as &starter ~{-2d}). - Spliced sections in HTML, Markdown, and print outputs display origin badges crediting their source module.
gram diffandgram watchnow track import additions, removals, rebinding, rescaling, and dependency file changes.- Language Server and VS Code extension support live dependency composition, Go to Definition into base files, path auto-completion, and quick-fix diagnostics for missing exports.
- Exported
createMemoryHostfrom@gram-lang/modulesfor browser and in-memory module graph resolution. - Corrected whole-recipe mass and nutrition totals to accurately include spliced intermediate (
-> &) masses. - Normalized rescaled ingredient quantities to one decimal place for display consistency across all outputs.
- Import external base recipes directly into a recipe using
c31a583: Parser & Kitchen: Composite ingredients written with a short, generic child name (like@juice<@lemon) are now protected against a silent ingredient-database mix-up:- The compiler now warns when the same short composite name (e.g. "juice") is drawn from two different parents within one recipe (lemon in one step, orange in another) — until now this went unnoticed and the two usages silently shared one entry in the ingredient database.
gram db syncreports the same conflict across your whole recipe collection, so two unrelated recipes that happen to use the same generic composite name don't overwrite each other's nutrition and density data.- The AI recipe importer (
gram import) now writes composite ingredients with their full name (e.g. "lemon juice") instead of a short generic one, so newly imported recipes don't create this conflict in the first place.
Patch Changes
9331a4b: Parser & Kitchen: Fixedgram scale(and any other caller that re-scales an already-compiled recipe) silently leaving alternative ingredient groups (@butter|@margarine) and composite parent-draw quantities (@egg-yolks{2}<@eggs{3}) unscaled.f617b4c: Parser & Kitchen: Improved clarity and tone for diagnostic messages and revised severity tiers:- Reworded compiler and module diagnostic messages to provide actionable guidance and avoid alarmist phrasing for standard culinary approximations.
- Reclassified non-critical notices (
MISSING_MACROS,UNKNOWN_MASS,TRACK_CONTENTION) toinfoseverity so they do not clutter warning counters. - Enhanced Playground and editor diagnostic styling with dedicated color schemes for errors (red), warnings (amber), and notices (blue).
aaf8cee: Parser & Kitchen: Fixed a false circular reference warning when multiple sections used percentage-of formulas on same-named ingredients by scoping cycle detection per section.- Updated dependencies [
f617b4c] - Updated dependencies [
2bab3cd] - Updated dependencies [
8a4056b]- @gram-lang/i18n@1.2.0
- @gram-lang/parser@1.2.0
1.1.0
Patch Changes
b3a509a: Parser & Kitchen: Fixed an issue where multi-word composite ingredients marked with&(e.g.@juice{1}<@&unwaxed lemon{}) were duplicated in the shopping list instead of being combined into a single purchase item.- Updated dependencies [
b3a509a] - Updated dependencies [
fbb7511]- @gram-lang/parser@1.1.0
- @gram-lang/i18n@1.1.0
1.0.1
Patch Changes
- @gram-lang/parser@1.0.1
- @gram-lang/i18n@1.0.1
1.0.0
Major Changes
-
Gram v1.0.0 Official Launch! 🎉
This milestone release marks the official 1.0.0 launch of Gram:
- Brand-New Website & Documentation: Rebuilt using Astro and Starlight with refined guides and an integrated blog.
- Refreshed Visual Identity: Brand-new logo.
- Infrastructure & Stability: Monorepo stability, test coverage, and migration to self-hosted Forgejo (
git.gram-lang.org) mirrored to GitHub and Codeberg.
1.0.0-beta.5
Patch Changes
-
7c83cf8: The compiler now detects indirect circular dependencies between section intermediates (e.g. section A's result depends on section B's, whose result depends back on section A's) and reports aCIRCULAR_REFERENCEwarning for each one — previously only a direct self-reference was caught. -
dcaadd7: Removed all uses ofanyfrom the compiler's internal types, replacing them with the real shapes already exported by the package (Usage,CompositeItem,StepToken, etc.), and cleaned up dead code paths in shopping-list aggregation. -
0c2e818: Scaling a recipe by an extreme factor now fails with a clear error instead of silently producingInfinity(serialized asnullin the output JSON). Scaled quantities are also rounded consistently, including a composite ingredient's total, so results no longer show float noise like110.00000000000001. -
943e9f8: Scaling a fraction quantity (e.g.1/2 cup) no longer produces a malformed value in the compiled JSON ({"type": "fraction", "value": 1}with no numerator/denominator) — it's now correctly represented as a plain numeric quantity. -
24a108c: Fixed several compiler correctness bugs:- An empty section (or one containing only a comment) between two sections with steps used to break ALAP scheduling: the step right after the gap could get scheduled to overlap a timer still running from before the gap. It now correctly chains past the gap.
applyScale()(used bygram scaleand the playground) now scales cookware quantities. Previously it only scaled cookware "by accident" when called from insidecompile({ scaleFactor }), soapplyScale(compile(recipe), factor)silently left cookware unscaled.- A timer with an unrecognized time unit (e.g.
~{3 bananas}) or a missing unit no longer silently contributes a fabricated duration to the recipe's total/active time. Both now raise a warning instead, matching how temperatures and retro-planning already behave. - Timer units are now displayed consistently (e.g. always "min", never a mix of "min"/"mins"/"minutes" for the same physical duration in the same recipe).
-
970c32b: Fixed a spuriousTRACK_CONTENTIONwarning on the ordinary, intended use of named passive tracks (~_name{...}) — chaining several steps on the same physical resource (an oven, a fridge shelf) back-to-back no longer warns just because nothing else linked those steps together. The scheduler now understands that shared-track ordering the same way it already understands&intermediatedependencies, so the warning only fires when a real, unforeseen conflict remains. -
23e4286:ASTNodeis now a fully exhaustive, discriminated union that matches what the parser actually produces (CompositeAST,QuantityAST,TextQuantityAST, andRelativeQuantityASTwere previously missing from it), and composite ingredients (<@parent) now carry source location info like every other node.Making these types honest surfaced and fixed three real bugs in the language server: outline (document symbols), syntax highlighting (semantic tokens), and go-to-definition/rename/hover (reference and intermediate lookups) could silently miss or crash on content that isn't wrapped in a
## Sectionheader — a recipe with no headers at all, or with a comment before the first header. -
d61d786:QuantityValueAST(the parser's internal representation of a parsed number/fraction/range) is now a proper discriminated union instead of a flat interface with every field optional. This is an internal type-safety improvement with no behavior change — it's what would have caught, at compile time, a real bug fixed earlier indiffRecipes(checkingqty.from/qty.to, fields that never existed on any variant). -
Updated dependencies [
9553678] -
Updated dependencies [
68a2a45] -
Updated dependencies [
23e4286] -
Updated dependencies [
901e90e] -
Updated dependencies [
064ba9f] -
Updated dependencies [
b1aa8db] -
Updated dependencies [
79d835c] -
Updated dependencies [
d61d786]- @gram-lang/parser@1.0.0-beta.5
- @gram-lang/i18n@1.0.0-beta.5
1.0.0-beta.4
Major Changes
68365c4: Section retro-planning (e.g.## Section ~{-2h}) now enforces a strict signed-duration syntax instead of accepting arbitrary free text, preventing invalid timeline calculations. Added support for thed(day) time unit.
Minor Changes
06039f2: Added support for ALAP (As Late As Possible) scheduling. Passive timers and their dependencies are now natively pushed backwards from the end of the recipe, ensuring ingredients are prepared just-in-time rather than sitting idle on the counter. Also introduces two new compiler warnings for timeline conflicts:TIME_PARADOXandTRACK_CONTENTION.fc47a86: Renamed thecookTimemetric toidleTimeacross the ecosystem to better reflect hands-off wait time. Additionally, passive timers sharing the same name are now automatically sequenced one after another on the same background track.
Patch Changes
7487b09: Fixed the display of alternative ingredient and cookware groups (@egg|@tofu). They now correctly render inline as a single joined line in shopping and section lists, rather than being dropped or rendered as oddly-wrapped sub-lists.0bee2b2: Added support for bare single-word children in composite ingredients (e.g.,@juice<@lemon), and allowed independent preparation instructions on the parent side. Fixed section ingredient lists silently dropping the parent reference.aa0c082: Fixed a bug where scaled fractions (e.g., when doubling a recipe) would incorrectly display their original, unscaled text values in section ingredient lists instead of the correctly multiplied amount.c1c9b53: Fixed section and mise-en-place ingredient lists displaying raw database slug IDs (e.g.,oeufs) instead of their correct, localized display names (e.g.,œufs).55430e4: Added detailed per-contribution time breakdowns (Active, Prep, Total) to compiled recipe metrics, and surfaced them as explanatory tooltips on the time summary badges in the HTML renderer.- Updated dependencies [
0bee2b2] - Updated dependencies [
e659677] - Updated dependencies [
fc47a86] - Updated dependencies [
68365c4] - Updated dependencies [
68365c4] - Updated dependencies [
55430e4]- @gram-lang/parser@1.0.0-beta.4
- @gram-lang/i18n@1.0.0-beta.4
1.0.0-beta.3
Patch Changes
- Updated deployment configuration to automate npmjs packages publication
- Updated dependencies
- @gram-lang/i18n@1.0.0-beta.3
- @gram-lang/parser@1.0.0-beta.3
1.0.0-beta.2
Major Changes
-
8dc9c60: feat!: validate and normalize temperature units, add a shared warning severity map, and fix accented/non-Latin ingredient slugsKitchen:
warningSeverity: a new exported map to separate structural errors from recoverable warnings.- Temperature units are now validated and normalized to canonical
°C/°F. slugifynow preserves non-Latin letters via\p{L}/\p{N}.
Analyzer:
- Fixed
parseDensityOverridesname normalization for accented ingredient names.
Minor Changes
e192fe2: Addround2(value: number): number, exported from@gram-lang/kitchen. It centralizes the 2-decimal rounding rule (parseFloat(x.toFixed(2))) previously duplicated across kitchen, analyzer, and renderer, giving quantity/mass rounding a single documented implementation. No observable output changes — same rounding rule as before, just in one place.a46c24f: Upgraded all monorepo dependencies to their latest versions and implemented a TypeScript 7 dual setup for faster typechecking while preserving compilation toolchain compatibility. Fixed type errors arising from Node 26 and VS Code LSP v10 updates.
Patch Changes
-
0aec389: Fix_usageIdleaking a global counter across separatecompile()calls in the same process (affected the language server andgram scale's parallel compiles, making ids non-deterministic for an unchanged recipe). Fix nutrition analysis always reportingisEstimate: trueregardless of actual data precision. Fix the section mass badge in HTML output missing its scale icon. -
d837da3: Fixed a bug inapplyScale()where scaled quantities were incorrectly squared instead of multiplied for inline step ingredients, resulting in incorrect values (e.g., displaying800ginstead of400gwhen using--scale 2). The aggregated shopping list was unaffected. -
f5f1efe: chore: declaresideEffects: falseso bundlers can tree-shake unused exports from these packagesNo package previously declared this, so third-party bundlers had to assume every module might have side effects and couldn't safely drop unused code.
-
0ccfc99: Compiler warnings (CompilationResult.warnings,NutritionMetrics.warnings) are now always structuredWarningobjects ({ code, message, item?, loc?, section? }) instead of sometimes being plain strings depending on call order — a latent inconsistency that could previously produce"[object Object]"in some rendered output.Usage.composite,Usage.options, andProcessedStep.contentare now properly typed instead ofany. Also fixes range-based timer quantities (e.g.~{5-10min}) never displaying correctly ingram diffoutput, due to a pre-existing typo checking non-existent fields. -
Updated dependencies [
404198a] -
Updated dependencies [
f5f1efe] -
Updated dependencies [
6eab9b3] -
Updated dependencies [
e55940f] -
Updated dependencies [
a46c24f]- @gram-lang/parser@1.0.0-beta.2
- @gram-lang/i18n@1.0.0-beta.2
1.0.0-beta.1
Major Changes
-
a1e6fe9: refactor: renameisAsynctoisPassiveto align with domain terminologyTo better align the codebase with the actual domain model of a kitchen, the "asynchronous" timer concept has been completely renamed to "passive". This introduces the following breaking changes for tool builders:
- AST: The
TimerASTnode propertyisAsync: booleanis nowisPassive: boolean. - CSS: The
.timer.asyncclass generated by the renderer has been renamed to.timer.passive. - Kitchen Metrics: All internal variables and comments referring to
asyncbackground tasks have been updated topassive.
- AST: The
Minor Changes
-
a244341: Major overhaul of the documentation and playground infrastructure:- Documentation Rewrite & i18n: The documentation has been completely rewritten, thoroughly verified, and is now fully translated into French (in addition to the English version).
- Advanced Vue 3 Playground: The legacy playground has been removed and rebuilt from the ground up using Vue 3. This new version is directly integrated into the documentation and introduces powerful new features, including recipe scaling and baker's math.
-
fbe648e: Improve ingredient preparation tracking and display.- Kitchen:
aggregateSectionIngredientsnow groups ingredients by bothidandpreparation, creating separate entries for the same ingredient if it requires different preparations (e.g. cold vs melted). - Renderer: A new
formatModeoption in the render context controls preparation rendering. Preparations remain visible in inline text to prevent information loss. In the section's ingredient list (Mise-en-place), they are cleanly displayed with an em-dash. In the global shopping list, they remain hidden.
- Kitchen:
-
2476140: Added a centralizedScaleEnginein@gram-lang/kitchento make recipe scaling (--scale) and Baker's Percentage math safer and more consistent everywhere.- @gram-lang/kitchen: New
resolveScaleFactor()/applyScale()API validates a--scaletarget before computing a factor — rejecting fixed (@=) ingredients, relative quantities, ingredients only used inside a sub-recipe, ingredients inside an alternative-ingredient group, and ingredients split across incompatible units, with a clear error instead of a silently wrong number. A sub-recipe's own total (e.g. "2 lemons") is itself a valid scale target. Scaling is now a pure operation (never mutates the original recipe), and the compiled recipe now carries an explicitscaleFactorfield. Covered by a new unit test suite. - @gram-lang/analyzer: Fixed the
@*Baker's-reference auto-detection (it silently never matched before), and it now refuses to use a relative-quantity ingredient as the 100% base instead of computing bogus percentages. The enriched JSON AST now natively includes abakersPercentagefield for all ingredients if a reference ingredient is declared or passed via thebakersReferenceoption.convertUnit()now accepts an optional density (g/mL) to bridge mass ↔ volume conversions; newresolveIngredientDensity()andparseDensityOverrides()helpers resolve that density from a recipe'sdensities:frontmatter. Also includes a critical null-safety fix when parsing recipes containing standalone comments. - @gram-lang/renderer: Natively supports formatting Baker's Percentages provided by the analyzer (for HTML and Markdown exports, and the Playground), removing its legacy calculation logic. Fixed
gram print --bakers-math-onlyhaving no effect. - @gram-lang/cli: The CLI now cleanly acts as a presentation layer for Baker's Math, reading percentages directly from the AST. Added
--bakers-math,--bakers-reference, and--bakers-math-onlyflags to theview,printandexportcommands.--scale id=valuenow supports same-family unit conversion and cross-family conversion when a density is available; suggests the closest matching ingredient name on a typo; no longer shows corrupted comparison rows for an ingredient split across multiple units ingram scale.
- @gram-lang/kitchen: New
Patch Changes
-
e6cf842: Refined formatting and mass normalization for relative quantities:- Cleaner Display: Relative quantities are now seamlessly displayed without internal
@or&markers (e.g.,125% of lemon juice). The redundant formula brackets[125% of...]have been removed from inline instructions. - Robust Shopping List Aggregation: The compiler (
@gram-lang/kitchen) now strictly tracks ingredient lineage using_usageIds. This allows the analyzer (@gram-lang/analyzer) to flawlessly compute exact masses for complex items in the shopping list without confusing standard ingredients and their alternatives. - Shopping List Accuracy: When mass normalization is enabled, the shopping list will now accurately display the fully resolved physical mass for relative quantities (e.g.,
sugar (156 g)) instead of falling back to the formula string.
- Cleaner Display: Relative quantities are now seamlessly displayed without internal
-
3f7bc5d: Fixed an issue in the parser where composite ingredients without braces (e.g.,<@lemon,) would incorrectly consume subsequent text on the same line, causing missing ingredients and breaking relative quantity resolutions. -
979f32b: Fix total recipe time calculation when using background timersPreviously, the compiler did not wait for passive tasks (like resting dough in the fridge) to finish before letting you use the result. This caused the estimated "Total Time" to be unrealistically short. The engine now properly understands dependencies and waits for intermediate preparations to be fully ready before proceeding to steps that need them.
-
Updated dependencies [
a244341] -
Updated dependencies [
1eafa64] -
Updated dependencies [
a1e6fe9] -
Updated dependencies [
6013e64] -
Updated dependencies [
3f7bc5d]- @gram-lang/parser@1.0.0-beta.1
- @gram-lang/i18n@1.0.0-beta.1
1.0.0-beta.0
Major Changes
-
2dcd766: Introduction of the official GRAM CLI (@gram-lang/cli), a comprehensive command-line tool to manage, compile, and interact with your recipes.Project & Recipe Management:
- Project Setup:
gram initsafely scaffolds a.gramenvironment, including interactive AI provider setup (Google, OpenAI, Anthropic, Ollama) and secret management. - Automated Import:
gram importscrapes recipes from any URL and uses AI to flawlessly translate and convert them into native.gramsyntax. - Validation & Compilation:
gram checkinstantly validates syntax and database integrity.gram buildcompiles recipes to robust JSON with full physical and nutritional enrichment. - Smart Scaling & Diff:
gram scaledynamically resizes recipes (e.g.,--scale flour=300g) with a visual before/after comparison.gram diffprovides a semantic "git diff" for cooking, tracking changes in quantities, timings, and steps. - Export & Print:
gram printgenerates a beautifully typeset A4 HTML recipe card.gram exportconverts recipes to clean Markdown or static HTML. - Auto-formatting & Watcher:
gram formatautomatically enforces.gramlanguage styling standards.gram watchprovides real-time validation upon saving.
Interactive Cooking & Daily Use:
- Terminal Cooking Assistant (
gram cook): A step-by-step interactive TUI (Terminal User Interface) that guides you through the recipe, featuring a dynamic ingredient checklist and live background timers. - Smart Shopping List (
gram shop): Aggregates ingredients across multiple recipes, automatically converting volumes to masses and sorting them by supermarket aisle. - Recipe Search (
gram suggest): An alias-aware search engine to find recipes based on your available ingredients (e.g.,--with "butter, eggs" --without "milk"). - Rich Terminal Preview (
gram view): Renders recipes directly in the terminal with color coding, active timers, and nutritional tables.
AI-Powered Database Management (
gram db):- Smart Database Sync & Enrichment:
gram db syncautomatically tracks new ingredients across your project.gram db enrichuses AI to automatically fill in missing densities, unit weights, categories, and nutrition facts. - Semantic Linting & Conflict Resolution:
gram db lintuses AI to detect plural mistakes and semantic duplicates (e.g.,scallionvsgreen onion).gram db mergehandles conflicts when integrating external community databases.
- Project Setup:
Minor Changes
-
6e95e35: The@gram-lang/compilerpackage has been renamed to@gram-lang/kitchento fully embrace the Gram language's domain identity. -
79105ce: Complete overhaul of the VS Code Extension with Language Server, Live Preview, and advanced assistanceMajor New Features:
- Full Language Server (LSP): The extension now ships with a complete language server. All advanced features activate instantly upon opening a
.gramfile. - Dynamic Live Preview: A side-by-side WebView panel displaying the real-time HTML render of the recipe as you type.
- Gracefully handles syntax errors via a visual fallback.
- Integrates the official Playground styles for perfect consistency.
- CodeLens & Inlay Hints:
- Inlay Hints: Displays the cumulative total time in gray next to section titles.
- CodeLens: Clickable buttons
▶ Previewand📊 Macrosabove the main recipe title for quick access.
Ingredient Database & Nutrition:
- Automatic Loading: Automatically detects and loads
.gram/ingredients.yamlfrom the workspace root (or via the path configured ingram.ingredientDatabase.pathsettings). Optimized indexing (O(1)) for maximum performance. - Seamless Plural Management: The extension silently handles plurals (e.g.,
@carrots{3}will automatically matchcarrot). No error diagnostics are raised, everything is transparent. - Nutritional Hover & Macros Panel:
- Hovering over an ingredient displays a complete nutritional table (calories, proteins, carbs, fats, etc.).
- The Live Preview integrates a Macros panel (hidden by default) that can be shown via CodeLens, featuring clear visual alerts for ingredients missing data.
- Fuzzy Matching "Did you mean?": Levenshtein algorithm (distance ≤ 2) suggests corrections if an ingredient is misspelled (e.g.,
@tomaatosuggests@tomato). Directly integrated into Quick Fix code actions. - On-Hover Unit Conversion: Automatically converts volumes (ml, tbsp, etc.) to grams when hovering over an ingredient if its density is known in the database.
Editing Assistance & Navigation:
- Advanced Contextual Autocompletion:
- After
@: Suggests ingredients and their aliases from the YAML database. Automatically adds curly braces{}for multi-word names. - After
&: Suggests only the existing intermediate declarations in the document. - Inside
{}: Suggests canonical units (mass, volume, time) and their aliases (French/English) as soon as a digit is typed.
- After
- Smart Navigation:
- Go to Definition (
Ctrl+Click/F12) on a&refreference to jump to its->&refdeclaration. - Find All References (
Shift+F12) to list all usages of an intermediate. - Rename Symbol (
F2) to atomically rename an intermediate (declaration + references). - Outline Panel showing the hierarchy of sections and elements, with foldable code in the gutter.
- Go to Definition (
- Intermediate Hover: Displays the full text of the step where the intermediate was created.
Diagnostics & Code Actions (Quick Fixes):
- Real-Time Diagnostics:
- Red underline for an orphaned
&refreference. - Warning for an unused
->&refdeclaration. - Warning if the frontmatter (title) is missing.
- Red underline for an orphaned
- Code Actions (💡):
- Quick Fix: Insert the missing
title:in the frontmatter. - Quick Fix: Remove an unused intermediate declaration.
- Quick Fix: Declare a missing intermediate for an existing reference.
- Refactor: Convert a volume quantity to mass directly in the code.
- Refactor: Replace a misspelled ingredient with the closest Fuzzy match suggestion.
- Quick Fix: Insert the missing
Semantic Highlighting, Formatting & Snippets:
- Semantic Tokens: Regex-based syntax highlighting (TextMate) is replaced by AST-driven highlighting. Offers surgical precision for ingredients, timers, temperatures, comments, and nested units (e.g., precise separation of value and unit in
{10g}). - Auto-formatting (
Alt+Shift+F):- Normalization of spaces inside curly braces (
{ 200 g }→{200g}). - Normalization of composite ingredients (
@a < @b→@a<@b). - Alignment of section titles and tab-to-space conversions.
- Normalization of spaces inside curly braces (
- Built-in Snippets: Keyboard shortcuts for the basic structure (frontmatter, sections, steps), ingredient variants (
@ing,@?,@-), cookware (#cw), and timers/temperatures.
- Full Language Server (LSP): The extension now ships with a complete language server. All advanced features activate instantly upon opening a
-
babbb20: Core language update to enforce new syntax adjustments (breaking changes).- Grammar & Parsing:
- Made
{}optional for single-word ingredients. - Replaced temperature symbol with
°. - Replaced async timers with
~&{}. - Replaced aliases brackets with
:. - Tightened
<@with no spaces allowed. - Added fixed modifier
=. - Mandatory
@&inside relative quantities declarations. (e.g:@water{60% @&flour}) - Top-Level Support: Allowed writing comments and recipe steps globally, anywhere in the document (even before the first
## Section).
- Made
- Compiler Analysis:
- Added
INVALID_MODIFIER_COMBINATIONwarnings. - Updated AST transformations to support the new modifiers parsing rules and the implicit top-level sections grouping.
- Added
- Grammar & Parsing:
-
babbb20: Aligned visual tooling and test recipes with the new grammar.GramHighlight.ts(Playground & VSCode): Updated all syntax highlighting regular expressions to accurately match the new syntax (new temperature symbols, updated modifiers, etc.).- Examples (
basquaise_chicken.gram,lemon_meringue_pie.gram,torture.gram): Fully migrated recipe code to comply with the new grammar.
-
caf1630: Major architecture refactoring, ESM Migration, performance optimizations and code cleanup -
babbb20: Complete overhaul of the documentation to reflect the new syntax changes.
Patch Changes
- Updated dependencies [
79105ce] - Updated dependencies [
babbb20] - Updated dependencies [
babbb20] - Updated dependencies [
caf1630] - Updated dependencies [
babbb20] - Updated dependencies [
2dcd766]- @gram-lang/parser@1.0.0-beta.0
- @gram-lang/i18n@1.0.0-beta.0
0.10.1
Patch Changes
- Cleaned up and updated dependencies.
- Implemented Turborepo to optimize and simplify project building.
- Updated dependencies
- @gram-lang/parser@0.10.1
- @gram-lang/i18n@0.10.1
0.10.0
Minor Changes
cfda9e1: Refactored unit translation and normalization into a new centralized @gram-lang/i18n package to remove redundancy between the compiler and analyzer.
Patch Changes
705bb45: Migrated to full Bun environment using 'workspace:*' dependencies3720644: Added Zod to automatically catch invalid data and prevent crashes.63ec5a4: Improved code safety in the compiler by adding strict type checking for recipe elements.cdf3181: Introduce a unifiedgetNumericQtyutility inutils.tsto safely extract numeric values from AST Quantity structures (including fractions, ranges, and nested nodes). This fixes a bug where composite child ingredient quantities using fractions (e.g.@zest{1/2}) aggregated to zero in the shopping list.05791fd: Cleaned up repetitive code that manages and saves ingredients and cookware.833cfbf: Standardized the warning system to provide consistent and reliable error messages across all tools.919f299: Refactored AST processing for improved maintainability.69870cc: Standardized how recipe elements are identified across the system to prevent typos and errors.- Updated dependencies [
3720644] - Updated dependencies [
63ec5a4] - Updated dependencies [
cfda9e1] - Updated dependencies [
087b78b] - Updated dependencies [
69870cc]- @gram-lang/i18n@0.10.0
- @gram-lang/parser@0.10.0
0.9.0
Minor Changes
2963b48: Ingredients states (@ingredient:state{}) are removed. While the idea was to better organize the ingredient's database, it just happened to be too confusing to use.2963b48: Ingredient references without quantities (@&ingredient{}) are now excluded from section ingredients summaries. This keeps section-level mise en place lists clean by filtering out pure flow instructions (like removing or re-inserting) while preserving separate measured portions.2963b48: Extracted analyzer logic (mass normalization, yield management, nutritional estimation) into its own package. Ingredients database must now be provided by the user.2550f2a: GRAM syntax now also accepts semantic temperatures (e.g: Cook on !{low heat})