docs: refresh root and package READMEs for v1.5 #188
13 changed files with 199 additions and 66 deletions
37
README.md
37
README.md
|
|
@ -36,10 +36,11 @@ Gram turns plain-text recipes into structured, queryable data while keeping them
|
||||||
|
|
||||||
* **Plain Text**: Recipes are saved as simple `.gram` text files, so you can track changes with Git and use any text editor.
|
* **Plain Text**: Recipes are saved as simple `.gram` text files, so you can track changes with Git and use any text editor.
|
||||||
* **Modular Recipes (`@use`)**: Import and compose external base recipes (`@use "./bases/shortcrust.gram" as &crust`) with automatic yield scaling, timeline interleaving, and unified shopping lists.
|
* **Modular Recipes (`@use`)**: Import and compose external base recipes (`@use "./bases/shortcrust.gram" as &crust`) with automatic yield scaling, timeline interleaving, and unified shopping lists.
|
||||||
* **Dynamic Calculations**: Declare Baker's percentages, relative quantities (`@water{75% @&flour}`), and automatic unit conversions directly in your recipe.
|
* **Dynamic Calculations**: Declare Baker's percentages, relative quantities (`@water{75% @&flour}`), unit ratios (`@garlic{1 clove / 100g @&beef}`, `~{15min / 500g @&roast}`), compound quantities (`@flour{1 cup + 2 tbsp}`), and automatic unit conversions directly in your recipe.
|
||||||
* **Step References & Variables**: Reuse intermediate preparations (`->&dough`) and sub-ingredients (`<@lemons{2}`) without messing up shopping list totals.
|
* **Step References & Variables**: Reuse intermediate preparations (`->&dough`) and sub-ingredients (`<@lemons{2}`) without messing up shopping list totals.
|
||||||
* **Timers & Run Sheet**: Separate active steps (`~{10min}`) from background waiting times (`~_{2h}`): Gram computes your schedule, working backward from the service, and tells you when to be in the kitchen and what to take out. Give it a serving time and the hours you can cook, and a wait written as a range (`~_{8-16h}`) stretches or shortens to keep your work out of the night.
|
* **Timers & Run Sheet**: Separate active steps (`~{1h 30min}`, `5'30"`) from background waiting times (`~_{2h}`). Gram computes your schedule backward from service, tells you when to be in the kitchen and what to take out, and stretches range waits (`~_{8-16h}`) to keep your work out of the night.
|
||||||
* **Developer Tooling**: Includes a Language Server (LSP), a VS Code extension with real-time diagnostics, a CLI tool, and a TypeScript API.
|
* **Cooking Cues**: Specify temperatures with mode or equipment notes (`^{450°F}(convection)`) and mark sensory target states (`={golden brown}`), surfaced in views and live cooking reminders.
|
||||||
|
* **Developer Tooling**: Includes a Language Server (LSP), a VS Code extension with real-time diagnostics and live preview, a CLI tool, and a TypeScript API.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -50,7 +51,7 @@ Gram reads like natural language but compiles like code.
|
||||||
```gram
|
```gram
|
||||||
---
|
---
|
||||||
title: Artisanal Bread
|
title: Artisanal Bread
|
||||||
size: 2 loaves
|
makes: '2 loaves'
|
||||||
description: A simple, highly hydrated dough.
|
description: A simple, highly hydrated dough.
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -58,13 +59,13 @@ description: A simple, highly hydrated dough.
|
||||||
|
|
||||||
[Mix] @flour{500g}, @water{70% @&flour}, and @salt{10g} in a #bowl(large). ->&dough
|
[Mix] @flour{500g}, @water{70% @&flour}, and @salt{10g} in a #bowl(large). ->&dough
|
||||||
|
|
||||||
[Rest] Let the &dough rest for ~_{2h} at ^{room temperature} until doubled in size.
|
[Rest] Let the &dough rest for ~_{1h 30min} at ^{room temperature} until ={doubled in size}.
|
||||||
|
|
||||||
## Baking
|
## Baking
|
||||||
|
|
||||||
[Preheat] The #oven to ^{450F}.
|
[Preheat] The #oven to ^{450°F}(convection).
|
||||||
|
|
||||||
[Bake] The &dough for ~{35min} until the crust is deeply golden.
|
[Bake] The &dough for ~{35min} until ={deeply golden}.
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -74,23 +75,23 @@ description: A simple, highly hydrated dough.
|
||||||
Gram comes with tools to help write, inspect, and compile recipes.
|
Gram comes with tools to help write, inspect, and compile recipes.
|
||||||
|
|
||||||
### VS Code Extension & Language Server
|
### VS Code Extension & Language Server
|
||||||
[**Available on the VS Code Marketplace**](https://marketplace.visualstudio.com/items?itemName=gram-lang.gram-lang)
|
[**`Gram - Recipe Language` on the VS Code Marketplace**](https://marketplace.visualstudio.com/items?itemName=gram-lang.gram-lang)
|
||||||
- **Live Preview & Run Sheet**: Side-by-side recipe rendering and the run sheet of the recipe (days, visits to the kitchen, what to take out), with the serving time, the scale and the settings (mise en place, rests, comments...) one click away.
|
- **Live Preview & Run Sheet**: Side-by-side recipe rendering and the run sheet of the recipe (days, visits to the kitchen, what to take out), with the serving time, scale, and view settings (mise en place, rests, comments...) one click away.
|
||||||
- **Autocomplete**: Contextual suggestions for ingredients from your database, units, and step references.
|
- **Autocomplete & Refactoring**: Contextual suggestions for ingredients from your database, units, and `@use` imports, plus cross-reference rename (`F2`) and hover info for nutrition, scaled quantities, and ratios.
|
||||||
- **Diagnostics**: Real-time error checking for missing ingredients, unused references, or circular dependencies.
|
- **Diagnostics & Formatting**: Real-time error checking for missing ingredients, unused references, or circular dependencies, and canonical formatting on save.
|
||||||
|
|
||||||
### CLI (`@gram-lang/cli`)
|
### CLI (`@gram-lang/cli`)
|
||||||
[**View on npmjs**](https://www.npmjs.com/package/@gram-lang/cli)
|
[**View on npmjs**](https://www.npmjs.com/package/@gram-lang/cli)
|
||||||
- **`gram check` & `gram build`**: Validate syntax and compile `.gram` files to JSON.
|
- **`gram check`, `gram format` & `gram build`**: Validate syntax, format `.gram` files canonically, and compile recipes to JSON.
|
||||||
- **`gram cook`**: Step-by-step cooking assistant in your terminal with live timers.
|
- **`gram cook`**: Step-by-step cooking assistant in your terminal with live timers and target-state reminders.
|
||||||
- **`gram view`**: Read a recipe in the terminal, in your language, with the same settings as the editor and the playground (`--mise-en-place`, `--rests`, `--comments`...).
|
- **`gram view`**: Read a recipe in the terminal, in your language, with the same settings as the editor and the playground (`--mise-en-place`, `--rests`, `--comments`...).
|
||||||
- **`gram plan`**: Plan a recipe: the days of work, the visits to the kitchen and what to take out, backward from a serving time (`--serve`) within your hours (`--available`), or find the serving times that work (`--find`).
|
- **`gram plan`**: Plan a recipe: the days of work, the visits to the kitchen and what to take out, backward from a serving time (`--serve`) within your hours (`--available`), or find the serving times that work (`--find`).
|
||||||
- **`gram export` & `gram print`**: Write the recipe or its run sheet (`--view run-sheet`) as HTML, Markdown or text, or in a print layout.
|
- **`gram export` & `gram print`**: Write the recipe or its run sheet (`--view run-sheet`) as HTML, Markdown or text, or in a print layout.
|
||||||
- **`gram scale`**: Resize recipes (e.g., `--scale=2` or `--scale flour=300g`) with before/after comparison tables.
|
- **`gram scale`**: Resize recipes (e.g., `--scale=2` or `--scale flour=300g`) with before/after comparison tables.
|
||||||
- **`gram diff`**: Semantic diff to compare quantities, timings, or temperatures between recipe versions.
|
- **`gram diff`**: Semantic diff to compare quantities, timings, temperatures, or target states between recipe versions.
|
||||||
- **`gram shop`**: Generate aggregated shopping lists across multiple recipes.
|
- **`gram shop`**: Generate aggregated shopping lists across multiple recipes (including structured `--format json` output).
|
||||||
- **`gram suggest`**: Find recipes based on available ingredients (e.g., `--with "butter, eggs"`).
|
- **`gram suggest`**: Find recipes based on available ingredients (e.g., `--with "butter, eggs"`).
|
||||||
- **`gram import`**: Convert recipes from external URLs into `.gram` files.
|
- **`gram import`**: Convert recipes from web URLs, local JSON-LD files, or YouTube videos into `.gram` files via AI.
|
||||||
|
|
||||||
### Database Tooling (`gram db`)
|
### Database Tooling (`gram db`)
|
||||||
Commands to maintain your `ingredients.yaml` file:
|
Commands to maintain your `ingredients.yaml` file:
|
||||||
|
|
@ -126,7 +127,7 @@ This monorepo is divided into specialized packages under `packages/`:
|
||||||
| [**`@gram-lang/i18n`**](./packages/i18n/README.md) | [](https://www.npmjs.com/package/@gram-lang/i18n) | Localization layer for units, categories, and AI prompts. |
|
| [**`@gram-lang/i18n`**](./packages/i18n/README.md) | [](https://www.npmjs.com/package/@gram-lang/i18n) | Localization layer for units, categories, and AI prompts. |
|
||||||
| [**`vscode-extension`**](./packages/vscode-extension/README.md) | [](https://marketplace.visualstudio.com/items?itemName=gram-lang.gram-lang) | The Visual Studio Code extension. |
|
| [**`vscode-extension`**](./packages/vscode-extension/README.md) | [](https://marketplace.visualstudio.com/items?itemName=gram-lang.gram-lang) | The Visual Studio Code extension. |
|
||||||
| [**`@gram-lang/language-server`**](./packages/language-server/README.md) | [](https://www.npmjs.com/package/@gram-lang/language-server) | The LSP providing autocomplete and diagnostics. |
|
| [**`@gram-lang/language-server`**](./packages/language-server/README.md) | [](https://www.npmjs.com/package/@gram-lang/language-server) | The LSP providing autocomplete and diagnostics. |
|
||||||
| **`docs`** | - | The documentation website, which includes the web-based Playground IDE. |
|
| [**`docs`**](./packages/docs/README.md) | - | The documentation website, which includes the web-based Playground IDE. |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -171,7 +172,7 @@ bun run dev
|
||||||
import { getAST } from '@gram-lang/parser';
|
import { getAST } from '@gram-lang/parser';
|
||||||
import { compile } from '@gram-lang/kitchen';
|
import { compile } from '@gram-lang/kitchen';
|
||||||
|
|
||||||
const ast = getAST("[Mix] @flour{200g} and @water{100g}.");
|
const ast = getAST("## My Recipe\n\n[Mix] @flour{200g} and @water{100g}.");
|
||||||
const result = compile(ast);
|
const result = compile(ast);
|
||||||
|
|
||||||
console.log(result.shopping_list);
|
console.log(result.shopping_list);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
# @gram-lang/analyzer
|
# @gram-lang/analyzer
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@gram-lang/analyzer)
|
[](https://www.npmjs.com/package/@gram-lang/analyzer)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
||||||
The physical and nutritional analysis module for the Gram recipe language. It takes a structurally compiled recipe (produced by `@gram-lang/kitchen`) and enriches it with calculated masses, waste yield scaling, and macronutrient estimations based on a provided database.
|
The physical and nutritional analysis module for the Gram recipe language. It takes a structurally compiled recipe (produced by `@gram-lang/kitchen`) and enriches it with calculated masses, waste yield scaling, database-dependent unit ratios, compound quantity sums, and macronutrient estimations based on a provided ingredient database.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# @gram-lang/cli
|
# @gram-lang/cli
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@gram-lang/cli)
|
[](https://www.npmjs.com/package/@gram-lang/cli)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
@ -61,11 +61,27 @@ gram plan my-recipe.gram --find 2026-10-12/2026-10-15 # the serving times that
|
||||||
gram export my-recipe.gram --format html
|
gram export my-recipe.gram --format html
|
||||||
gram print my-recipe.gram --view run-sheet --serve "2026-10-11 13:00"
|
gram print my-recipe.gram --view run-sheet --serve "2026-10-11 13:00"
|
||||||
|
|
||||||
# Cook step by step, with live timers
|
# Cook step by step, with live timers and target-state reminders
|
||||||
gram cook my-recipe.gram
|
gram cook my-recipe.gram
|
||||||
|
|
||||||
# Aggregate the shopping list of the recipes matching a path or a glob
|
# Aggregate the shopping list of the recipes matching a path or a glob
|
||||||
gram shop "menus/*.gram"
|
gram shop "menus/*.gram"
|
||||||
|
gram shop "menus/*.gram" --format json
|
||||||
|
|
||||||
|
# Find recipes matching ingredients you have on hand
|
||||||
|
gram suggest --with "butter, eggs"
|
||||||
|
|
||||||
|
# Import a recipe from a URL, local JSON-LD file, or YouTube video via AI
|
||||||
|
gram import https://example.com/recipe -o my-recipe.gram
|
||||||
|
|
||||||
|
# Maintain your ingredients.yaml database (sync, enrich via AI, lint duplicates)
|
||||||
|
gram db sync "**/*.gram"
|
||||||
|
gram db enrich
|
||||||
|
gram db lint
|
||||||
|
|
||||||
|
# Watch files on save and manage project config
|
||||||
|
gram watch
|
||||||
|
gram config list
|
||||||
```
|
```
|
||||||
|
|
||||||
Run `gram --help` for the full list of commands.
|
Run `gram --help` for the full list of commands.
|
||||||
|
|
@ -75,7 +91,7 @@ Run `gram --help` for the full list of commands.
|
||||||
## 🏗️ Structure
|
## 🏗️ Structure
|
||||||
|
|
||||||
* `src/index.ts`: CLI entry point, registers all subcommands.
|
* `src/index.ts`: CLI entry point, registers all subcommands.
|
||||||
* `src/commands/`: One file per subcommand (`init`, `check`, `format`, `build`, `view`, `plan`, `export`, `print`, `cook`, `scale`, `diff`, `shop`, `import`, `db`, ...).
|
* `src/commands/`: One file per subcommand (`init`, `check`, `format`, `build`, `watch`, `view`, `plan`, `export`, `print`, `cook`, `scale`, `diff`, `shop`, `suggest`, `import`, `db`, `config`, `upgrade`).
|
||||||
* `src/core/`: Shared building blocks (config loading, ingredient database, pipeline orchestration).
|
* `src/core/`: Shared building blocks (config loading, ingredient database, pipeline orchestration).
|
||||||
* `src/services/`: Business logic backing the commands (formatting, scaling, importing, syncing).
|
* `src/services/`: Business logic backing the commands (formatting, scaling, importing, syncing).
|
||||||
* `src/ui/`: Terminal rendering (tables, diffs, interactive views).
|
* `src/ui/`: Terminal rendering (tables, diffs, interactive views).
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@ The Gram documentation site and browser playground: [gram-lang.org](https://gram
|
||||||
|
|
||||||
```text
|
```text
|
||||||
src/
|
src/
|
||||||
├── components/ # Astro components (homepage, header/footer, Starlight overrides)
|
├── components/ # Astro components (homepage, DocsHome, ChangelogPage, Sidebar, overrides)
|
||||||
│ └── playground/ # Vue playground: editor, output panes, options
|
│ └── playground/ # Vue playground: editor, output panes, options
|
||||||
├── content/
|
├── content/
|
||||||
│ ├── docs/ # Starlight docs collection (EN at docs/docs/**, FR at docs/fr/docs/**)
|
│ ├── docs/ # Starlight docs collection (EN at docs/docs/**, FR at docs/fr/docs/**)
|
||||||
│ └── blog/ # Blog posts (en/, fr/)
|
│ └── blog/ # Blog posts (en/, fr/)
|
||||||
├── data/ # Structured content: homepage copy, blog topics, API reference data
|
├── data/ # Structured content: homepage copy, terms, blog topics, API reference data
|
||||||
├── layouts/ # Layout.astro — shared shell for non-Starlight pages (home, blog, playground)
|
├── layouts/ # Layout.astro — shared shell for non-Starlight pages (home, blog, playground)
|
||||||
├── lib/ # Shared utilities (head scripts, FR/EN post resolution)
|
├── lib/ # Shared utilities (changelog/release loaders, head scripts, FR/EN resolution)
|
||||||
├── pages/ # Astro routes; fr/ mirrors the English tree
|
├── pages/ # Astro routes; fr/ mirrors the English tree
|
||||||
└── styles/ # global.css, passed to Starlight via customCss
|
└── styles/ # global.css and starlight/layers.css
|
||||||
```
|
```
|
||||||
|
|
||||||
Routing: Starlight docs live under `/docs/**` and `/fr/docs/**` (not at the root) purely via content-collection file layout, so they don't collide with the Astro-native homepage at `/`.
|
Routing: Starlight docs live under `/docs/**` and `/fr/docs/**` (not at the root) purely via content-collection file layout, so they don't collide with the Astro-native homepage at `/`.
|
||||||
|
|
@ -25,16 +25,16 @@ Routing: Starlight docs live under `/docs/**` and `/fr/docs/**` (not at the root
|
||||||
Run from this directory, or via `turbo`/`bun run --filter=@gram-lang/docs <script>` from the repo root:
|
Run from this directory, or via `turbo`/`bun run --filter=@gram-lang/docs <script>` from the repo root:
|
||||||
|
|
||||||
| Command | Action |
|
| Command | Action |
|
||||||
| :--------------- | :--------------------------------------------------------- |
|
| :------------------ | :--------------------------------------------------------- |
|
||||||
| `bun dev` | Start the dev server at `localhost:4321` |
|
| `bun dev` | Start the dev server at `localhost:4321` |
|
||||||
| `bun run build` | Build the static site to `./dist/`, then check bundle size |
|
| `bun run build` | Build the static site to `./dist/`, then check bundle size |
|
||||||
| `bun run preview` | Preview the production build locally |
|
| `bun run preview` | Preview the production build locally |
|
||||||
| `bun run typecheck` | Run `astro check` |
|
| `bun run typecheck` | Run `astro check` and `vue-tsc` |
|
||||||
|
|
||||||
No environment variables are required — the site builds fully statically, with no runtime secrets.
|
No environment variables are required — the site builds fully statically, with no runtime secrets.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- `astro`/`@astrojs/starlight`/`@astrojs/vue`/`@astrojs/mdx`/`@astrojs/markdown-remark` are pinned to the current stable range in `package.json`; keep them on `^7.1.x`/Starlight `^0.41.x` or later — `astro@7.0.2`'s dev server is broken in this hoisted Bun monorepo (fixed in `7.1.5`).
|
- `astro`/`@astrojs/starlight`/`@astrojs/vue`/`@astrojs/mdx`/`@astrojs/markdown-remark` are pinned to the current stable range in `package.json` (`astro` `^7.4.x` / Starlight `^0.43.x`); keep them on `^7.1.x`/Starlight `^0.41.x` or later — `astro@7.0.2`'s dev server is broken in this hoisted Bun monorepo (fixed in `7.1.5`).
|
||||||
- `scripts/check-bundle-size.mjs` enforces a size budget on the playground's JS chunk (CodeMirror 6 + Shiki, self-hosted); raise the budget deliberately in that file if a change legitimately grows it.
|
- `scripts/check-bundle-size.mjs` enforces a size budget on the playground's JS chunk (CodeMirror 6 + Shiki, self-hosted); raise the budget deliberately in that file if a change legitimately grows it.
|
||||||
- `scripts/generate-llms-full.ts` regenerates `public/llms-full.txt`/`llms.txt` as a `prebuild` step.
|
- `scripts/vendor-starlight-tokens.ts` and `scripts/generate-llms-full.ts` run as `prebuild` steps (syncing Starlight tokens and regenerating `public/llms-full.txt`/`llms.txt`).
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# @gram-lang/format
|
# @gram-lang/format
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@gram-lang/format)
|
[](https://www.npmjs.com/package/@gram-lang/format)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
@ -52,19 +52,20 @@ if (hasChanges(changes)) {
|
||||||
|
|
||||||
* `src/index.ts`: Exports `formatGram`, `hasChanges`, and `summarizeChanges`.
|
* `src/index.ts`: Exports `formatGram`, `hasChanges`, and `summarizeChanges`.
|
||||||
|
|
||||||
The package enforces canonical formatting rules across `.gram` files (preserving frontmatter boundary integrity):
|
The package enforces canonical formatting rules across `.gram` files (preserving frontmatter boundary integrity and never altering target state text inside `={...}`):
|
||||||
1. Lowercase ingredient IDs (`@Farine` → `@farine`)
|
1. Lowercase ingredient IDs (`@Farine` → `@farine`)
|
||||||
2. Remove space between `@id` and `{` (`@ing {10g}` → `@ing{10g}`)
|
2. Remove space between `@id` and `{` (`@ing {10g}` → `@ing{10g}`)
|
||||||
3. Trim spaces inside braces (`{ 10g }` → `{10g}`)
|
3. Trim spaces inside braces (`{ 10g }` → `{10g}`)
|
||||||
4. Remove trailing decimal zeros (`{500.0g}` → `{500g}`)
|
4. Remove trailing decimal zeros after a point or comma (`{500.0g}` → `{500g}`, `{1,50}` → `{1,5}`, leaving `{1,000}` intact)
|
||||||
5. Normalize temperature unit spacing (`{180 °C}` → `{180°C}`)
|
5. Normalize spacing around `+`/`-` in compound ingredient quantities (`{1 cup+2 tbsp}` → `{1 cup + 2 tbsp}`)
|
||||||
6. Normalize composite ingredient separator spacing (`<@`)
|
6. Normalize temperature unit spacing (`{180 °C}` → `{180°C}`)
|
||||||
7. Normalize arrow declaration spacing (`->&name{}`)
|
7. Normalize composite ingredient separator spacing (`<@`)
|
||||||
8. Normalize section header spacing (`## Header`)
|
8. Normalize arrow declaration spacing (`->&name{}`)
|
||||||
9. Convert tabs to 4 spaces
|
9. Normalize section header spacing (`## Header`)
|
||||||
10. Trim trailing whitespace line by line
|
10. Convert tabs to 4 spaces
|
||||||
11. Collapse consecutive blank lines to single blank lines
|
11. Trim trailing whitespace line by line
|
||||||
12. Ensure single newline at end of file
|
12. Collapse consecutive blank lines to single blank lines
|
||||||
|
13. Ensure single newline at end of file
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# @gram-lang/i18n
|
# @gram-lang/i18n
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@gram-lang/i18n)
|
[](https://www.npmjs.com/package/@gram-lang/i18n)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
@ -47,11 +47,13 @@ console.log(resolveTimeUnit('minutes')); // 'm'
|
||||||
`getDictionary(lang)` returns the dictionary of a language (`en` or `fr`): the labels of the renderer's views (`renderer.*`, including the names of the outputs and of the formats), the units of durations (`renderer.durationUnits`, `1h 30min` or `1j 1h`) and the strings of the playground. `fillTemplate(template, values)` fills the `{name}` placeholders of a dictionary string (`"Serve at {time}"` becomes `"Serve at 20:00"`) and leaves a name with no value as written, so a missing value shows up instead of vanishing.
|
`getDictionary(lang)` returns the dictionary of a language (`en` or `fr`): the labels of the renderer's views (`renderer.*`, including the names of the outputs and of the formats), the units of durations (`renderer.durationUnits`, `1h 30min` or `1j 1h`) and the strings of the playground. `fillTemplate(template, values)` fills the `{name}` placeholders of a dictionary string (`"Serve at {time}"` becomes `"Serve at 20:00"`) and leaves a name with no value as written, so a missing value shows up instead of vanishing.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import { getDictionary, fillTemplate } from '@gram-lang/i18n';
|
import { getDictionary, fillTemplate, formatNumber, parseDuration } from '@gram-lang/i18n';
|
||||||
|
|
||||||
const t = getDictionary('fr');
|
const t = getDictionary('fr');
|
||||||
console.log(t.renderer.durationUnits); // { day: 'j', hour: 'h', minute: 'min', second: 's' }
|
console.log(t.renderer.durationUnits); // { day: 'j', hour: 'h', minute: 'min', second: 's' }
|
||||||
console.log(fillTemplate('Serve at {time}', { time: '20:00' })); // 'Serve at 20:00'
|
console.log(fillTemplate('Serve at {time}', { time: '20:00' })); // 'Serve at 20:00'
|
||||||
|
console.log(formatNumber(1.5, 'fr')); // '1,5'
|
||||||
|
console.log(parseDuration('1h 30min')); // { ok: true, kind: 'single', ... }
|
||||||
```
|
```
|
||||||
|
|
||||||
A key is added in both languages together: a surface never carries a word of its own.
|
A key is added in both languages together: a surface never carries a word of its own.
|
||||||
|
|
@ -70,6 +72,9 @@ If a language-specific code (e.g., `'fr'`) is provided, the function checks the
|
||||||
* `src/dictionary.ts`: Dictionary compiler helper that transforms structured translations into flat `O(1)` maps.
|
* `src/dictionary.ts`: Dictionary compiler helper that transforms structured translations into flat `O(1)` maps.
|
||||||
* `src/units.ts`: Mass and volume unit dictionary (French & English) and normalizer.
|
* `src/units.ts`: Mass and volume unit dictionary (French & English) and normalizer.
|
||||||
* `src/time.ts`: Time unit dictionary (French & English) and normalizer.
|
* `src/time.ts`: Time unit dictionary (French & English) and normalizer.
|
||||||
|
* `src/duration.ts`: Compound, clock, prime, and range duration parser (`parseDuration()`).
|
||||||
|
* `src/numbers.ts`: Locale-aware number formatting (`formatNumber()`, `localizeDecimals()`, `toKitchenFraction()`).
|
||||||
|
* `src/quantity.ts`: Quantity term arithmetic and formatting (`termsTotal()`, `mergeTerms()`, `scaleTerms()`, `formatTerms()`).
|
||||||
* `src/locales/`: The `en` and `fr` dictionaries (renderer views, nutrients, playground) and `getDictionary()`.
|
* `src/locales/`: The `en` and `fr` dictionaries (renderer views, nutrients, playground) and `getDictionary()`.
|
||||||
* `src/template.ts`: `fillTemplate()`.
|
* `src/template.ts`: `fillTemplate()`.
|
||||||
* `src/categories.ts`: Shopping list category keys and their labels per language.
|
* `src/categories.ts`: Shopping list category keys and their labels per language.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
# @gram-lang/kitchen
|
# @gram-lang/kitchen
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@gram-lang/kitchen)
|
[](https://www.npmjs.com/package/@gram-lang/kitchen)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
||||||
The compiler for the Gram recipe language. It takes a typed Recipe AST (produced by `@gram-lang/parser`) and compiles it into a structured, minified recipe JSON (aggregating shopping lists, processing sections, splitting the mise en place by section, and laying out the task graph and the default schedule). The scheduling itself is done by [`@gram-lang/scheduler`](../scheduler/README.md), which kitchen feeds with a neutral list of tasks..
|
The compiler for the Gram recipe language. It takes a typed Recipe AST (produced by `@gram-lang/parser` or composed by `@gram-lang/modules`) and compiles it into a structured, minified recipe JSON (aggregating shopping lists, processing sections, resolving compound quantities and same-family unit ratios, splitting the mise en place by section, and laying out the task graph and default schedule). The scheduling itself is done by [`@gram-lang/scheduler`](../scheduler/README.md), which kitchen feeds with a neutral list of tasks.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -33,6 +33,7 @@ import { compile } from '@gram-lang/kitchen';
|
||||||
|
|
||||||
const source = `
|
const source = `
|
||||||
## My Recipe
|
## My Recipe
|
||||||
|
|
||||||
[Mix] @flour{200g} and @water{100ml} for ~{5min}.
|
[Mix] @flour{200g} and @water{100ml} for ~{5min}.
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
@ -53,13 +54,15 @@ console.log(result.miseEnPlace); // How long each section's own preparat
|
||||||
|
|
||||||
## 🏗️ Structure
|
## 🏗️ Structure
|
||||||
|
|
||||||
* `src/core.ts`: The main compiler entry point.
|
* `src/core.ts`: The main compiler entry point (`compile`).
|
||||||
* `src/processor.ts`: Processes step-by-step block content, local scopes, and timers.
|
* `src/processor.ts`: Processes step-by-step block content, local scopes, and timers.
|
||||||
* `src/section.ts`: Compiles individual recipe sections.
|
* `src/section.ts`: Compiles individual recipe sections.
|
||||||
* `src/shopping.ts`: Deduplicates and aggregates ingredients into a master shopping list.
|
* `src/shopping.ts`: Deduplicates and aggregates ingredients into a master shopping list.
|
||||||
|
* `src/terms.ts`, `src/compound.ts`: Normalizes and evaluates compound quantities (`1 cup + 2 tbsp`).
|
||||||
|
* `src/ratio.ts`: Resolves unit ratios (`resolveRatios`) and scales proportional timers.
|
||||||
* `src/mise-en-place.ts`, `src/metrics.ts`: Split the preparation (ingredients, cookware, intermediates) by section, and compute the preparation time.
|
* `src/mise-en-place.ts`, `src/metrics.ts`: Split the preparation (ingredients, cookware, intermediates) by section, and compute the preparation time.
|
||||||
* `src/task-graph.ts`: Builds the list of tasks (steps, timers, preparations) and what each one waits for, handed to the scheduler.
|
* `src/task-graph.ts`, `src/step-timing.ts`: Builds the list of tasks (steps, timers, preparations) and what each one waits for, handed to the scheduler.
|
||||||
* `src/schedule-mode.ts`: `scheduleFor()` and `scheduleTimes()`, to choose between the timelines (`perSection`, `upfront`, `perDay`) the same way everywhere.
|
* `src/schedule-mode.ts`, `src/recompute.ts`: `scheduleFor()`, `scheduleTimes()`, and `recomputeSchedule()` after scaling or ratio resolution.
|
||||||
* `src/schedule-warnings.ts`, `src/overlap-warnings.ts`: Turn what the scheduler reports (`DAY_OVERFLOW`, track contention...) and passive overlaps on the same cookware (`PASSIVE_OVERLAP_SAME_COOKWARE`) into compiler warnings.
|
* `src/schedule-warnings.ts`, `src/overlap-warnings.ts`: Turn what the scheduler reports (`DAY_OVERFLOW`, track contention...) and passive overlaps on the same cookware (`PASSIVE_OVERLAP_SAME_COOKWARE`) into compiler warnings.
|
||||||
* `src/legacy-timings.ts`: The deprecated `steps[].timings` and `metrics` time fields, kept until 2.0.0.
|
* `src/legacy-timings.ts`: The deprecated `steps[].timings` and `metrics` time fields, kept until 2.0.0.
|
||||||
* `src/graph.ts`: Traverses relative quantities and runs cycle detection (DFS).
|
* `src/graph.ts`: Traverses relative quantities and runs cycle detection (DFS).
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# @gram-lang/language-server
|
# @gram-lang/language-server
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@gram-lang/language-server)
|
[](https://www.npmjs.com/package/@gram-lang/language-server)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
@ -56,10 +56,12 @@ client.start();
|
||||||
## 🏗️ Capabilities
|
## 🏗️ Capabilities
|
||||||
|
|
||||||
The Gram Language Server currently supports:
|
The Gram Language Server currently supports:
|
||||||
* **Diagnostics:** Real-time syntax and semantic validation.
|
* **Diagnostics:** Real-time syntax and semantic validation (including compound quantities, unit ratios, durations, and target states).
|
||||||
* **Semantic Tokens:** Rich semantic highlighting for ingredients, quantities, cookware, and timers.
|
* **Semantic Tokens:** Rich semantic highlighting for ingredients, quantities, cookware, timers, temperatures, and target states (`={...}`).
|
||||||
* **Hover:** Nutritional information and scaled quantities on hover.
|
* **Hover:** Nutritional information, scaled quantities, duration breakdowns, and unit-ratio details on hover.
|
||||||
* **Completion:** Suggestions for units, ingredients (based on the user's local ingredient DB), and cookware.
|
* **Completion:** Suggestions for units (including ratio denominators), ingredients (from the user's local ingredient DB), cookware, and `@use` import paths.
|
||||||
|
* **Navigation & Refactoring:** Go to Definition, Find All References, Rename Symbol (`F2` across references, `%`, and unit ratios), Document Symbols (Outline), and Folding Ranges.
|
||||||
|
* **Code Actions, Inlay Hints & CodeLens:** Quick fixes for common diagnostics, total time / duration inlay hints, and `▶ Preview` CodeLens.
|
||||||
* **Document Formatting:** Automatic formatting of `.gram` files to the standard canonical style (powered by [`@gram-lang/format`](../format/README.md)).
|
* **Document Formatting:** Automatic formatting of `.gram` files to the standard canonical style (powered by [`@gram-lang/format`](../format/README.md)).
|
||||||
* **Views protocol:** Renders only the views and inspectors currently open in the client (`gram/setOpenViews`) and answers with `gram/viewUpdated` (recipe and run sheet as HTML, AST and compiled JSON as text or an interactive tree). When a recipe has errors, open outputs are paused instead of replaced by an error card, with a localized error summary beside the usual diagnostics. The outputs a client can open are listed, with their names in the editor's language, in the `initialize` result (`capabilities.experimental.gramViews`), so a client shows a new view without an update of its own. Legacy clients continue receiving `gram/previewUpdated` and `gram/ganttUpdated` (both deprecated) until 2.0.0.
|
* **Views protocol:** Renders only the views and inspectors currently open in the client (`gram/setOpenViews`) and answers with `gram/viewUpdated` (recipe and run sheet as HTML, AST and compiled JSON as text or an interactive tree). When a recipe has errors, open outputs are paused instead of replaced by an error card, with a localized error summary beside the usual diagnostics. The outputs a client can open are listed, with their names in the editor's language, in the `initialize` result (`capabilities.experimental.gramViews`), so a client shows a new view without an update of its own. Legacy clients continue receiving `gram/previewUpdated` and `gram/ganttUpdated` (both deprecated) until 2.0.0.
|
||||||
* **Sessions:** `gram/setSession` sets the transient choices of a recipe, held in memory and never written to the file: the serving time (which puts the run sheet on the calendar, in the project's `timezone` and within its `availability`), the scale, the imports already in stock and the baker's reference. `gram/sessionChoices` says what these controls offer for a recipe as written (its ingredients, its `@use` imports, whether baker's math is on), and `gram/serveTimes` proposes the serving times that work over the next days, at the project's `mealTimes`, with the reasons of the others.
|
* **Sessions:** `gram/setSession` sets the transient choices of a recipe, held in memory and never written to the file: the serving time (which puts the run sheet on the calendar, in the project's `timezone` and within its `availability`), the scale, the imports already in stock and the baker's reference. `gram/sessionChoices` says what these controls offer for a recipe as written (its ingredients, its `@use` imports, whether baker's math is on), and `gram/serveTimes` proposes the serving times that work over the next days, at the project's `mealTimes`, with the reasons of the others.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
# @gram-lang/modules
|
# @gram-lang/modules
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/@gram-lang/modules)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
@ -10,4 +11,52 @@ This package defines the host interface (`ModuleHost`) and implements none that
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 📚 General Documentation
|
||||||
|
|
||||||
|
For full syntax specifications, `@use` import rules, and best practices, please refer to the **[Gram Documentation](https://gram-lang.org/docs/)**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠️ Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @gram-lang/modules
|
||||||
|
# or
|
||||||
|
bun add @gram-lang/modules
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚡ Usage
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { createMemoryHost, loadModuleGraph, composeRecipe } from '@gram-lang/modules';
|
||||||
|
import { compile } from '@gram-lang/kitchen';
|
||||||
|
|
||||||
|
const host = createMemoryHost({
|
||||||
|
'/bases/dough.gram': '## Dough ->&dough\n\nMix @flour{500g} and @water{300ml}.\n',
|
||||||
|
'/pizza.gram': '@use "./bases/dough.gram" as &dough\n\n## Bake\n\nTop &dough{250g} and bake.\n'
|
||||||
|
});
|
||||||
|
|
||||||
|
const graph = await loadModuleGraph('/pizza.gram', host);
|
||||||
|
const composed = composeRecipe(graph, { db: {} });
|
||||||
|
const compiled = compile(composed.ast);
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🏗️ Structure
|
||||||
|
|
||||||
|
* `src/host.ts`: `ModuleHost` interface and `ModuleGraph` types.
|
||||||
|
* `src/memory-host.ts`: `createMemoryHost()`, in-memory virtual host.
|
||||||
|
* `src/graph.ts`: `loadModuleGraph()`, recursive import loader and cycle detection.
|
||||||
|
* `src/exports.ts`: Computes each module's public exports.
|
||||||
|
* `src/yield.ts`: Measures imported module yields for scaling and `--stock`.
|
||||||
|
* `src/rename.ts`: Renames intermediates to avoid collisions across modules.
|
||||||
|
* `src/compose.ts`: `composeRecipe()`, splices composed sections into a single AST.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 License
|
||||||
|
|
||||||
Licensed under [GPL-3.0-or-later](https://www.gnu.org/licenses/gpl-3.0.html).
|
Licensed under [GPL-3.0-or-later](https://www.gnu.org/licenses/gpl-3.0.html).
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# @gram-lang/parser
|
# @gram-lang/parser
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@gram-lang/parser)
|
[](https://www.npmjs.com/package/@gram-lang/parser)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
A robust, 3-stage parser for the Gram recipe language. It is part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram) and is strictly limited to text-to-AST parsing.
|
A robust, 3-stage parser for the Gram recipe language. It is part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram) and is strictly limited to text-to-AST parsing.
|
||||||
|
|
@ -32,6 +32,7 @@ import { getAST } from '@gram-lang/parser';
|
||||||
|
|
||||||
const source = `
|
const source = `
|
||||||
## My Recipe
|
## My Recipe
|
||||||
|
|
||||||
Mix @flour{200g} and @water{100ml}.
|
Mix @flour{200g} and @water{100ml}.
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
@ -45,8 +46,11 @@ try {
|
||||||
|
|
||||||
## 🏗️ Structure
|
## 🏗️ Structure
|
||||||
|
|
||||||
* `src/index.ts`: Orchestrates parsing and Ohm Semantics to AST conversions.
|
* `src/index.ts`: Orchestrates parsing and Ohm Semantics to AST conversions (`getAST`, `GramParseError`).
|
||||||
* `src/types.ts`: Declares strictly-typed AST node definitions.
|
* `src/types.ts`: Declares strictly-typed AST node definitions.
|
||||||
|
* `src/guards.ts`: Type guards for AST nodes.
|
||||||
|
* `src/numbers.ts`: Number, mixed fraction, and decimal comma/point parsers.
|
||||||
|
* `src/schemas.ts`: Zod schemas for AST structures.
|
||||||
* `grammar.ohm`: The official OhmJS grammar defining the Gram language structure.
|
* `grammar.ohm`: The official OhmJS grammar defining the Gram language structure.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
# @gram-lang/renderer
|
# @gram-lang/renderer
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@gram-lang/renderer)
|
[](https://www.npmjs.com/package/@gram-lang/renderer)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
||||||
The renderer of the Gram recipe language. It turns a compiled (or analyzed) recipe into **views**, the recipe and its run sheet, each written in every format it offers: semantic HTML, Markdown, plain text and a print layout. The views follow a list of settings (comments, mise en place, rests, quantities in the steps, nutrition basis...) that the CLI, the editor and the playground read from the same place. The engine computes, the views only show.
|
The renderer of the Gram recipe language. It turns a compiled (or analyzed) recipe into **views**, the recipe and its run sheet, each written in every format it offers: semantic HTML, Markdown, plain text and a print layout — including compound quantities, unit ratios, temperature notes, and target states (`={...}`). The views follow a list of settings (comments, mise en place, rests, quantities in the steps, nutrition basis...) that the CLI, the editor and the playground read from the same place. The engine computes, the views only show.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,55 @@
|
||||||
# @gram-lang/scheduler
|
# @gram-lang/scheduler
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/@gram-lang/scheduler)
|
||||||
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
||||||
The scheduling engine behind Gram recipes. It lays tasks out on a timeline (as-late-as-possible backward pass, named-track contention, mise en place placement, working days) from a neutral description of the work, and knows nothing about the Gram AST or the compiled recipe: `@gram-lang/kitchen` feeds it and writes the result into the compiled JSON.
|
The scheduling engine behind Gram recipes. It lays tasks out on a timeline (as-late-as-possible backward pass, named-track contention, mise en place placement, working days) from a neutral description of the work, and knows nothing about the Gram AST or the compiled recipe: `@gram-lang/kitchen` feeds it and writes the result into the compiled JSON.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📚 General Documentation
|
||||||
|
|
||||||
|
For full scheduling concepts, availability settings, and run sheet details, please refer to the **[Gram Documentation](https://gram-lang.org/docs/)**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠️ Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @gram-lang/scheduler
|
||||||
|
# or
|
||||||
|
bun add @gram-lang/scheduler
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚡ Usage
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { getAST } from '@gram-lang/parser';
|
||||||
|
import { compile } from '@gram-lang/kitchen';
|
||||||
|
import { layout, project, runSheet } from '@gram-lang/scheduler';
|
||||||
|
|
||||||
|
const compiled = compile(getAST('## Dough\n\n[Mix] @flour{500g}.\n\n[Rest] ~_{8-16h}.\n'));
|
||||||
|
|
||||||
|
// 1. Re-lay out the timeline without re-compiling
|
||||||
|
const { schedule } = layout(compiled.tasks, { miseEnPlace: 'upfront', rests: 'balanced' });
|
||||||
|
|
||||||
|
// 2. Project onto a calendar working backward from serving time
|
||||||
|
const plan = project([{ graph: compiled.tasks }], {
|
||||||
|
serveAt: '2026-10-17T20:00',
|
||||||
|
timeZone: 'Europe/Paris',
|
||||||
|
availability: { daily: [{ start: '08:00', end: '22:00' }] }
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. Group into days, kitchen visits, and background threads
|
||||||
|
const sheet = runSheet(plan, { graph: compiled.tasks });
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🏗️ API Overview
|
||||||
|
|
||||||
- `layout(tasks, { miseEnPlace, rests })` lays a task graph out on a timeline, in minutes from the start.
|
- `layout(tasks, { miseEnPlace, rests })` lays a task graph out on a timeline, in minutes from the start.
|
||||||
- `project([{ graph }], { serveAt, timeZone, availability })` places that timeline on the calendar, ending at the serving time, and moves the rests written as a range so the cook's own work falls when they are available. It reads no clock and no time zone of the machine: the same input always gives the same plan.
|
- `project([{ graph }], { serveAt, timeZone, availability })` places that timeline on the calendar, ending at the serving time, and moves the rests written as a range so the cook's own work falls when they are available. It reads no clock and no time zone of the machine: the same input always gives the same plan.
|
||||||
- `runSheet(plan | schedule, { graph, context })` groups a plan (or a bare schedule, in days before the service) into the days, the visits to the kitchen and the threads that go on without the cook, with the margin of each visit.
|
- `runSheet(plan | schedule, { graph, context })` groups a plan (or a bare schedule, in days before the service) into the days, the visits to the kitchen and the threads that go on without the cook, with the margin of each visit.
|
||||||
|
|
@ -11,3 +57,9 @@ The scheduling engine behind Gram recipes. It lays tasks out on a timeline (as-l
|
||||||
- `parseAvailability()`, `parseMealTimes()`, `isTimeZone()`, `availabilityEntries()` and `isCalendarDate()` read and check a project's settings (`08:00-22:00`, `fri=18:00-22:00`, `2026-10-09=none`), so the CLI and the editor read them the same way; a date that does not exist (a 30th of February) is refused instead of moved to the next month.
|
- `parseAvailability()`, `parseMealTimes()`, `isTimeZone()`, `availabilityEntries()` and `isCalendarDate()` read and check a project's settings (`08:00-22:00`, `fri=18:00-22:00`, `2026-10-09=none`), so the CLI and the editor read them the same way; a date that does not exist (a 30th of February) is refused instead of moved to the next month.
|
||||||
- Each visit of the run sheet lists the sections it cooks and when each starts, and `visitSections()` gives the sections to name a visit after.
|
- Each visit of the run sheet lists the sections it cooks and when each starts, and `visitSections()` gives the sections to name a visit after.
|
||||||
- `MISE_EN_PLACE_MODES` (`perSection`, `upfront`, `perDay`) and `REST_CHOICES` (`shortest`, `balanced`, `longest`) are the choices `layout()` takes, with their defaults and guards.
|
- `MISE_EN_PLACE_MODES` (`perSection`, `upfront`, `perDay`) and `REST_CHOICES` (`shortest`, `balanced`, `longest`) are the choices `layout()` takes, with their defaults and guards.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 License
|
||||||
|
|
||||||
|
This project is licensed under the GPL-3.0 License.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
# Gram Language Support
|
# Gram - Recipe Language
|
||||||
|
|
||||||
[](https://marketplace.visualstudio.com/items?itemName=gram-lang.gram-lang)
|
[](https://marketplace.visualstudio.com/items?itemName=gram-lang.gram-lang)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
||||||
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
*Part of the [Gram monorepo](https://git.gram-lang.org/gram-lang/gram).*
|
||||||
|
|
||||||
The official Visual Studio Code extension for the Gram recipe language. It provides a full language server with real-time diagnostics, advanced editing assistance, semantic highlighting, and a dynamic Live Preview.
|
The official Visual Studio Code extension for the Gram recipe language. It provides a full language server with real-time diagnostics, advanced editing assistance, semantic highlighting (including compound quantities, unit ratios, temperature notes, and target states), and a dynamic Live Preview.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue