gram/packages/analyzer/CHANGELOG.md
abiwab 2b5ae73f33
All checks were successful
CI / Build & Test (pull_request) Successful in 7m22s
chore: release v1.5.2
2026-11-27 23:06:21 +01:00

43 KiB
Raw Permalink Blame History

@gram-lang/analyzer

1.5.2

Patch Changes

  • 9a09465: Kitchen, Analyzer & Renderer: Composite ingredients used in different units (e.g. @butter{100 g} and @brown butter{1}<@butter{2}) now stay separate on the shopping list instead of adding up incompatible units, and a parent also used whole (@eggs{1} next to @egg yolks{2}<@eggs{2}) can now be targeted by --scale.
  • Updated dependencies [9a09465]
  • Updated dependencies [ccdbca7]
  • Updated dependencies [daddb56]
  • Updated dependencies [14f9a9f]
    • @gram-lang/kitchen@1.5.2
    • @gram-lang/i18n@1.5.2
    • @gram-lang/parser@1.5.2

1.5.1

Patch Changes

  • 6abae89: Kitchen & Analyzer: Unresolved shopping list entries (shares and ratios with a missing or weightless target) are now built from parsed values rather than copied from source text, so gram format no longer alters them:
    • Ratios drop trailing zeros, extra spaces, and a denominator of 1 (15 g / L @&water).
    • Shares preserve the decimal separator written by the author (12,5% of flour).
  • 3080adf: Kitchen, Analyzer & i18n: Small quantities are no longer stored as zero across scaled amounts, shopping totals, resolved ratios, and standardized weights:
    • Stored values keep two decimals as before, but never fewer than two significant digits (0.02 kg divided by 10 stays 0.002 kg, and a ratio weighing 0.0047 g keeps its weight).
    • Adds roundQuantity in @gram-lang/i18n (re-exported by @gram-lang/kitchen).
  • Updated dependencies [9af07c9]
  • Updated dependencies [d3b2c04]
  • Updated dependencies
  • Updated dependencies
  • Updated dependencies
  • Updated dependencies [6abae89]
  • Updated dependencies [3080adf]
    • @gram-lang/i18n@1.5.1
    • @gram-lang/kitchen@1.5.1
    • @gram-lang/parser@1.5.1

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 @use base yields); scaling multiplies each term, and gram import now 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 in parts (with minus: true for subtraction) and totals in qty/unit (or full text in unit for mixed unit kinds).
    • Invalid sums (missing unit, percentage, multiplication, subtracting a range or across unit kinds, zero total) raise INVALID_QUANTITY with a suggestion in data; OZ_AFTER_VOLUME flags oz after a volume ({1 cup + 2 oz}), and INVALID_UNIT suggests 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 diff shows formatted quantities via fromText/toText, @gram-lang/renderer exports formatUsageQuantity, and @gram-lang/i18n exports termsTotal, mergeTerms, formatTerms, and Term.
  • 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 @ingredient names end before a target state (@salt until ={taste}).
    • Compiled steps emit a checkpoint token (state, plus optional note) without affecting scaling, scheduling, or the shopping list.
    • Rendered across HTML, Markdown, plain text, and print views; gram cook shows checkpoints below each step and reminds you when a step timer rings.
    • gram diff tracks added, removed, and changed target states, gram import preserves them from sources, and editors highlight them.
  • 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 note field on AST and compiled JSON temperatures, tracks note changes in gram diff, and exports formatTemperature from @gram-lang/renderer.
    • gram import preserves oven modes as temperature notes rather than leaving them in prose.
  • 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 (with reason) or INVALID_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.

Patch Changes

  • aa78c53: Analyzer: analyze() no longer mutates the compiled recipe's warnings array, preventing duplicate warnings when re-analyzing the same recipe in editors and the playground.
  • 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, and detectCycles now traverses alternative formulas.
  • Updated dependencies [073d4f1]
  • Updated dependencies [e0f8fbf]
  • Updated dependencies [8d1b62e]
  • Updated dependencies [7d15360]
  • Updated dependencies [f4c6943]
  • Updated dependencies [a9e6231]
  • Updated dependencies [92bec33]
  • Updated dependencies [f91ec4e]
  • Updated dependencies [238e012]
  • Updated dependencies [4d4b12e]
  • Updated dependencies [0fa8c95]
  • Updated dependencies [55188fc]
  • Updated dependencies [d5fe9c3]
  • Updated dependencies [4d5f79f]
    • @gram-lang/parser@1.5.0
    • @gram-lang/kitchen@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 cup and 2 cups, 1 c.à.s and 2 tbsp) onto a single line, which also makes those ingredients work again with gram 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 shop no longer drops ingredients whose quantity cannot be computed (such as a percentage of a missing intermediate) and lists them as written.
    • gram diff now compares each unit separately when an ingredient appears in multiple units, and ignores changes that only affect how a unit is spelled.
  • Updated dependencies [6620c24]
  • Updated dependencies [3ecc785]
    • @gram-lang/parser@1.4.2
    • @gram-lang/kitchen@1.4.2
    • @gram-lang/i18n@1.4.2

