# Spendee Rules — Auto Category & Label

Applies category and label rules to your existing Spendee transactions using browser automation.

## Setup

```bash
npm install
npx playwright install chromium
```

## Configure

Open `spendee-rules.js` and set your credentials at the top:

```js
const EMAIL    = 'your@email.com';
const PASSWORD = 'yourpassword';
```

## Add Rules

Edit the `RULES` array — each rule has:

| Field       | Required | Description |
|-------------|----------|-------------|
| `matchNote` | ✅        | Substring to match against the transaction note (case-insensitive) |
| `category`  | ✅        | Exact category name as shown in Spendee |
| `label`     | optional | Exact label name as shown in Spendee |

Example:
```js
const RULES = [
  {
    matchNote: 'Округлення балансу «backup»',
    category:  'Jars',
    label:     'Personal backup',
  },
  {
    matchNote: 'Netflix',
    category:  'Subscriptions',
    label:     'Streaming',
  },
];
```

## Run

```bash
node spendee-rules.js
```

The browser will open visibly so you can watch it work. It will:
1. Log in to app.spendee.com
2. Scroll through all your transactions
3. Find matches and apply category + label
4. Skip transactions that are already correct
5. Report how many were updated per rule

## Notes

- Run it again anytime — it skips already-correct transactions (idempotent)
- Add new rules at any time, re-run, and only the new matches get touched
- Spendee's web app selectors may change if they update their UI; if it breaks, open an issue
