diff --git a/data/db/wishlist.db b/data/db/wishlist.db index 4572535..c429ab0 100755 Binary files a/data/db/wishlist.db and b/data/db/wishlist.db differ diff --git a/docs/skill-item-images.md b/docs/skill-item-images.md new file mode 100644 index 0000000..5339b4a --- /dev/null +++ b/docs/skill-item-images.md @@ -0,0 +1,80 @@ +--- +name: item-images +description: Use when finding and updating product images for items on the Chá do Martin wishlist. Triggers on "find image", "add image", "update image", or when an item is missing its imageUrl. +--- + +# Item Images — Chá do Martin + +Finds a product image for a wishlist item via web search and patches it to the API. + +## Config + +- **Base URL**: `https://chadomartin.omeu.website` +- **Admin token**: read from `/home/adriano/chadebebe/.env` (key `ADMIN_TOKEN`) +- **Auth**: cookie `adm_token=` sent with every request + +## Instructions + +1. Load the admin token: + ```bash + ADMIN_TOKEN=$(grep ADMIN_TOKEN /home/adriano/chadebebe/.env | cut -d= -f2) + ``` + +2. Search the web for a clean product image. Good queries: + - `" bebê" site:amazon.com.br` + - `" newborn product photo"` + - Try mitiendanube stores, newbiestore.com, or brand sites (burtsbeesbaby.com, halosleep.com, honestbabyclothing.com) + +3. Find a direct image URL ending in `.jpg`, `.png`, or `.webp`. + +4. Verify the URL returns an actual image: + ```bash + curl -sI "" | grep -i "content-type\|http/" + # Must be HTTP 200 and content-type: image/* + ``` + +5. PATCH the item: + ```bash + curl -s -X PATCH \ + "https://chadomartin.omeu.website/api/items/" \ + -H "Content-Type: application/json" \ + -H "Cookie: adm_token=${ADMIN_TOKEN}" \ + -d '{"imageUrl": ""}' + ``` + +6. Check response for `"success": true`. + +## Listing items without images + +```bash +ADMIN_TOKEN=$(grep ADMIN_TOKEN /home/adriano/chadebebe/.env | cut -d= -f2) +curl -s "https://chadomartin.omeu.website/api/wishlists/r7ug0ez62x7ljx8c870ofwcv/items" \ + -H "Cookie: adm_token=${ADMIN_TOKEN}" | python3 -c " +import json, sys +data = json.load(sys.stdin) +for it in sorted(data['items'], key=lambda x: x['sortOrder']): + if not it['imageUrl']: + print(it['id'], it['name']) +" +``` + +## Committing the DB snapshot after updates + +Images are stored in the live SQLite DB (`/home/adriano/chadebebe/data/db/wishlist.db`). +After a batch of image updates, commit a snapshot: + +```bash +sqlite3 /home/adriano/chadebebe/data/db/wishlist.db "PRAGMA wal_checkpoint(FULL);" +cp /home/adriano/chadebebe/data/db/wishlist.db /home/adriano/chadebebe/src/data/db/wishlist.db +cd /home/adriano/chadebebe/src +git add data/db/wishlist.db +git commit -m "chore: db snapshot with updated item images" +``` + +## Notes + +- Do NOT use placeholder or stock photo URLs — find actual product images +- Prefer `.webp` or `.jpg` from CDNs (faster loading) +- Good CDN sources: `mitiendanube.com`, `newbiestore.com`, `burtsbeesbaby.com`, `halosleep.com`, `honestbabyclothing.com` +- Always verify HTTP 200 before patching — dead URLs show broken images to guests +- Run multiple items in parallel (background subagents, model: haiku) for speed