# Tracker seed — Engineering Review work items

Files the `ENGINEERING_REVIEW_SCORECARD.md` P0–P3 action plan as **tracker items**
(one per affected product) via the platform-service tracker API
(`POST /api/items` — the same endpoint `tracker-web` proxies to).

## Files
- `engineering-review-items.json` — the item payloads (16 items), scoped per `productId`.
- `seed-tracker-items.mjs` — dependency-free Node script that mints an HS256
  token from `$JWT_SECRET` and POSTs each item (with dedupe-by-title).

## Prerequisites
The platform stack must be running and reachable (it serves the tracker items API):

```bash
# in learning_ai_common_plat (Cosmos emulator path)
docker compose up -d            # platform-service on :4003
# …or run platform-service directly (ephemeral, no persistence):
#   DB_PROVIDER=memory COSMOS_ENDPOINT=x COSMOS_KEY=x JWT_SECRET=dev \
#   pnpm --dir services/platform-service dev
```

## Usage
```bash
cd scripts/tracker-seed

# 1) Preview — no token, no network calls:
node seed-tracker-items.mjs --dry-run

# 2) Create for real (uses the same JWT_SECRET platform-service verifies):
JWT_SECRET="<shared-secret>" \
PLATFORM_API_URL="http://localhost:4003" \
node seed-tracker-items.mjs
```

Re-running is safe: existing items are skipped by title per product (use
`--force` to bypass the check). View results in `tracker-web` (`:3003`) under
each product, or `GET /api/items?productId=<id>`.

## Env
| Var | Default | Notes |
|-----|---------|-------|
| `PLATFORM_API_URL` | `http://localhost:4003` | platform-service base URL |
| `JWT_SECRET` | — | required (unless `--dry-run`); must match platform-service |
| `SEED_SUB` | `eng-review-bot` | token subject → `reportedBy` |
| `SEED_ROLE` | `admin` | token role claim |
| `ITEMS_FILE` | `engineering-review-items.json` | payload file |

Source of the items: `../../ENGINEERING_REVIEW_SCORECARD.md`.
