CookCLI
Command line tools for working with Cooklang recipes.
π― Quick Install
# macOS/Linux (Homebrew)
# Download binary (all platforms)
# Visit: https://github.com/cooklang/CookCLI/releases
π Table of Contents
- What is CookCLI?
- Getting Started
- Installation
- Commands
- Documentation
- Configuration
- Tips
- Contributing
- Contributors
- License
- Support
π What is CookCLI?
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.
Try the web interface live at demo.cooklang.org
β¨ Features
- π§ UNIX Philosophy - Integrate your Cooklang recipes with other tools
- π Meal Planning - Script meal planning and shopping
- π Reports - Evaluate your recipes or menus with custom reports
- π Web Interface - Browse recipes from any device
- π Smart Shopping - Generate organized shopping lists
- π Recipe Search - Find recipes quickly
- π¦ Pantry Tracking - Manage inventory and expiration dates
π Getting Started
First, install CookCLI using one of the methods below. CookCLI comes with a few sample recipes to play with:
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:
Or start the web server to browse your recipes:
π¦ Installation
Download Binary
Download the latest release for your platform from the releases page and add it to your PATH.
macOS
Using Homebrew:
Install with Cargo
not working at the moment, re: https://github.com/cooklang/cookcli/issues/155#issuecomment-3239646168
If you have Rust installed:
Build from Source
You'll need Rust and Node.js installed. Then:
# Clone the repository
# Install frontend dependencies
# Build CSS (required for web UI)
# Build the CLI with web UI
# Binary will be at target/release/cook
Building without Self-Update
By default, CookCLI includes a self-update feature. To build without this feature (useful for CI/CD pipelines, package managers, or environments where auto-update is not desired):
# Build without self-update feature
# This disables the 'self-update' feature flag while keeping all other functionality
Development Setup
For development with hot-reload of CSS changes:
# Install dependencies
# In one terminal, watch CSS changes
# In another terminal, run the development server
# Or use the Makefile
π Commands
CookCLI follows the UNIX philosophy: each command does one thing well.
cook recipe
Parse and display recipe files. You can view them in different formats and scale quantities.
# View a recipe
# Scale a recipe to 2x
# Output as JSON
# Save as Markdown
cook shopping-list
Generate shopping lists from one or more recipes. Ingredients are automatically combined and organized by store section.
# Single recipe
# Multiple recipes with scaling
# All recipes in a directory
cook server
Run a web server to browse your recipes from any device.
# Start on localhost
# Allow access from other devices on your network
# Use a different port
# Open browser immideately
cook search
Find recipes by searching through ingredients, instructions, and metadata.
# Search for recipes with chicken
# Find quick recipes
# Search in specific directory
cook import
Import recipes from websites and convert them to Cooklang format. Requires
OPENAI_API_KEY environment variable set.
# Import a recipe
# Import without conversion
cook doctor
Check your recipe collection for issues and maintain consistency.
# Validate all recipes and display parsing errors
# Check aisle configuration for shopping lists
# Check pantry configuration
# Run all checks
cook seed
Add sample recipes to explore Cooklang features.
# Add to current directory
# Add to specific directory
cook report
Generate custom outputs using templates (experimental feature).
# Generate a recipe card
# Create nutrition label
cook pantry
Manage your pantry inventory, track low stock items, expiring ingredients, and find recipes you can make.
# Show items that are low or out of stock
# Check expiring items in the next 7 days
# Find recipes you can make with available ingredients
# Include partial matches (recipes where most ingredients are available)
# Output in machine-readable formats
π Documentation
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
- Pantry - inventory management and tracking
βοΈ Configuration
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
Aisle Configuration (aisle.conf)
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
Pantry Configuration (pantry.conf)
Tracks your ingredient inventory with quantities, expiration dates, and low stock thresholds. Items in your pantry are excluded from shopping lists automatically.
[]
= "1%L"
= "500%g"
= { = "05.05.2024", = "05.06.2024", = "1%kg" }
[]
= { = "10.05.2024", = "2%L", = "500%ml" }
= { = "15.05.2024" }
= "250%g"
[]
= { = "5%kg", = "1%kg" }
= { = "1%kg", = "200%g" }
= { = "5%kg", = "1%kg" }
= { = "1%L", = "250%ml" }
= "1%kg"
Pantry items can be specified in two formats:
- Simple:
item = "quantity" - Detailed:
item = { quantity = "amount", expire = "date", bought = "date", low = "threshold" }
Attributes:
quantity- Current amount in stocklow- Threshold for low stock warnings (same units as quantity)expire- Expiration datebought- Purchase date
Items listed in your pantry will be automatically excluded from shopping lists, helping you track what you already have at home. Use cook pantry depleted to see low stock items and cook pantry expiring to check expiration dates.
Using Configuration Files
# Shopping list will organize by aisle and exclude pantry items
# Check which ingredients aren't categorized
# Use specific config directory
# 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
π‘ Tips
Logging
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.
Scaling Recipes
Use the : notation to scale any recipe:
Combining with UNIX Tools
CookCLI works great with pipes and standard tools:
# Find all recipes with chicken and create a shopping list
|
# Convert all recipes to Markdown
for; do
done
β Give us a star
Why not? It will help more people discover this tool and Cooklang.
π€ Contributing
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
π₯ Contributors
Thanks to all the people who have contributed to CookCLI!
π License
MIT License. See LICENSE for details.
Some source files include code from cooklang-chef, also under MIT license.
π Links
- Cooklang Specification - the recipe markup language
- Cooklang Apps - iOS and Android apps
π¬ Support
- 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.