- Go 97.9%
- Nix 2.1%
Closes the parity gap with the existing tag commands: categories and
tools each get the same vocabulary (list/create/delete with --json and
--yes) and association (add/remove/set on a recipe) surface. Also
adds a `recipe instructions` printer for one-line-per-step cooking
directions.
Why now: the recipe-tag cleanup on 2026-06-03 surfaced the same
friction for the other two organizers (manual UUID lookups, no
scripting-friendly flags, no association commands). Categories and
tools both had the same problems; fixing them in one pass keeps the
CLI consistent.
New client surface (internal/mealie):
- List/Create/Delete + ListPaginated for tools
- categoryBySlug / categoriesBySlug / toolBySlug / toolsBySlug helpers
- AddCategoryToRecipe / RemoveCategoryFromRecipe / SetRecipeCategories
- AddToolToRecipe / RemoveToolFromRecipe / SetRecipeTools
- All use the same full-{id,name,slug} PATCH shape as the tag code
(regression test added in recipe_category_tool_test.go)
New types (internal/mealie/types.go):
- Tool: organizer with id/name/slug/createdAt/updateAt
- RecipeInstruction: id/title/summary/text/ingredientReferences
(added to Recipe struct so recipe get --json can read steps)
New CLI surface (internal/cli):
- `category` and `tool` vocabulary commands (list/create/delete,
--json/--yes matching the tag equivalents)
- `recipe category` and `recipe tool` association subcommands
(add/remove/set, comma- or space-separated slugs)
- `recipe instructions` printer (one paragraph per step)
- Wired into root.go
Tests:
- recipe_category_tool_test.go: regression tests for the
PATCH-must-send-full-object gotcha (categories + tools, same
pattern as the tag regression test)
- Existing tests still pass (internal/cli and internal/mealie)
Docs:
- skills/mealie-cli/SKILL.md: new sections for recipe category,
tool, and recipe tool, plus UUID/pitfall notes aligned with tags
- Two-namespace rule added to pitfall list (vocabulary vs association)
- Verified checklist incremented
Build is clean: `go build ./...` + `go test ./...` both pass.
Co-Authored-By: Lauria <noreply@hermes-agent>
|
||
|---|---|---|
| cmd/mealie-cli | ||
| internal | ||
| skills | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| README.md | ||
mealie-cli
Generic CLI for interacting with a Mealie self-hosted recipe manager from the terminal.
mealie-cli lets you list, search, view, create, and delete recipes (and
later: tags, categories, meal plans, shopping lists) without opening the
web UI. Useful for scripting, bulk operations, and quick lookups from
your shell.
Features (V1)
- 🔐 Reads host and API key from env vars (
MEALIE_HOST,MEALIE_API_KEY) - 🔎
recipe list/recipe search/recipe get - ➕
recipe create/recipe delete - 🏷️
tag list/category list - 📅
mealplan list/mealplan today - 🛒
shopping list - 🩺
whoamifor connection testing - 🛠️ Single static binary, no runtime dependencies
Quick start
# 1. Set env vars
export MEALIE_HOST=https://mealie.example.com
export MEALIE_API_KEY=your-long-api-key
# 2. Build (requires Nix with flakes, or just `go build`)
nix develop
go build -o bin/mealie-cli ./cmd/mealie-cli
# 3. Verify connection
./bin/mealie-cli whoami
# 4. List your recipes
./bin/mealie-cli recipe list
# 5. Search
./bin/mealie-cli recipe search "chocolate"
# 6. Get a specific recipe
./bin/mealie-cli recipe get my-chocolate-cake
Configuration
No config file. Two environment variables, both required:
| Var | Example | Notes |
|---|---|---|
MEALIE_HOST |
https://mealie.polensky.me |
Base URL, no trailing slash. |
MEALIE_API_KEY |
mealie_apikey_… |
Long-lived token from your user profile. |
Commands
| Command | Description |
|---|---|
mealie-cli whoami |
Show the authenticated user (good for testing) |
mealie-cli recipe list |
List all recipes (paginated) |
mealie-cli recipe get <slug> |
Print a recipe in full |
mealie-cli recipe search <q> |
Free-text search |
mealie-cli recipe create |
Create a new recipe (interactive or via flags) |
mealie-cli recipe delete <slug> |
Delete a recipe |
mealie-cli tag list |
List tags |
mealie-cli category list |
List categories |
mealie-cli mealplan list |
List meal plan entries |
mealie-cli mealplan today |
Show today's meal plan |
mealie-cli shopping list |
Show current shopping lists |
Run mealie-cli <command> --help for flags and examples.
How it works
mealie-cli is a thin Go client over Mealie's public REST API. Auth is
a Bearer token in the Authorization header. The OpenAPI spec lives
at <MEALIE_HOST>/openapi.json; this client targets v3.12+.
Development
nix develop
go test ./...
go build -o bin/mealie-cli ./cmd/mealie-cli
Roadmap
- Recipe import from URL (
recipe create --from-url) - Bulk operations (
recipe bulk-tag,recipe bulk-delete) - TUI mode for browsing recipes
- Export shopping list to plain text / Todoist
- OpenAPI-driven codegen for type safety
AI agent skills
This repo ships with an agent skill under skills/mealie-cli/
documenting the CLI surface: install, env config with auto-load from
~/.mealie-cli.env, all sub-commands (recipe, tag, category, mealplan,
shopping, whoami), common workflows, pitfalls, extension points, and
how it integrates with the circulaires tool for a weekly
"flyers → recipe → meal plan → shopping list" workflow.
If you change the CLI's interface or add a sub-command, please update
the skill too. The underlying Mealie REST API knowledge (endpoints,
real response shapes, spec-vs-reality gotchas) is in the global
mealie-api skill — don't duplicate it here, link to it instead.
License
MIT — see LICENSE.