1.4.1

Patch Changes

  • d946b46: Analyzer: An ingredient whose unit holds a quantity of its own, such as @tomatoes{1 tin of 400 g}, is no longer weighed using the database's unit weight, which counted one tin as one tomato and skewed the shopping-list total. Its mass is now reported as unknown until Gram can parse the inner quantity.
  • Updated dependencies [7fbd5c6]
  • Updated dependencies [2327de6]
  • Updated dependencies [4608f96]
  • Updated dependencies [efbb381]
    • @gram-lang/i18n@1.4.1
    • @gram-lang/parser@1.4.1
    • @gram-lang/kitchen@1.4.1

1.4.0

Minor Changes

  • Analyzer / Diff: gram diff now compares the total and idle times of the default schedule, with the mise en place right before each section, so the times it reports match what gram view shows by default; the active time is the schedule's too, so changing the range of a cooking time (~{20-25min}, planned on its longest figure) shows in the comparison, and the preparation time is compared as before

Patch Changes

  • Updated dependencies
  • Updated dependencies
  • Updated dependencies
  • Updated dependencies
  • Updated dependencies
    • @gram-lang/kitchen@1.4.0
    • @gram-lang/i18n@1.4.0
    • @gram-lang/parser@1.4.0

1.3.0

Patch Changes

  • 48c856d: Analyzer: Fixed ingredients being ignored for density conversion and nutrition when their entry in ingredients.yaml isn't spelled exactly like the recipe name, such as "Huile d'olive" stored under huile-dolive:

    • Volumes like @Huile d'olive{10ml} are now converted to grams and no longer trigger "ingredient missing nutrition data"
    • gram db lint now reports ingredients whose names or aliases would be confused with each other
  • Updated dependencies [95698cc]

  • Updated dependencies [fac320b]

    • @gram-lang/parser@1.3.0
    • @gram-lang/kitchen@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/kitchen@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 @use directive:
    • 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 under paths: in .gram/config.yaml.
    • Added --stock CLI 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 @use import 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 diff and gram watch now 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 createMemoryHost from @gram-lang/modules for 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.

Patch Changes

  • 8a4056b: Language Server: Normalized error states and unified diagnostic handling across Playground and VSCode extensions:
    • Unified Playground diagnostics into a centralized full-width debug console with filter pills and interactive jump-to-location navigation.
    • Added mobile segmented tab navigation ([Editor] / [Preview]) and responsive single-row toolbar layout for mobile viewports.
    • Resolved nutrition diagnostics disconnection in the analyzer by merging physical and nutritional warnings into primary compiler warnings — the editor only turns these into squiggles when they carry a real position, so an incomplete-nutrition notice no longer misplaces itself at the top of the file.
    • Markdown and print HTML exports keep their explicit "incomplete data" note next to the affected nutrition figures; the interactive HTML preview conveys the same gap through its coverage badge instead.
    • A scale-target that fails to resolve (e.g. an unconvertible unit) now correctly turns the Playground's status badge and error panel red instead of being undersold as a warning, without marking the file tab as if the recipe itself had a syntax error.
    • The Playground diagnostics console no longer gets stuck filtered on a category that just emptied out (e.g. after fixing the warning it was showing).
    • Resolved silent compilation failures in the Language Server by capturing pipeline exceptions and pushing actionable error notifications to webviews — including when the thrown error carries no message, which previously slipped past the check silently.
    • A compile-time failure (parses fine, but compile()/analyze() throws) now also surfaces as an editor diagnostic, not only as a webview notification, so it's still visible with the preview panel closed.
    • Added bidirectional webview messaging in the VSCode extension to jump directly to error offsets in the active editor.
    • Localized the Playground diagnostics console's collapse/expand tooltip, previously hardcoded in French regardless of site locale.
  • Updated dependencies [9331a4b]
  • Updated dependencies [c31a583]
  • Updated dependencies [f617b4c]
  • Updated dependencies [2bab3cd]
  • Updated dependencies [8a4056b]
  • Updated dependencies [aaf8cee]
    • @gram-lang/kitchen@1.2.0
    • @gram-lang/i18n@1.2.0
    • @gram-lang/parser@1.2.0

1.1.0

Minor Changes

  • fbb7511: Nutrition & Rendering: Support flexible nutrition serving bases (per portion and per 100 g) alongside whole-recipe totals:
    • Declaring portions: in recipe frontmatter now calculates per-portion nutrition and keeps values constant when scaling recipes.
    • Added a standardized per-100g nutrition basis calculated from raw assembled recipe mass.
    • Added the --nutrition <auto|total|per-portion|per-100g> option to gram view, gram export, and gram print.
    • Added nutrition basis toggles in the web playground and VS Code live preview.
    • Localized all nutrient names and table headers across supported languages (French and English).

Patch Changes

  • fbb7511: Analyzer & Language Server: Improved nutrient calculation completeness and editor hover precision:
    • Saturated, monounsaturated, polyunsaturated fats, and alcohol are now included in recipe nutrition totals instead of being omitted.
    • gram db enrich can now propose monounsaturated and polyunsaturated fat values during ingredient enrichment.
    • Fixed the editor hover tooltip incorrectly displaying sodium in grams instead of milligrams.
  • fbb7511: Analyzer: Fixed recipe total mass and section weights to include ingredients defined as relative percentages of another ingredient (e.g. @water{60% @&flour}).
  • Updated dependencies [b3a509a]
  • Updated dependencies [fbb7511]
    • @gram-lang/parser@1.1.0
    • @gram-lang/kitchen@1.1.0
    • @gram-lang/i18n@1.1.0

1.0.1

Patch Changes

  • @gram-lang/kitchen@1.0.1
  • @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

Minor Changes

  • b1aa8db: convertUnit, standardizeMass, and analyze() now accept an optional lang parameter/option, so unit names are resolved against the recipe's own language when there's an ambiguity between languages, instead of always falling back to a single global guess.

    UNIT_CONVERSIONS (the mass/volume conversion table) has moved to @gram-lang/i18n — if you imported it from @gram-lang/analyzer, import it from @gram-lang/i18n instead.

Patch Changes

  • 3afd970: Baker's Percentage is now shown on an ingredient's inline mention within step text, not just in the recipe's ingredient list and shopping list — a dead type check meant this data was computed but never actually reached the inline token.

  • 8f7e887: The ingredient database schema no longer requires density on every entry that has a physical block — an ingredient described only by unit_weight (e.g. "1 avocado") is valid, matching the analyzer's own documented example. Previously, gram db enrich could write entries that gram build/gram db validate would then reject.

  • 5194ba4: gram diff (and diffRecipes) now detects quantity changes inside composite ingredients (<@parent) and alternative groups (@a|@b), which it previously ignored entirely — a recipe that doubled a composite or alternative's quantities used to be reported as having no changes at all. It also no longer loses one of two same-titled sections, or two same-named timers/temperatures within a single section, when comparing two recipes.

  • 1d86e74: Fixed the same ingredient sometimes getting two different normalizedMass values in one analyzed recipe (e.g. 250.78328000000002 in a recipe section vs. 250.78 in the shopping list) — the section-level and composite-child mass calculations now go through the same rounding as the shopping list, instead of duplicating the sequence without it.

  • 7b246ae: Removed all uses of any from the physical/nutrition analysis layer's internal types, typing them against the real shapes already exported by @gram-lang/kitchen and this package's own AnalyzedUsage/NutritionItem. No behavior change for this package beyond the fixes already released separately (see the relative-quantity type changeset). The renderer's printable/PDF view gained one internal any to stay compatible with the analyzer's now-stricter shopping-list type — purely a type-level adjustment, no output change.

  • f147b25: A relative-quantity ingredient's resolved quantity (e.g. @water{50% @&flour}) is now tagged with the correct "single" type instead of a value that didn't match any of the documented quantity shapes — it happened to still render correctly today only because of an unrelated fallback, so this is a safety fix rather than a visible change.

  • 68a2a45: Fixed several French unit words silently resolving to the wrong physical quantity:

    • quart/quarts no longer resolves to the US liquid quart (946 mL) in French recipes — it's a false friend ("un quart d'heure" means "a quarter of an hour", not a unit of volume). It's now reported as an unknown unit instead of silently misinterpreted. The English word quart/quarts still works in English recipes; only the spelled-out alias was removed, qt still works everywhere.
    • livre now converts using the French "livre métrique" (500 g) instead of being silently treated as the imperial pound (453.592 g) — a ~10% error.
    • tasse now converts using the French cup (250 mL) instead of being silently treated as the US cup (236.588 mL) — a ~6% error.
    • pinte no longer resolves at all: the historical French pinte has no single reliable modern value, so an explicit "unknown unit" is better than a confident-looking wrong number.
    • gallon/gallons now resolve correctly (previously only the abbreviation gal worked).
  • Updated dependencies [9553678]

  • Updated dependencies [68a2a45]

  • Updated dependencies [7c83cf8]

  • Updated dependencies [dcaadd7]

  • Updated dependencies [0c2e818]

  • Updated dependencies [943e9f8]

  • Updated dependencies [24a108c]

  • Updated dependencies [970c32b]

  • 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
    • @gram-lang/kitchen@1.0.0-beta.5

