How to generate a weekly shopping list
If you use Gram for meal prepping or batch cooking, you likely have multiple .gram files scattered in a directory.
Generating a single, consolidated shopping list across multiple recipes is one of Gram’s most powerful features. The @gram-lang/kitchen compiler aggregates ingredients intelligently, fusing quantities when possible.
The gram shop command
Section titled “The gram shop command”Use the CLI gram shop command and pass a glob pattern targeting your recipes.
What happens during aggregation?
Section titled “What happens during aggregation?”- ID Matching: The compiler groups all ingredients that share the same base ID (e.g., all instances of
@butter). - Alias Resolution: If your database defines
unsalted butteras an alias forbutter, Gram will seamlessly merge@unsalted butter{50g}and@butter{50g}into a single100gentry, grouped internally under the canonical idbutter. The displayed name isn’t forced tobutterthough — it comes from whichever recipe’s own wording was processed first, enriched with the database’s nicer name only when that recipe already used the exact canonical word itself. See Shopping List Aggregation for the full rule. - Unit Normalization: If one recipe uses
@milk{200ml}and another uses@milk{1 cup}, the analyzer uses the database to normalize them (usually into grams, or whichever display unit you configured). - Categorization: The final list is sorted by culinary categories (e.g., Dairy, Produce, Pantry) based on your
ingredients.yamldata, making it easy to navigate a supermarket.
Batch scaling
Section titled “Batch scaling”You can scale your entire meal plan at once. If your recipes are written for 2 portions, but you have 4 guests this week, you can pass a global scale multiplier:
Output formats
Section titled “Output formats”By default, gram shop outputs a beautifully formatted ASCII list directly in your terminal.
However, you can export it to different formats to share it with your family or integrate it with other tools: