Metadata-Version: 2.4
Name: food-ai-swiggy
Version: 0.1.0
Summary: Automatically order Swiggy food matching your personality when you work too long
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0
Requires-Dist: python-dotenv>=1.0.0

# Food-AI Library (food-ai-swiggy) 🍊

An automated, background activity-tracking daemon that checks user working hours on Windows, performs a psychological personality mapping, and automatically orders a surprise Swiggy food treat based on their profile.

## Features
- **16-Personalities Style Onboarding**: A 10-question Likert-scale CLI questionnaire mapping psychological/behavioral traits to food preferences (e.g. Adventure, Complexity, Heat Tolerance, Social Sharing).
- **Windows Activity Tracking**: A background tracking daemon using native Windows APIs (`GetLastInputInfo` via `ctypes`) that tracks user keystrokes and mouse movements system-wide without polling loops or keyboard logging.
- **Aesthetic Tkinter Popup**: A beautiful dark-theme popup asking the user: *"You've been working too much, let me surprise you?"* when they exceed the continuous work threshold.
- **Swiggy Food MCP Client**: A native JSON-RPC-over-HTTP client for calling Swiggy Food MCP tools.
- **Simulation / Dry-Run Mode**: Automatically runs in a visual dry-run mode when no live API token is supplied, allowing testing of the complete checkout, ordering, and tracking flow.

---

## Directory Structure
- [pyproject.toml](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/pyproject.toml) - Packaging metadata and dependencies.
- [config.json](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/config.json) - Daemon threshold configurations, idle timeout limits, and dry-run toggles.
- [main.py](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/main.py) - Entry point for CLI.
- [food_ai/](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/food_ai/)
  - [personality.py](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/food_ai/personality.py) - Likert questionnaire & scoring profile engine.
  - [mcp_client.py](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/food_ai/mcp_client.py) - JSON-RPC HTTP client for Swiggy Food MCP tools.
  - [tracker.py](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/food_ai/tracker.py) - Windows user input monitor via ctypes.
  - [popup.py](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/food_ai/popup.py) - Tkinter dark-theme user break pop-up modal.
  - [order_bot.py](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/food_ai/order_bot.py) - Swiggy Food MCP ordering orchestrator.
- [tests/](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/tests/)
  - [test_food_ai.py](file:///C:/Users/91891/.gemini/antigravity-ide/scratch/food-ai/tests/test_food_ai.py) - Automated tests for personality mapping and client.

---

## Setup & Installation

Ensure you have Python 3.8+ installed. Navigate to the project directory and install in editable mode:
```bash
pip install -e .
```

---

## Usage

### 1. Onboarding Assessment
Complete the 10-question CLI questionnaire to establish your food profile:
```bash
python main.py --onboard
```

### 2. Start Activity Tracking Daemon
Launches the background monitor that tracks continuous working hours:
```bash
python main.py --track
```
> **Testing Tip**: By default, `config.json` has `use_test_threshold` set to `true`, which sets the active tracking threshold to **15 seconds** instead of 5 hours. Move your mouse or type to trigger the popup in seconds!

### 3. Test Surprise Order Flow Directly
Triggers the entire Swiggy Food MCP flow immediately using your stored personality:
```bash
python main.py --surprise
```

### 4. Test Pop-Up Window Interface
Review the Tkinter styling of the notification window directly:
```bash
python main.py --test-popup
```

---

## Configuration (`config.json`)
Modify values in `config.json` to change thresholds and live API connection settings:
```json
{
  "tracking_threshold_hours": 5.0,
  "tracking_threshold_test_sec": 15,
  "use_test_threshold": true,
  "idle_timeout_min": 5.0,
  "default_address_label": "Home",
  "dry_run": true
}
```
*To connect to a live Swiggy MCP account, set `"dry_run": false` and set the `SWIGGY_ACCESS_TOKEN` environment variable.*
