Command line tools for working with Cooklang recipes.
CookCLI provides a suite of commands to create shopping lists, reports and maintain recipes. We've built it to be simple and useful for automating your cooking and shopping routine with existing UNIX command line and scripting tools. It can also function as a webserver for your recipes, making them browsable on any device with a web browser.
With CookCLI, you can:
- integrate your Cooklang recipes with other tools
- script meal planning and shopping
- evaluate your recipes or menus with reports
- of course cook with your terminal open
First, install CookCLI using one of the methods below. CookCLI comes with a few sample recipes to play with:
$ cook seed
$ cook recipe "Neapolitan Pizza.cook"
This displays the recipe in a human-readable format:
Neapolitan Pizza
source: https://www.stadlermade.com/how-to-pizza-dough/neapolitan/
servings: 6
Ingredients:
semolina
Pizza Dough (recipe: Shared/Pizza Dough) 6 balls
flour
semolina
San Marzano tomato sauce 5 tbsp
basil leaves
mozzarella cheese 100 grams
Cookware:
outdoor oven
spatula
Steps:
1. Preheat your outdoor oven so it’s around 450/500°C (842/932°F).
[-]
2. Prepare your pizza toppings because from now on you wanna work fast.
Sprinkle some semolina on your work surface.
[semolina]
...
Create a shopping list from multiple recipes:
$ cook -v shopping-list "Neapolitan Pizza.cook" "./Breakfast/Easy Pancakes.cook""
Or start the web server to browse your recipes:
$ cook server --open
Listening on http://127.0.0.1:9080
Serving Web UI on http://localhost:9080
Serving recipe files from: "/Users/chefalexey/recipes"



