From ecb0f7c07a2f9bd42944ef04054cb94262ba0c07 Mon Sep 17 00:00:00 2001 From: Caine Date: Thu, 2 Apr 2026 16:42:06 +0100 Subject: Update README: Phase 2 complete, API docs, file structure --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 10 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 956dda1..d005227 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A custom Django app for pantry tracking, meta-recipes, and meal planning. Built ## Architecture - **Django 5.2** (latest LTS) with SQLite backend -- **Django REST Framework** for API (Phase 2) +- **Django REST Framework** for API with token auth - **HTMX** frontend planned (Phase 4) - **App name:** `kitchen` @@ -54,12 +54,36 @@ python manage.py createsuperuser python manage.py runserver 0.0.0.0:8042 ``` -Admin UI at: `http://localhost:8042/admin/` +## Access -## Credentials +- **Admin UI:** `http://localhost:8042/admin/` +- **Browsable API:** `http://localhost:8042/api/` +- **cgit:** `https://git.jihakuz.xyz/food/` -- **Admin user:** `tom` -- **Admin password:** `Kitch3n!2026` +## API + +All endpoints require auth. Token auth for Caine, session auth for browser. + +### Key Endpoints + +| Method | Endpoint | Purpose | +|--------|----------|---------| +| GET | `/api/what-can-i-cook/?servings=2` | Match pantry vs recipes | +| POST | `/api/log-cook/` | Log a cooked meal, optionally deduct from pantry | +| GET | `/api/pantry/` | List all pantry items | +| GET | `/api/pantry/expiring/` | Items expiring within 3 days | +| GET | `/api/pantry/restock/` | Staples needing restocking | +| CRUD | `/api/ingredients/` | Ingredient master list | +| CRUD | `/api/meta-recipes/` | Meta-recipes with nested slots | +| CRUD | `/api/recipes/` | Fixed recipes | +| CRUD | `/api/shopping-list/` | Shopping list | +| CRUD | `/api/cook-log/` | Cooking history | + +### Auth + +- **Token:** `Authorization: Token ` header +- **Session:** Log in via admin or `/api-auth/login/` +- **API users:** `tom` (admin), `caine` (API-only) ## File Structure @@ -70,8 +94,11 @@ Admin UI at: `http://localhost:8042/admin/` │ ├── urls.py │ └── wsgi.py ├── kitchen/ # Main app -│ ├── models.py # All models +│ ├── models.py # All 11 models │ ├── admin.py # Admin config with inlines +│ ├── serializers.py # DRF serializers +│ ├── views.py # ViewSets + what-can-i-cook + log-cook +│ ├── urls.py # API router │ ├── management/ │ │ └── commands/ │ │ └── seed.py # Initial data seeder @@ -79,6 +106,7 @@ Admin UI at: `http://localhost:8042/admin/` ├── venv/ # Python virtual environment (gitignored) ├── db.sqlite3 # SQLite database (gitignored) ├── manage.py +├── requirements.txt └── README.md ``` @@ -89,17 +117,26 @@ Admin UI at: `http://localhost:8042/admin/` - **Staples** (onions, frozen chips, salt, etc.) → auto-flag for restocking when quantity = 0 - **Onions** are a permanent staple — always restock - **Chicken skin** → remove before cooking (noted in slot option notes) -- **Tom prefers pork to chicken** — pork mince over loins +- **Tom prefers pork** to chicken — pork mince over loins +- **Cooked chicken** — 3 day max fridge life +- **Defrosted sausages** — 2-3 days max ## Implementation Phases - [x] **Phase 1:** Django project + models + admin + seed data -- [ ] **Phase 2:** DRF API + Caine integration + "what can I cook?" logic +- [x] **Phase 2:** DRF API + token auth + "what can I cook?" + log-cook with pantry deduction - [ ] **Phase 3:** Recipe import (URL scraping + cookbook extraction) - [ ] **Phase 4:** HTMX frontend (pantry view, recipe browser, shopping list) - [ ] **Phase 5:** Systemd service + nginx reverse proxy + production hardening +## Caine Integration + +OpenClaw skill file at `~/.openclaw/workspace/skills/food/SKILL.md` teaches Caine the API each session. Natural language interface via Matrix: +- "What can I cook?" → calls `/api/what-can-i-cook/` +- "Add 6 eggs to the fridge" → POST to `/api/pantry/` +- "Made stir fry with pork and noodles" → POST to `/api/log-cook/` with deduction +- [Photo of shopping] → identify items, bulk add to pantry + ## Design Doc -Full design document with meta-recipe concept, model rationale, and implementation plan: -`Obsidian Vault/Tom Net/Meal Planning System.md` +Full design document: `Obsidian Vault/Tom Net/Meal Planning System.md` -- cgit v1.2.3