Repository navigation
fix(shopping-list): error clearly on a directory without recipes - #732
Conversation
LeMyst
left a comment
There was a problem hiding this comment.
Thanks. The clearer error for an empty directory is good, but expanding .menu files found in a directory counts recipes twice.
Menus usually reference recipes that sit in the same folder. In the shipped seed/, Weekly Plan.menu and 2 Day Plan.menu both reference @./lamb-chops{}, next to lamb-chops.cook. Before this PR, cook shopping-list seed/ listed the top-level recipes once. With it, lamb-chops and the other menu recipes are added again through each menu, plus the menus' loose ingredients (oats, milk…), so quantities are silently inflated.
Skipping .menu files doesn't look like a deliberate choice: the ext == "cook" filter dates from the new UI (e200582) and probably predates menus. But including them changes what a directory means. Since #723 allows either fix ("include menus OR error accurately"), I'd suggest keeping only the error part. A directory with no .cook files would fail with an accurate message, ideally saying it holds N .menu files that can be passed explicitly. Menus would not be expanded.
A small integration test for the empty-directory message would be nice.
🤖 Analysis and recommendations made by Claude (Anthropic's AI assistant), posted on behalf of @LeMyst.
7a7a25d to
9576943
Compare
|
Reworked per review: directories no longer expand |
|
Thanks for the rework. I checked it against the cases from the first review. A directory of only menus now fails with One optional tidy-up: the new test could use the 🤖 Analysis and recommendations made by Claude (Anthropic's AI assistant), posted on behalf of @LeMyst. |
A directory holding only .menu files fell back to being treated as a recipe path, surfacing a misleading "recipe not found". Report what the directory actually contains, noting any .menu files that can be passed by name. Menus are not expanded from a directory: they usually reference sibling recipes, so expanding them would count those recipes twice. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
9576943 to
d12b1e4
Compare
|
Done on d12b1e4 — the test now goes through |
Closes #723
cook sl <dir>expands only*.cook, so a directory holding only.menufiles fell back to the raw argument and died withRecipe not found: <dir>. (Expanding.menufiles was considered, but menus usually reference sibling recipes, so expansion would count those recipes twice.) Now a directory that yields no.cookfiles errors withDirectory '<dir>' contains no .cook files, naming how many.menufiles it has and that they can be passed by name; a mixed directory warns rather than silently skipping.Test plan
cook sl plans/whereplans/holds onlyweek.menu/weekend.menu→Error: Directory 'plans' contains no .cook files — it has 2 .menu file(s) that can be passed by name(previouslyRecipe not found)test_shopping_list_menu_only_directory_errors_clearly.cook-only expansion and hidden-file tests unchanged