Add weekly-shop-to-inventory import (on-demand, exclusions) + structured basket save
- scripts/shop_basket.py: normalize + save structured weekly basket to last-shop.json (git-ignored live data) - SKILL.md: weekly job now persists last-shop.json; new on-demand rule 'add everything from Monday's shop except X' - .gitignore: ignore last-shop.json in both live skill and repo - Weekly cron prompt updated to save basket (still never auto-modifies inventory)
This commit is contained in:
23
SKILL.md
23
SKILL.md
@ -259,6 +259,29 @@ If the user lists ingredients in chat, add them to the inventory and optionally
|
||||
give an immediate 2-meal suggestion. If they ask "what should I eat today?", read
|
||||
the inventory and suggest now (and offer to email it).
|
||||
|
||||
### Import a weekly shop into inventory (exclusions supported)
|
||||
The weekly job does **NOT** auto-add the shop to inventory — `last-shop.json` is
|
||||
only a record of what the Monday email proposed. To bring it in, the user says
|
||||
e.g. *"add everything from Monday's shop to the inventory, except milk and
|
||||
vitamin D3"*. Procedure:
|
||||
1) Read `/home/jp/.hermes/skills/meal-suggestion/last-shop.json` (set by the most
|
||||
recent weekly run; if missing, tell the user the shop hasn't been generated yet
|
||||
and ask them to wait for Monday or to list items directly).
|
||||
2) Collect the `items` list. Remove any whose normalized `name` matches a named
|
||||
exclusion (case-insensitive; match against the item's `name`, not just `raw`).
|
||||
3) For each remaining item, **merge into `inventory.json`**: find an existing entry
|
||||
by case-insensitive name match; if found, ADD its `qty` to the existing `qty`
|
||||
(keep the existing `unit` if they agree, otherwise keep the existing entry's unit
|
||||
and note the discrepancy); if not found, create a new entry with the item's
|
||||
`name`, `qty`, `unit`, and `category`, sorted into the list. Items whose `qty`
|
||||
is `null` (flagged in `warnings`) are skipped with a note asking the user for a
|
||||
quantity — never invent a number.
|
||||
4) Bump `updated` to today. Do NOT modify `last-shop.json`.
|
||||
5) Confirm: list what was added (name + qty + unit), what was excluded, and any
|
||||
items skipped pending a quantity. If the shop would push a staple already in
|
||||
stock (e.g. whey, eggs), just add to the existing quantity.
|
||||
Note: this is entirely on-demand — the weekly job itself never writes inventory.
|
||||
|
||||
## Pitfalls (learned the hard way)
|
||||
- **"Regenerate / resend today's meals" means GENERATE FRESH, not replay.** When the
|
||||
user asks to regenerate a day's meals or re-send the email, do NOT pull the two meals
|
||||
|
||||
Reference in New Issue
Block a user