Repository navigation
feat(shopping-list): leave optional ingredients out unless --include-optional - #592
Merged
Merged
Conversation
…optional
Following spec proposal 0018, a recipe contributes only its required
ingredients to a shopping list. --include-optional adds the optional
ones (and everything an optional recipe reference adds), marked
"(optional)" in human and markdown output and "optional": true in
JSON/YAML, and kept apart from required amounts of the same ingredient.
Core: extract_ingredients now accumulates into ShoppingIngredients
{ required, optional }; ExtractOptions and GenerateRequest gain
include_optional; ListItem gains optional. Pantry stock counts against
the required amount first.
The web server keeps including optional ingredients, merged as before,
until the web UI can choose them.
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1 of the CookCLI side of spec proposal 0018.
A recipe now contributes only its required ingredients to
cook shopping-list.--include-optionaladds the optional ones — and everything an optional recipe reference@?./sauce{}adds — marked as optional and kept apart from required amounts of the same ingredient:JSON/YAML items get
"optional": true(omitted when false, so existing output is unchanged).Core (
cookcli-core)extract_ingredientsaccumulates intoShoppingIngredients { required, optional }instead of oneIngredientList(breaking for core consumers).ExtractOptions::include_optional,GenerateRequest::include_optional,ListItem::optional.Not yet
include_optional: true+ merge), so the web list does not regress. Part 2:? name{qty}selection lines in.shopping-listand choosing optional ingredients when adding a recipe in the web UI.Tests: new core tests for default exclusion, marking, separate aggregation (within and across recipes), optional references, categorisation, pantry; a formatter test for human/markdown/JSON.
cargo test --all-features --workspacepasses.(Replaces #591, which GitHub closed when its stacked base branch was deleted.)