1.0.0-beta.4

Patch Changes

  • 383c825: Fixed mass standardization silently failing for alternative ingredient groups. Mass and estimate metrics are now properly computed for each option independently, fixing missing totals in the shopping list.
  • fc47a86: Renamed the cookTime metric to idleTime across 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.
  • b546f96: Fixed shopping list ingredient names defaulting to the database's canonical wording when the recipe used a valid alias. The lists now correctly preserve the recipe's original wording or translated alias, ensuring consistent language throughout.
  • 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 [06039f2]
  • Updated dependencies [7487b09]
  • Updated dependencies [0bee2b2]
  • Updated dependencies [e659677]
  • Updated dependencies [aa0c082]
  • Updated dependencies [fc47a86]
  • Updated dependencies [68365c4]
  • Updated dependencies [c1c9b53]
  • Updated dependencies [68365c4]
  • Updated dependencies [55430e4]
    • @gram-lang/kitchen@1.0.0-beta.4
    • @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/kitchen@1.0.0-beta.3
    • @gram-lang/parser@1.0.0-beta.3

1.0.0-beta.2

Major Changes

  • 815ce8c: fix!: load valid ingredients even when the database has a bad entry, and fix five correctness bugs

    Breaking:

    • validateIngredientDatabase no longer throws an error on a single malformed entry. It now validates entry-by-entry, returning both valid data and rejected keys. This prevents gram check or gram cook from hard-failing due to one unrelated bad line.
    • physical.yield must now be > 0 (previously >= 0) to prevent producing Infinity mass downstream.

    Fixed:

    • Added a guard in applyYield against non-positive yield factors.
    • Shopping list aggregation: The optional modifier is now treated as an intersection rather than a union.
    • diffRecipes: Temperature ranges that change bounds but keep the same average are now correctly detected in the diff. Fixed an issue where identical section titles would drop timer/temperature tokens.
    • calculateMassMetrics: Excludes optional ingredients from totalMass to match nutritional calculations.
    • calculateNutrition: Missing nutrient data now propagates as undefined rather than an indistinguishable 0.

