### Setup: Install dependencies Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/ocado.md Run these commands in the base directory to install project dependencies. ```bash cd {baseDir} npm install ``` -------------------------------- ### Install dependencies and Playwright Chromium Source: https://github.com/abracadabra50/open-supermarkets/blob/main/SKILL.md Sets up the project by installing dependencies and the Playwright Chromium browser. Run from the project root. ```bash cd {baseDir} npm install npx playwright install chromium ``` -------------------------------- ### Copy Guide to Agent Skill Directory Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/SMART-SHOPPING.md Command to copy the SMART-SHOPPING.md guide into the agent's skill directory. Use this to make the guide available for the agent to reference when making shopping decisions. ```bash cp docs/SMART-SHOPPING.md /path/to/agent/skills/uk-grocery-cli/ ``` -------------------------------- ### Install and run baseline Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/superpowers/plans/2026-09-17-tesco-hungary-provider.md Installs dependencies, runs typecheck, and executes the test suite. The baseline must pass (all tests print ✓ and exit 0) before proceeding. ```bash cd /Users/balazsbenedek/development/tesco/open-supermarkets && npm ci && npm run typecheck && npm test ``` -------------------------------- ### MCP server setup for Sainsbury's groceries Source: https://github.com/abracadabra50/open-supermarkets/blob/main/AGENTS.md Example of wrapping the Sainsburys groceries integration as an MCP server. It defines a server with tools/list and tools/call handlers for sainsburys_search and sainsburys_add_to_basket. The tools/call handler dispatches to search and addToBasket functions that are not shown. ```typescript // server.ts import { Server } from "@modelcontextprotocol/sdk/server/index.js"; const server = new Server({ name: "sainsburys-groceries", version: "1.0.0" }, { capabilities: { tools: {} } }); server.setRequestHandler("tools/list", async () => ({ tools: [ { name: "sainsburys_search", description: "Search Sainsbury's products", inputSchema: { type: "object", properties: { query: { type: "string" }, limit: { type: "number" } } } }, { name: "sainsburys_add_to_basket", description: "Add product to basket", inputSchema: { type: "object", properties: { productId: { type: "string" }, quantity: { type: "number" } } } } // ... more tools ] })); server.setRequestHandler("tools/call", async (request) => { const { name, arguments: args } = request.params; switch (name) { case "sainsburys_search": return await search(args.query, args.limit); case "sainsburys_add_to_basket": return await addToBasket(args.productId, args.quantity); } }); ``` -------------------------------- ### Login Example with SainsburysProvider Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Shows a concrete login example using the SainsburysProvider. Imports the provider and calls login with email and password. ```typescript import { SainsburysProvider } from './providers/sainsburys'; const provider = new SainsburysProvider(); await provider.login('you@email.com', 'password123'); ``` -------------------------------- ### Start the local grocery API Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/api/SKILL.md Starts the local grocery API on port 7876. The API must already be running before using the wrapper commands. ```bash GROC_API_PORT=7876 npm run api ``` -------------------------------- ### Price comparison command Source: https://github.com/abracadabra50/open-supermarkets/blob/main/SKILL.md Price comparison example that returns results from all providers with prices. ```bash npm run groc compare "organic milk" --json # Returns results from all providers with prices ``` -------------------------------- ### Start MCP server Source: https://github.com/abracadabra50/open-supermarkets/blob/main/SKILL.md Starts the MCP server using the stdio transport. Use the first command for development with tsx, or the second after building. ```bash # Start MCP server (stdio transport) npx tsx src/mcp-server.ts # Or after build: node dist/mcp-server.js ``` -------------------------------- ### Install globally and use supermarket command Source: https://github.com/abracadabra50/open-supermarkets/blob/main/README.md Install the package globally and use the canonical 'supermarket' command. The 'open-supermarkets' alias is also available, and the old 'groc' alias is temporarily supported until v4. ```bash npm install -g open-supermarkets supermarket providers ``` -------------------------------- ### Example agent workflow: search, add, basket, slots, checkout Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/sainsburys.md End-to-end agent workflow: search for a product, add it to the basket, check the total, find a delivery slot, book it, and checkout (with a dry-run preview first). ```bash # 1. Search for ingredients npm run groc search "organic eggs" --json # 2. Add to basket npm run groc add 357937 --qty 1 # 3. Check basket total npm run groc basket --json # 4. Find delivery slot npm run groc slots --json # 5. Book and checkout npm run groc book SLOT_ID npm run groc checkout --dry-run npm run groc checkout ``` -------------------------------- ### Run open-supermarkets via npx Source: https://github.com/abracadabra50/open-supermarkets/blob/main/README.md Quick start commands using npx to list providers and search for products. The search command specifies a country and limit. ```bash npx open-supermarkets providers npx open-supermarkets search "olive oil" --country ES --limit 5 ``` -------------------------------- ### Agent Conversation Example: Smart Shopping with Budget and Organic Preferences Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/SMART-SHOPPING.md Example conversation showing how the agent plans a weekly shop with a £60 budget, prioritizing organic when it makes sense. It demonstrates the agent's decision process: analyzing Dirty Dozen vs Clean Fifteen, searching organic and conventional options, calculating price differences, and making recommendations. The output includes categorized items with reasons and savings, a total, budget remaining, and total saved. ```text User: "Plan my weekly shop, £60 budget, prefer organic when it makes sense" Agent: → Analyzes Dirty Dozen vs Clean Fifteen → Searches both organic and conventional options → Calculates price differences → Makes smart recommendations "Here's your optimized shopping list: ALWAYS ORGANIC (Dirty Dozen): • Strawberries (organic) - £3.20 Reason: High pesticide residue • Spinach (organic) - £2.10 Reason: High pesticide residue CONVENTIONAL IS FINE (Clean Fifteen): • Avocados (conventional) - £1.50 Reason: Low pesticide residue Saved: £1.20 vs organic WORTH IT (Small price difference): • Tomatoes (organic) - £2.80 Reason: Only 15% more expensive • Carrots (organic) - £1.40 Reason: Only 10% more expensive NOT WORTH IT (Big price difference): • Potatoes (conventional) - £1.80 Reason: Organic is 60% more expensive Saved: £2.70 Total: £58.30 Budget remaining: £1.70 Total saved by smart choices: £3.90 Health optimized: All high-risk items are organic" ``` -------------------------------- ### Example Agent Workflow (bash) Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/tesco.md A sequence of bash commands demonstrating a typical grocery automation workflow: checking staples, adding them to the basket, searching for items, adding items, reviewing the basket, and booking a slot with checkout. Each command uses the `npm run groc` CLI with the `--provider tesco` flag. ```bash # 1. Check staples from order history npm run groc -- --provider tesco staples --json # 2. Add staples to basket automatically npm run groc -- --provider tesco staples --add # 3. Search for additional items npm run groc -- --provider tesco search "avocados" --json # 4. Add extra items npm run groc -- --provider tesco add PRODUCT_ID --qty 2 # 5. Review basket npm run groc -- --provider tesco basket --json # 6. Book slot and checkout npm run groc -- --provider tesco slots --json npm run groc -- --provider tesco book SLOT_ID npm run groc -- --provider tesco checkout --dry-run ``` -------------------------------- ### GET /product/v1/product Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Search for products by keyword. This endpoint does not require authentication. ```APIDOC ## [GET] /product/v1/product ### Description Search for products by keyword. This endpoint does not require authentication. ### Method GET ### Endpoint https://www.sainsburys.co.uk/groceries-api/gol-services/product/v1/product ### Parameters #### Query Parameters - **filter[keyword]** (string) - Required - Search keyword - **page_number** (integer) - Required - Page number for pagination - **page_size** (integer) - Required - Number of results per page ### Request Example ```bash curl 'https://www.sainsburys.co.uk/groceries-api/gol-services/product/v1/product?filter[keyword]=milk&page_number=1&page_size=10' ``` ``` -------------------------------- ### GET /product/{id} Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Returns detailed information for a single product. ```APIDOC ## [GET] /product/{id} ### Description Returns detailed information for a single product. ### Method GET ### Endpoint /product/{id} ### Parameters #### Path Parameters - **id** (string) - Required - Product ID. ### Request Example ```typescript const product = await provider.getProduct('357937'); ``` ### Response #### Success Response (200) - **product** (object) - Detailed product information. #### Response Example ```json { "product": {} } ``` ``` -------------------------------- ### CLI examples: compare milk and search with --country Source: https://github.com/abracadabra50/open-supermarkets/blob/main/README.md Shows the CLI output for comparing milk across UK retailers and searching for milk in Spain and the Netherlands. The compare command lists the best price first, while the search command with --country returns local product names and prices. Spain, the Netherlands, and Belgium require no credentials. ```console $ supermarket compare milk Ocado Ocado British Semi Skimmed Milk 2 Pints £1.20 ← best Sainsbury's Sainsbury's British Semi Skimmed Milk 2.27L £1.75 Tesco Tesco British Semi Skimmed Milk 2.272L £1.75 ``` ```console $ supermarket search leche --country ES Leche semidesnatada Hacendado €5.04 / 6l ``` ```console $ supermarket search melk --country NL Campina Halfvolle melk €1.89 / 1,5 l ``` -------------------------------- ### GET /groceries-api/gol-services/product/v1/product Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Search for products by keyword. Returns a list of products with pricing and availability. ```APIDOC ## GET /groceries-api/gol-services/product/v1/product ### Description Search for products by keyword. Returns a list of products with pricing and availability. ### Method GET ### Endpoint /groceries-api/gol-services/product/v1/product?filter[keyword]=QUERY&page_number=1&page_size=24 ### Parameters #### Query Parameters - **filter[keyword]** (string) - Required - Search query - **page_number** (integer) - Optional - Page number (default: 1) - **page_size** (integer) - Optional - Number of results per page (default: 24) ### Authentication Cookies (optional for search) ### Response #### Success Response (200) - **products** (array) - List of products - **product_uid** (string) - Product UID - **name** (string) - Product name - **retail_price** (number) - Retail price - **unit_price** (number) - Unit price - **in_stock** (boolean) - Stock availability - **image_url** (string) - Product image URL #### Response Example { "products": [ { "product_uid": "string", "name": "string", "retail_price": 0, "unit_price": 0, "in_stock": true, "image_url": "string" } ] } ``` -------------------------------- ### Get Single Product with provider.getProduct() Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Fetches detailed information for a single product by its ID. ```typescript const product = await provider.getProduct('357937'); ``` -------------------------------- ### GET /search Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Searches for products matching the given query. Returns an array of `Product` objects. ```APIDOC ## [GET] /search ### Description Searches for products matching the given query. Returns an array of `Product` objects. ### Method GET ### Endpoint /search ### Parameters #### Query Parameters - **query** (string) - Required - Search term. - **limit** (number) - Optional - Maximum number of results. - **offset** (number) - Optional - Number of results to skip. ### Request Example ```typescript const products = await provider.search('milk'); const products = await provider.search('organic eggs', { limit: 10, offset: 0 }); ``` ### Response #### Success Response (200) - **products** (array) - List of `Product` objects. #### Response Example ```json { "products": [] } ``` ``` -------------------------------- ### Search Products - GET /groceries-api/gol-services/product/v1/product Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Search products endpoint. Requires optional cookies. Returns product details including product_uid, name, retail_price, unit_price, in_stock, and image_url. ```http GET /groceries-api/gol-services/product/v1/product?filter[keyword]=QUERY&page_number=1&page_size=24 Auth: Cookies (optional for search) Response: { products: [{ product_uid, name, retail_price, unit_price, in_stock, image_url }] } ``` -------------------------------- ### Configure MCP server for open-supermarkets Source: https://github.com/abracadabra50/open-supermarkets/blob/main/README.md MCP server configuration for Claude Desktop, Cursor, or any MCP-compatible client. If installed globally, use 'supermarket-mcp' instead. ```json { "mcpServers": { "groceries": { "command": "npx", "args": ["-y", "open-supermarkets", "mcp"] } } } ``` -------------------------------- ### Meal planning flow with Sainsbury's CLI Source: https://github.com/abracadabra50/open-supermarkets/blob/main/AGENTS.md Implements the full meal planning workflow: asks for constraints, suggests meals, gets approval, extracts ingredients, searches products via the Sainsbury's CLI, adds items to the basket, and checks out. Uses bash commands to run the CLI with JSON output and assumes a shoppingList variable exists. ```typescript async function startMealPlanning() { // 1. Ask constraints await ask("How many people? Budget? Dietary restrictions?"); // 2. Suggest meals const meals = await suggestMeals({ people: 2, budget: 50, dietary: ["halal"] }); // 3. Get approval await showMeals(meals); const approved = await waitForApproval(); // 4. Generate shopping list const ingredients = extractIngredients(approved); // 5. Search products for (const ingredient of ingredients) { const result = await bash(`cd skills/sainsburys-cli && npm run groc search "${ingredient}" --json`); const products = JSON.parse(result); const best = pickBestMatch(products, ingredient); shoppingList.push(best); } // 6. Show list and add to basket await showShoppingList(shoppingList); if (await confirm("Add to basket?")) { for (const item of shoppingList) { await bash(`cd skills/sainsburys-cli && npm run groc add ${item.product_uid} --qty ${item.quantity}`); } } // 7. Checkout await bash(`cd skills/sainsburys-cli && npm run groc basket --json`); // ... show basket, book slot, checkout } ``` -------------------------------- ### Complete Shopping Flow: SainsburysProvider Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Demonstrates a full shopping workflow: login, search, add to basket, view basket, get delivery slots, book a slot, and checkout. Returns the order object. ```typescript import { SainsburysProvider } from './providers/sainsburys'; async function completeShop() { const provider = new SainsburysProvider(); // 1. Login await provider.login('you@email.com', 'password123'); // 2. Search products const milkResults = await provider.search('milk'); const breadResults = await provider.search('bread'); // 3. Add to basket await provider.addToBasket(milkResults[0].product_uid, 2); await provider.addToBasket(breadResults[0].product_uid, 1); // 4. View basket const basket = await provider.getBasket(); console.log(`Total: £${basket.total_cost}`); // 5. Get delivery slots const slots = await provider.getDeliverySlots(); const nextSlot = slots.find(s => s.available); // 6. Book slot if (nextSlot) { await provider.bookSlot(nextSlot.slot_id); } // 7. Checkout const order = await provider.checkout(); console.log(`Order placed: ${order.order_id}`); return order; } ``` -------------------------------- ### Add batch picks with supermarket add --batch picks.json Source: https://github.com/abracadabra50/open-supermarkets/blob/main/README.md Adds the model's chosen products from a `picks.json` file to the basket in batch mode. This command follows the batch search example and is used after the model has selected items based on its context. ```bash supermarket add --batch picks.json ``` -------------------------------- ### List tesco-hu categories Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/superpowers/plans/2026-09-17-tesco-hungary-provider.md Lists categories as an indented tree starting with 'Most ajánlott!' and including 'Zöldség és gyümölcs', each with a '>'-joined path line. ```bash npx tsx src/cli.ts --provider tesco-hu categories | head -20 ``` -------------------------------- ### Clone and set up from source Source: https://github.com/abracadabra50/open-supermarkets/blob/main/README.md Set up the project from source for development. Requires Node.js and npm; Playwright Chromium is needed only for browser-auth providers. ```bash git clone https://github.com/abracadabra50/open-supermarkets.git cd open-supermarkets && npm install && npm link npx playwright install chromium # only for browser-auth providers ``` -------------------------------- ### Get Profile - GET /groceries-api/gol-services/customer/v1/customer/profile Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Get customer profile endpoint. Requires cookies and wcauthtoken. Returns user_id, customer_id, is_registered, email, and more. ```http GET /groceries-api/gol-services/customer/v1/customer/profile Auth: Cookies + wcauthtoken Response: { user_id, customer_id, is_registered, email, ... } ``` -------------------------------- ### GET /groceries-api/gol-services/slot/v1/slot/reservation Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Get the current slot reservation status. ```APIDOC ## GET /groceries-api/gol-services/slot/v1/slot/reservation ### Description Get the current slot reservation status. ### Method GET ### Endpoint /groceries-api/gol-services/slot/v1/slot/reservation ### Authentication Cookies + wcauthtoken ### Response #### Success Response (200) - **reservation_type** (string) - Type of reservation - **postcode** (string) - Postcode - **region** (string) - Region - **store_identifier** (string) - Store identifier - **flexi_stores** (array) - List of flexi stores - **is_alcohol_restricted_store** (boolean) - Whether the store has alcohol restrictions #### Response Example { "reservation_type": "string", "postcode": "string", "region": "string", "store_identifier": "string", "flexi_stores": [], "is_alcohol_restricted_store": true } ``` -------------------------------- ### Get Reservation Status - GET /groceries-api/gol-services/slot/v1/slot/reservation Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Get reservation status endpoint. Requires cookies and wcauthtoken. Returns reservation_type, postcode, region, store_identifier, flexi_stores, and is_alcohol_restricted_store. ```http GET /groceries-api/gol-services/slot/v1/slot/reservation Auth: Cookies + wcauthtoken Response: { reservation_type, postcode, region, store_identifier, flexi_stores, is_alcohol_restricted_store } ``` -------------------------------- ### GET /order/v1/order/{order_uid} Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/sainsburys.md Get details of a single order, including items. ```APIDOC ## GET /order/v1/order/{order_uid} ### Description Get details of a single order, including items. ### Method GET ### Endpoint https://www.sainsburys.co.uk/groceries-api/gol-services/order/v1/order/{order_uid} ### Parameters #### Path Parameters - **order_uid** (string) - Required - Unique identifier of the order ### Response #### Success Response (200) - **order_uid** (string) - Order unique identifier - **order_items** (array) - List of items in the order #### Response Example { "order_uid": "string", "order_items": [] } ``` -------------------------------- ### List all grocery API wrapper commands Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/api/SKILL.md Lists all available wrapper commands. Run from the repo root. All commands return JSON from the local API. ```bash node skills/api/wrapper.js fav-search "milk" node skills/api/wrapper.js search "milk" node skills/api/wrapper.js favourites node skills/api/wrapper.js basket node skills/api/wrapper.js add [qty] node skills/api/wrapper.js remove node skills/api/wrapper.js update ``` -------------------------------- ### CLI: Search Products Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/ocado.md Search for products on Ocado. Use --limit and --json flags for more control and JSON output. ```bash npm run groc -- --provider ocado search "milk" npm run groc -- --provider ocado search "organic bread" --limit 10 --json ``` -------------------------------- ### GET /slot/v1/slot/reservation Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/sainsburys.md List available delivery slots. ```APIDOC ## GET /slot/v1/slot/reservation ### Description List available delivery slots. ### Method GET ### Endpoint https://www.sainsburys.co.uk/groceries-api/gol-services/slot/v1/slot/reservation ### Response #### Success Response (200) - **slots** (array) - List of available delivery slots #### Response Example { "slots": [] } ``` -------------------------------- ### GET /basket/v2/basket Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/sainsburys.md View the current basket contents. ```APIDOC ## GET /basket/v2/basket ### Description View the current basket contents. ### Method GET ### Endpoint https://www.sainsburys.co.uk/groceries-api/gol-services/basket/v2/basket ### Response #### Success Response (200) - **basket** (object) - Basket details including items and totals #### Response Example { "basket": {} } ``` -------------------------------- ### CLI usage for search, compare, and basket commands Source: https://github.com/abracadabra50/open-supermarkets/blob/main/SKILL.md Shows the CLI usage for searching, comparing, and managing baskets across supermarkets. The provider is a flag, so all commands work the same way. ```bash # Search any supermarket npm run groc -- --provider sainsburys search "milk" npm run groc -- --provider tesco search "milk" npm run groc -- --provider ocado search "milk" # Compare across all stores npm run groc compare "organic eggs" --json # Provider is a flag - all commands work the same way npm run groc -- --provider basket npm run groc -- --provider add --qty 2 npm run groc -- --provider slots npm run groc -- --provider checkout --dry-run ``` -------------------------------- ### GET /api/cart/v1/carts/active Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/ocado.md Read the active trolley contents. ```APIDOC ## GET /api/cart/v1/carts/active ### Description Read the current trolley contents. ### Method GET ### Endpoint `/api/cart/v1/carts/active` ### Response #### Success Response (200) - **cart** (object) - The active trolley contents. #### Response Example ``` { "cart": {} } ``` ``` -------------------------------- ### GET /basket Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Retrieves the current basket contents. ```APIDOC ## [GET] /basket ### Description Retrieves the current basket contents. ### Method GET ### Endpoint /basket ### Parameters None ### Request Example ```typescript const basket = await provider.getBasket(); ``` ### Response #### Success Response (200) - **total_cost** (number) - Total cost of the basket. - **total_quantity** (number) - Total quantity of items. - **items** (array) - List of basket items. #### Response Example ```json { "total_cost": 48.5, "total_quantity": 24, "items": [] } ``` ``` -------------------------------- ### GET /product/v1/product Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/sainsburys.md Search Sainsbury's products by keyword. ```APIDOC ## GET /product/v1/product ### Description Search Sainsbury's products by keyword. ### Method GET ### Endpoint https://www.sainsburys.co.uk/groceries-api/gol-services/product/v1/product ### Parameters #### Query Parameters - **filter[keyword]** (string) - Required - Search keyword, e.g., "milk" ### Response #### Success Response (200) - **products** (array) - List of matching products #### Response Example { "products": [] } ``` -------------------------------- ### GET /groceries-api/gol-services/customer/v1/customer/profile Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Retrieve the customer's profile information. ```APIDOC ## GET /groceries-api/gol-services/customer/v1/customer/profile ### Description Retrieve the customer's profile information. ### Method GET ### Endpoint /groceries-api/gol-services/customer/v1/customer/profile ### Authentication Cookies + wcauthtoken ### Response #### Success Response (200) - **user_id** (string) - User identifier - **customer_id** (string) - Customer identifier - **is_registered** (boolean) - Whether the customer is registered - **email** (string) - Email address #### Response Example { "user_id": "string", "customer_id": "string", "is_registered": true, "email": "string" } ``` -------------------------------- ### Basic Product Search with provider.search() Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Searches for products by query string. Returns an array of Product objects. ```typescript const products = await provider.search('milk'); ``` -------------------------------- ### GET /groceries-api/gol-services/basket/v2/basket Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Retrieve the current basket contents and totals. ```APIDOC ## GET /groceries-api/gol-services/basket/v2/basket ### Description Retrieve the current basket contents and totals. ### Method GET ### Endpoint /groceries-api/gol-services/basket/v2/basket?pick_time=ISO_DATE&store_number=0560&slot_booked=false ### Parameters #### Query Parameters - **pick_time** (string) - Required - ISO date for pickup/delivery time - **store_number** (string) - Required - Store identifier (e.g., 0560) - **slot_booked** (boolean) - Required - Whether a slot is booked ### Authentication Cookies + wcauthtoken header ### Response #### Success Response (200) - **basket_id** (string) - Basket identifier - **order_id** (string) - Order identifier - **subtotal_price** (number) - Subtotal price - **total_price** (number) - Total price - **minimum_spend** (number) - Minimum spend requirement - **has_exceeded_minimum_spend** (boolean) - Whether minimum spend is met - **item_count** (integer) - Number of items - **items** (array) - List of items - **item_uid** (string) - Item UID - **quantity** (integer) - Quantity - **subtotal_price** (number) - Subtotal for this item - **product** (object) - Product details - **sku** (string) - SKU - **name** (string) - Product name - **image** (string) - Product image #### Response Example { "basket_id": "string", "order_id": "string", "subtotal_price": 0, "total_price": 0, "minimum_spend": 0, "has_exceeded_minimum_spend": true, "item_count": 0, "items": [ { "item_uid": "string", "quantity": 0, "subtotal_price": 0, "product": { "sku": "string", "name": "string", "image": "string" } } ] } ``` -------------------------------- ### ProviderFactory.createAll Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Creates instances of all available providers. ```APIDOC ## [POST] /providers/all ### Description Creates instances of all available providers. ### Method POST ### Endpoint /providers/all ### Parameters None ### Request Example None ### Response #### Success Response (200) - **providers** (array of objects) - An array of all provider instances. #### Response Example ```json [ {}, {} ] ``` ``` -------------------------------- ### GET /categories Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Returns the category tree structure in a provider-specific format. ```APIDOC ## [GET] /categories ### Description Returns the category tree structure in a provider-specific format. ### Method GET ### Endpoint /categories ### Parameters None ### Request Example ```typescript const categories = await provider.getCategories(); ``` ### Response #### Success Response (200) - **categories** (object) - Category tree structure. #### Response Example ```json { "categories": {} } ``` ``` -------------------------------- ### Meal planning workflow Source: https://github.com/abracadabra50/open-supermarkets/blob/main/SKILL.md Meal planning workflow: compare ingredient prices across stores, then add to the cheapest provider and review the basket before a dry-run checkout. ```bash # Search ingredients across stores npm run groc compare "chicken breast" --json npm run groc compare "basmati rice" --json # Add to cheapest provider npm run groc -- --provider tesco add PRODUCT_ID --qty 1 npm run groc -- --provider tesco basket --json npm run groc -- --provider tesco checkout --dry-run ``` -------------------------------- ### Delivery and checkout: slots, book, checkout, orders Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/sainsburys.md View and book delivery slots, preview and place orders, and view order history. Use --json for JSON output and --dry-run to preview without placing the order. ```bash npm run groc slots # View delivery slots npm run groc slots --json # JSON output npm run groc book # Book slot npm run groc checkout --dry-run # Preview order npm run groc checkout # Place order npm run groc orders # Order history ``` -------------------------------- ### GET /search Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/ocado.md Search Ocado products using the server-rendered search endpoint. ```APIDOC ## GET /search ### Description Search Ocado products. The endpoint is server-rendered and returns a `productEntities` blob in the HTML. ### Method GET ### Endpoint `/search` ### Parameters #### Query Parameters - **q** (string) - Required - Search query, e.g., `milk`. ### Request Example ``` GET /search?q=milk ``` ### Response #### Success Response (200) - **productEntities** (object) - Blob containing product data. #### Response Example ``` { "productEntities": {} } ``` ``` -------------------------------- ### Copy sainsburys-cli to agent skills directory Source: https://github.com/abracadabra50/open-supermarkets/blob/main/AGENTS.md Copies the sainsburys-cli directory into the agent's skills directory. Run this from the project root or the parent of the skills directory. ```bash cp -r sainsburys-cli /path/to/agent/skills/ ``` -------------------------------- ### buildSmartShoppingList: Budget-Aware Shopping List Builder Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/SMART-SHOPPING.md Builds a shopping list from meal ingredients, applying smartOrganicChoice per item and tracking spending. When the decision is 'ask', it prompts the user with organic and conventional prices and adds the chosen product. ```typescript async function buildSmartShoppingList(meals: Meal[], budget: number) { const ingredients = extractIngredients(meals); const shoppingList = []; let spent = 0; for (const ingredient of ingredients) { const decision = await smartOrganicChoice( ingredient.name, budget - spent ); if (decision.choice === 'organic') { shoppingList.push({ ...decision.product, note: decision.reason }); spent += decision.product.price; } else if (decision.choice === 'conventional') { shoppingList.push({ ...decision.product, note: decision.reason, saved: decision.savings }); spent += decision.product.price; } else { // Ask user const userChoice = await ask( `${ingredient.name}: Organic £${decision.organic.price} or Conventional £${decision.conventional.price}? (${decision.reason})` ); const chosen = userChoice === 'organic' ? decision.organic : decision.conventional; shoppingList.push(chosen); spent += chosen.price; } } return { list: shoppingList, totalSpent: spent, totalSaved: shoppingList.reduce((sum, item) => sum + (item.saved || 0), 0), budgetRemaining: budget - spent }; } ``` -------------------------------- ### Pre-PR verification commands (npm) Source: https://github.com/abracadabra50/open-supermarkets/blob/main/CONTRIBUTING.md Commands to run before opening a pull request. CI runs without retailer credentials so fork PRs remain verifiable. ```bash npm ci npm run typecheck npm run build npm test ``` -------------------------------- ### GET /basket/v2/basket Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md View the current basket. This endpoint requires authentication (session cookies and wcauthtoken). ```APIDOC ## [GET] /basket/v2/basket ### Description View the current basket. This endpoint requires authentication (session cookies and wcauthtoken). ### Method GET ### Endpoint https://www.sainsburys.co.uk/groceries-api/gol-services/basket/v2/basket ### Parameters #### Query Parameters - **pick_time** (string) - Required - ISO 8601 date for delivery (typically tomorrow) - **store_number** (string) - Required - Fulfilment store identifier (default: "0560") - **slot_booked** (string) - Required - Whether a delivery slot is currently reserved ("false" | "true") ### Request Example ```bash curl -H "Cookie: WC_AUTHENTICATION_...=...; WC_SESSION_ESTABLISHED=true; ..." \ -H "wcauthtoken: ..." \ 'https://www.sainsburys.co.uk/groceries-api/gol-services/basket/v2/basket?pick_time=2026-02-16T14:00:00Z&store_number=0560&slot_booked=false' ``` ``` -------------------------------- ### GET /isAuthenticated Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Tests authentication by attempting to fetch the basket. Returns `true` if a valid session exists, `false` otherwise. ```APIDOC ## [GET] /isAuthenticated ### Description Tests authentication by attempting to fetch the basket. Returns `true` if a valid session exists, `false` otherwise. ### Method GET ### Endpoint /isAuthenticated ### Parameters None ### Request Example ```typescript const isLoggedIn = await provider.isAuthenticated(); ``` ### Response #### Success Response (200) - **isAuthenticated** (boolean) - Whether the session is valid. #### Response Example ```json { "isAuthenticated": true } ``` ``` -------------------------------- ### Test search and basket endpoints with curl Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Shows how to test the product search endpoint without authentication and the basket endpoint with authentication using curl. ```bash # Test search (no auth required) curl 'https://www.sainsburys.co.uk/groceries-api/gol-services/product/v1/product?filter[keyword]=milk&page_number=1&page_size=10' # Test basket view (auth required) # 1. Login via CLI to get session # 2. Extract cookies and wcauthtoken # 3. Use in curl: curl -H "Cookie: WC_AUTHENTICATION_...=...; WC_SESSION_ESTABLISHED=true; ..." \ -H "wcauthtoken: ..." \ 'https://www.sainsburys.co.uk/groceries-api/gol-services/basket/v2/basket?pick_time=2026-02-16T14:00:00Z&store_number=0560&slot_booked=false' ``` -------------------------------- ### Batch search with supermarket search --batch - --provider ocado Source: https://github.com/abracadabra50/open-supermarkets/blob/main/README.md Batch search command that pipes a JSON array of queries to `supermarket search` with `--batch -` and `--provider ocado --limit 2`. The output shows a JSON response with product details for the first query, including id, name, price, currency, size, unit, and inStock. This is part of a workflow where the model uses the returned candidates to make purchasing decisions. ```console $ echo '["semi skimmed milk","free range eggs","chicken breast","broccoli"]' \ | supermarket search --batch - --provider ocado --limit 2 ``` ```json { "provider": "ocado", "results": [ { "query": "semi skimmed milk", "products": [ { "id": "73f814b7", "name": "Ocado British Semi Skimmed Milk 2 Pints", "price": 1.20, "currency": "GBP", "size": "1.136L", "unit": "1.06/1.136L", "inStock": true } ] } ] } ``` -------------------------------- ### Get Order History Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md HTTP request to retrieve order history. The response status is 404 because there are no active orders to test with. ```http GET /groceries-api/gol-services/order/v1/order/status Status: 404 (no active orders to test with) ``` -------------------------------- ### GET /groceries-api/gol-services/slot/v1/slot/delivery-information Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Retrieves delivery information such as minimum spend for home delivery and click-and-collect. Requires cookies and wcauthtoken authentication. ```APIDOC ## GET /groceries-api/gol-services/slot/v1/slot/delivery-information ### Description Retrieves delivery information such as minimum spend for home delivery and click-and-collect. Requires cookies and wcauthtoken authentication. ### Method GET ### Endpoint /groceries-api/gol-services/slot/v1/slot/delivery-information ### Authentication Requires cookies and wcauthtoken. ### Response #### Success Response (200) - **hd_minimum_spend** (string) - Minimum spend for home delivery. - **cnc_minimum_spend** (string) - Minimum spend for click-and-collect. #### Response Example { "hd_minimum_spend": "25", "cnc_minimum_spend": "0" } ``` -------------------------------- ### DeliverySlot interface Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Represents a delivery slot with start and end times in ISO 8601 format, date, delivery charge, and availability. ```typescript interface DeliverySlot { slot_id: string; start_time: string; // ISO 8601 timestamp end_time: string; // ISO 8601 timestamp date: string; // Date string price: number; // Delivery charge available: boolean; // Slot availability } ``` -------------------------------- ### Create All Providers Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Creates an array of all provider instances. ```typescript const allProviders = ProviderFactory.createAll(); // Returns array of all provider instances ``` -------------------------------- ### CLI: Browsing & Favourites Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/ocado.md Commands to list favourites, search within favourites, list categories, browse a category, and view recurring-shopping definitions. ```bash npm run groc -- --provider ocado favourites --json # Favourite/frequently-bought products npm run groc -- --provider ocado fav-search "milk" --json # Search within favourites npm run groc -- --provider ocado categories --json # List browse categories npm run groc -- --provider ocado browse "/categories//" --json # Browse a category npm run groc -- --provider ocado regulars --json # Recurring-shopping definitions ``` -------------------------------- ### Extract wcauthtoken from session Source: https://github.com/abracadabra50/open-supermarkets/blob/main/API-REFERENCE.md Extracts the wcauthtoken from the session cookies by finding the cookie whose name starts with 'WC_AUTHENTICATION_'. If not found, returns an empty string. ```javascript const authCookie = session.cookies.find(c => c.name.startsWith('WC_AUTHENTICATION_')); const wcauthtoken = authCookie ? authCookie.value : ''; ``` -------------------------------- ### Search products via CLI with JSON output Source: https://github.com/abracadabra50/open-supermarkets/blob/main/README.md CLI command to search for products with JSON output. The CLI is the foundation for all other interfaces. ```bash supermarket search "olive oil" --country ES --limit 5 --json ``` -------------------------------- ### Add-to-basket workflow commands Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/api/SKILL.md Workflow for adding an item to the basket: first search favourites, add directly if a clear match exists, otherwise use regular search and confirm with the user, then show the basket. ```bash node skills/api/wrapper.js fav-search "USER ITEM" ``` ```bash node skills/api/wrapper.js add [qty] ``` ```bash node skills/api/wrapper.js search "USER ITEM" ``` ```bash node skills/api/wrapper.js basket ``` -------------------------------- ### Run typecheck and commit documentation changes Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/superpowers/plans/2026-09-17-tesco-hungary-provider.md Commands to run typecheck and tests, then stage and commit the documentation changes. The commit message includes a Co-Authored-By trailer. ```bash npm run typecheck && npm test ``` ```bash git add skills/tesco-hu.md README.md SKILL.md docs/providers/evaluated.md git commit -m "docs(tesco-hu): skill file, README/SKILL rows, evaluated.md entry Co-Authored-By: Claude Fable 5.1 " ``` -------------------------------- ### Remove/update workflow commands Source: https://github.com/abracadabra50/open-supermarkets/blob/main/skills/api/SKILL.md Workflow for removing or updating a basket item: first inspect the basket to get item IDs, then use the basket item_id (not the product ID) for remove and update commands. ```bash node skills/api/wrapper.js basket ``` ```bash node skills/api/wrapper.js remove node skills/api/wrapper.js update ``` -------------------------------- ### Suggest Optimized Meals Based on Budget and Seasonality Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/SMART-SHOPPING.md Asynchronously suggests up to 7 optimized meals based on budget, dietary preferences, and seasonal ingredients. Filters meals by dietary restrictions, scores them by seasonal ingredient count and budget fit, then sorts and returns the top 7. ```typescript async function suggestOptimizedMeals( budget: number, preferences: Preferences, people: number ) { const month = new Date().getMonth() + 1; // Get seasonal ingredients const seasonal = getSeasonalProduce(month); // Get price data const ingredientPrices = await Promise.all( seasonal.map(ing => searchProduct(ing)) ); // Build meals around cheap + seasonal ingredients const mealDatabase = getMealDatabase(); const optimizedMeals = mealDatabase .filter(meal => { // Filter by dietary restrictions if (preferences.dietary_restrictions) { return preferences.dietary_restrictions.every(restriction => meal.tags.includes(restriction) ); } return true; }) .map(meal => { // Calculate cost using current prices const cost = calculateMealCost(meal, ingredientPrices); // Score based on seasonal ingredients const seasonalScore = meal.ingredients.filter(ing => seasonal.includes(ing) ).length; // Score based on budget const budgetScore = cost < (budget / 7) ? 10 : 0; return { ...meal, cost, score: seasonalScore + budgetScore, seasonal: seasonalScore > 0 }; }) .sort((a, b) => b.score - a.score) .slice(0, 7); // One week return optimizedMeals; } ``` -------------------------------- ### Search with Options Source: https://github.com/abracadabra50/open-supermarkets/blob/main/docs/API.md Searches for products with additional options for limit and offset. ```typescript const products = await provider.search('organic eggs', { limit: 10, offset: 0 }); ```