Download the latest release for your platform from the releases page and add it to your PATH.
Using Homebrew:
brew tap cooklang/tap
brew install cooklang/tap/cookcli
not working at the moment, re: #155 (comment)
If you have Rust installed:
cargo install cookcli
You'll need Rust and Node.js installed. Then:
# Clone the repository
git clone https://github.com/cooklang/CookCLI.git
cd CookCLI
# Install frontend dependencies
npm install
# Build CSS (required for web UI)
npm run build-css
# Build the CLI with web UI
cargo build --release
# Binary will be at target/release/cook
For development with hot-reload of CSS changes:
# Install dependencies
npm install
# In one terminal, watch CSS changes
npm run watch-css
# In another terminal, run the development server
cargo run -- server ./seed
# Or use the Makefile
make dev_server # Builds CSS and starts server
CookCLI follows the UNIX philosophy: each command does one thing well.
Parse and display recipe files. You can view them in different formats and scale quantities.
# View a recipe
cook recipe "Pasta Carbonara.cook"
# Scale a recipe to 2x
cook recipe "Pizza.cook:2"
# Output as JSON
cook recipe "Soup.cook" -f json
# Save as Markdown
cook recipe "Cake.cook" -f markdown > cake.md
Generate shopping lists from one or more recipes. Ingredients are automatically combined and organized by store section.
# Single recipe
cook shopping-list "Dinner.cook"
# Multiple recipes with scaling
cook shopping-list "Pasta.cook:3" "Salad.cook"
# All recipes in a directory
cook shopping-list *.cook
Run a web server to browse your recipes from any device.
# Start on localhost
cook server
# Allow access from other devices on your network
cook server --host
# Use a different port
cook server --port 8080
# Open browser immideately
cook server --open
Find recipes by searching through ingredients, instructions, and metadata.
# Search for recipes with chicken
cook search chicken
# Find quick recipes
cook search "30 minutes"
# Search in specific directory
cook search -b ~/recipes pasta
Import recipes from websites and convert them to Cooklang format. Requires
OPENAI_API_KEY
environment variable set.
# Import a recipe
cook import https://www.example.com/recipe > recipe.cook
# Import without conversion
cook import https://www.example.com/recipe --skip-conversion
Check your recipe collection for issues and maintain consistency.
# Validate all recipes and display parsing errors
cook doctor validate
# Check aisle configuration for shopping lists
cook doctor aisle
# Check pantry configuration
cook doctor pantry
# Run all checks
cook doctor
Add sample recipes to explore Cooklang features.
# Add to current directory
cook seed
# Add to specific directory
cook seed ~/my-recipes
Generate custom outputs using templates (experimental feature).
# Generate a recipe card
cook report -t recipe-card.md.jinja recipe.cook
# Create nutrition label
cook report -t nutrition.html.jinja recipe.cook
Detailed documentation for each command is available in the docs/ directory:
- Recipe command - viewing and converting recipes
- Shopping lists - creating shopping lists
- Server - web interface
- Search - finding recipes
- Import - importing from websites
- Doctor - validation and maintenance
- Seed - example recipes
- Report - custom outputs
CookCLI looks for configuration files in:
./config/
- in your recipe directory (highest priority)~/.config/cooklang/
- in your home directory (fallback)~/Library/Application Support/cook/
- on macOS (fallback)
Configuration files:
aisle.conf
- Organizes ingredients by store sectionpantry.conf
- Tracks your ingredient inventory with quantities
Organizes ingredients by store section for shopping lists. Items not in any category will appear under "Other".
[produce]
tomatoes|tomato
basil|basil leaves
garlic
onions
[dairy]
milk
cheese
yogurt
butter
[pantry]
flour
sugar
pasta
rice
olive oil
[meat]
chicken
beef
pork
[bakery]
bread
rolls
Tracks your ingredient inventory with quantities and expiration dates. Items in your pantry are excluded from shopping lists automatically.
[freezer]
ice_cream = "1%L"
frozen_peas = "500%g"
spinach = { bought = "05.05.2024", expire = "05.06.2024", quantity = "1%kg" }
[fridge]
milk = { expire = "10.05.2024", quantity = "2%L" }
cheese = { expire = "15.05.2024" }
butter = "250%g"
[pantry]
rice = "5%kg"
pasta = "1%kg"
flour = "5%kg"
olive_oil = "1%L"
salt = "1%kg"
Pantry items can be specified in two formats:
- Simple:
item = "quantity"
- Detailed:
item = { quantity = "amount", expire = "date", bought = "date" }
Items listed in your pantry will be automatically excluded from shopping lists, helping you track what you already have at home.
# Shopping list will organize by aisle and exclude pantry items
cook shopping-list "Pasta.cook"
# Check which ingredients aren't categorized
cook doctor aisle
# Use specific config directory
cook shopping-list "Recipe.cook" --aisle ./my-config/aisle.conf
# Example: Recipe calls for salt, pepper, chicken, tomatoes
# With pantry.conf containing salt and rice in your inventory:
# Shopping list will only show: pepper, chicken, tomatoes
CookCLI has different level of logging. You can pass -v
to show info messages, -vv
for debug and -vvv
for trace. Use it if you want to submit bug report because it will help us to better understand what's going on.
Use the :
notation to scale any recipe:
cook recipe "Pizza.cook:2" # Double
cook shopping-list "Pasta.cook:0.5" # Half
CookCLI works great with pipes and standard tools:
# Find all recipes with chicken and create a shopping list
cook search eggs | xargs cook shopping-list
# Convert all recipes to Markdown
for r in *.cook; do
cook recipe "$r" -f markdown > "docs/${r%.cook}.md"
done
Why not? It will help more people discover this tool and Cooklang.
We welcome contributions! See CONTRIBUTING.md for guidelines.
Areas where we'd love help:
- Bug fixes and testing
- Documentation improvements
- New features
- Recipe collections
- Translations
- UI/UX improvements
MIT License. See LICENSE for details.
Some source files include code from cooklang-chef, also under MIT license.
- Cooklang Specification - the recipe markup language
- Cooklang Apps - iOS and Android apps
- Issue Tracker - report bugs
- Twitter - updates and news
- Playground
- Discord server, ask for help or say hello fellow cooks
- Spec discussions, suggest a new idea or give your opinion on future development
- Awesome Cooklang Recipes, find inspiration or share your recipes with the community.