Minor Changes

  • 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 _usageId leaking a global counter across separate compile() calls in the same process (affected the language server and gram scale's parallel compiles, making ids non-deterministic for an unchanged recipe). Fix nutrition analysis always reporting isEstimate: true regardless of actual data precision. Fix the section mass badge in HTML output missing its scale icon.

  • f5f1efe: chore: declare sideEffects: false so bundlers can tree-shake unused exports from these packages

    No package previously declared this, so third-party bundlers had to assume every module might have side effects and couldn't safely drop unused code.

  • 8dc9c60: feat!: validate and normalize temperature units, add a shared warning severity map, and fix accented/non-Latin ingredient slugs

    Kitchen:

    • warningSeverity: a new exported map to separate structural errors from recoverable warnings.
    • Temperature units are now validated and normalized to canonical °C/°F.
    • slugify now preserves non-Latin letters via \p{L}/\p{N}.

    Analyzer:

    • Fixed parseDensityOverrides name normalization for accented ingredient names.
  • 0ccfc99: Compiler warnings (CompilationResult.warnings, NutritionMetrics.warnings) are now always structured Warning objects ({ 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, and ProcessedStep.content are now properly typed instead of any. Also fixes range-based timer quantities (e.g. ~{5-10min}) never displaying correctly in gram diff output, due to a pre-existing typo checking non-existent fields.

  • Updated dependencies [0aec389]

  • Updated dependencies [e192fe2]

  • Updated dependencies [404198a]

  • Updated dependencies [d837da3]

  • Updated dependencies [f5f1efe]

  • Updated dependencies [8dc9c60]

  • Updated dependencies [6eab9b3]

  • Updated dependencies [e55940f]

  • Updated dependencies [a46c24f]

  • Updated dependencies [0ccfc99]

    • @gram-lang/kitchen@1.0.0-beta.2
    • @gram-lang/parser@1.0.0-beta.2
    • @gram-lang/i18n@1.0.0-beta.2

1.0.0-beta.1

Major Changes

  • 02d63ff: Breaking Change: Refactored Physical Engine Nomenclature

    The physical enrichment options and internal APIs have been renamed for clarity and to align with professional culinary terminology.

    If you are using @gram-lang/analyzer programmatically, please update your configuration:

    • enableMassNormalization is now enableMassStandardization
    • enableYieldManagement is now enableYieldCalculation
    • The exported normalizeMass helper is now standardizeMass

    This update ensures total parity with the updated official documentation.

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.
  • 8921d9d: Fixed several correctness bugs found during a documentation audit, and added alias-aware cross-unit shopping list aggregation.

    • @gram-lang/analyzer: unit_weight-based conversions (e.g. @avocado{1}) were being double-divided by yield — the whole-unit weight is now correctly treated as Gross Mass, with Net Mass derived forward (Gross × yield), while explicit mass/volume entries keep deriving Gross backward (Net ÷ yield) as before. Optional ingredients (?) are no longer counted in nutrition totals. New resolveCanonicalId() resolves an ingredient name/alias to its database key, and a new aggregateShoppingList() step re-groups the shopping list by canonical id — merging aliased ingredients (e.g. beurre/butter) and cross-unit quantities (e.g. 100g + 1 cup) into a single gram total whenever every entry resolves to a mass, falling back to separate entries flagged multiUnit: true when a density is missing.
    • @gram-lang/renderer: The HTML shopping list now clusters consecutive multiUnit-flagged entries for the same ingredient under one heading with a "⚠️ Mixed units" badge, instead of listing them as unrelated lines.
    • @gram-lang/cli: shopper's alias resolution now reuses @gram-lang/analyzer's resolveCanonicalId() instead of a separate, duplicated alias map.
  • 2476140: Added a centralized ScaleEngine in @gram-lang/kitchen to make recipe scaling (--scale) and Baker's Percentage math safer and more consistent everywhere.

    • @gram-lang/kitchen: New resolveScaleFactor()/applyScale() API validates a --scale target 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 explicit scaleFactor field. 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 a bakersPercentage field for all ingredients if a reference ingredient is declared or passed via the bakersReference option. convertUnit() now accepts an optional density (g/mL) to bridge mass ↔ volume conversions; new resolveIngredientDensity() and parseDensityOverrides() helpers resolve that density from a recipe's densities: 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-only having 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-only flags to the view, print and export commands. --scale id=value now 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 in gram scale.

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.
  • Updated dependencies [a244341]

  • Updated dependencies [1eafa64]

  • Updated dependencies [a1e6fe9]

  • Updated dependencies [fbe648e]

  • Updated dependencies [6013e64]

  • Updated dependencies [e6cf842]

  • Updated dependencies [2476140]

  • Updated dependencies [3f7bc5d]

  • Updated dependencies [979f32b]

    • @gram-lang/kitchen@1.0.0-beta.1
    • @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 init safely scaffolds a .gram environment, including interactive AI provider setup (Google, OpenAI, Anthropic, Ollama) and secret management.
    • Automated Import: gram import scrapes recipes from any URL and uses AI to flawlessly translate and convert them into native .gram syntax.
    • Validation & Compilation: gram check instantly validates syntax and database integrity. gram build compiles recipes to robust JSON with full physical and nutritional enrichment.
    • Smart Scaling & Diff: gram scale dynamically resizes recipes (e.g., --scale flour=300g) with a visual before/after comparison. gram diff provides a semantic "git diff" for cooking, tracking changes in quantities, timings, and steps.
    • Export & Print: gram print generates a beautifully typeset A4 HTML recipe card. gram export converts recipes to clean Markdown or static HTML.
    • Auto-formatting & Watcher: gram format automatically enforces .gram language styling standards. gram watch provides 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 sync automatically tracks new ingredients across your project. gram db enrich uses AI to automatically fill in missing densities, unit weights, categories, and nutrition facts.
    • Semantic Linting & Conflict Resolution: gram db lint uses AI to detect plural mistakes and semantic duplicates (e.g., scallion vs green onion). gram db merge handles conflicts when integrating external community databases.

Minor Changes

  • 6e95e35: The @gram-lang/compiler package has been renamed to @gram-lang/kitchen to fully embrace the Gram language's domain identity.

  • 79105ce: Complete overhaul of the VS Code Extension with Language Server, Live Preview, and advanced assistance

    Major New Features:

    • Full Language Server (LSP): The extension now ships with a complete language server. All advanced features activate instantly upon opening a .gram file.
    • 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 ▶ Preview and 📊 Macros above the main recipe title for quick access.

    Ingredient Database & Nutrition:

    • Automatic Loading: Automatically detects and loads .gram/ingredients.yaml from the workspace root (or via the path configured in gram.ingredientDatabase.path settings). Optimized indexing (O(1)) for maximum performance.
    • Seamless Plural Management: The extension silently handles plurals (e.g., @carrots{3} will automatically match carrot). 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., @tomaato suggests @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.
    • Smart Navigation:
      • Go to Definition (Ctrl+Click / F12) on a &ref reference to jump to its ->&ref declaration.
      • 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.
    • 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 &ref reference.
      • Warning for an unused ->&ref declaration.
      • Warning if the frontmatter (title) is missing.
    • 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.

    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.
    • Built-in Snippets: Keyboard shortcuts for the basic structure (frontmatter, sections, steps), ingredient variants (@ing, @?, @-), cookware (#cw), and timers/temperatures.
  • 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).
    • Compiler Analysis:
      • Added INVALID_MODIFIER_COMBINATION warnings.
      • Updated AST transformations to support the new modifiers parsing rules and the implicit top-level sections grouping.
  • 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

  • b2a235c: NutritionMetrics output field renamed from salt to sodium to match the ingredient database schema
  • Updated dependencies [6e95e35]
  • Updated dependencies [79105ce]
  • Updated dependencies [babbb20]
  • Updated dependencies [babbb20]
  • Updated dependencies [caf1630]
  • Updated dependencies [babbb20]
  • Updated dependencies [2dcd766]
    • @gram-lang/kitchen@1.0.0-beta.0
    • @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/kitchen@0.10.1
    • @gram-lang/parser@0.10.1
    • @gram-lang/i18n@0.10.1

0.10.0

Minor Changes

  • dc98e0b: Added Bun snapshot testing to the development environment for compiler validation.
  • cfda9e1: Refactored unit translation and normalization into a new centralized @gram-lang/i18n package to remove redundancy between the compiler and analyzer.

Patch Changes

  • c720fa1: Refactored the analyzer to reuse the compiler's getNumericQty utility, improving code DRYness and type safety.
  • 705bb45: Migrated to full Bun environment using 'workspace:*' dependencies
  • 3720644: Added Zod to automatically catch invalid data and prevent crashes.
  • 833cfbf: Standardized the warning system to provide consistent and reliable error messages across all tools.
  • Updated dependencies [705bb45]
  • Updated dependencies [3720644]
  • Updated dependencies [63ec5a4]
  • Updated dependencies [cfda9e1]
  • Updated dependencies [cdf3181]
  • Updated dependencies [05791fd]
  • Updated dependencies [833cfbf]
  • Updated dependencies [087b78b]
  • Updated dependencies [919f299]
  • Updated dependencies [69870cc]
    • @gram-lang/kitchen@0.10.0
    • @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: Updated unit resolution to allow for french aliases (e.g: tsp = càc)
  • 2963b48: Fixed multiple issues with mass calculations
  • 2963b48: Extracted analyzer logic (mass normalization, yield management, nutritional estimation) into its own package. Ingredients database must now be provided by the user.

Patch Changes

  • 2550f2a: Cleaned repo with removal of /dist folders
  • 7f4fa0d: Using changesets to simplify changelog management
  • 664ea91: Clarification of global comments for a recipe, to be declared in the front matter as "notes"
  • 2963b48: Empty ingredient masses now count as zero.