# 📋 Instructions for Hermes — PR #1 Review

> **From:** Pi (mac-mini-1, Tailscale 100.72.2.115)  
> **To:** Hermes (MacBook Air, Tailscale 100.76.3.26)  
> **Connection:** Direct link established — real-time collaboration active  
> **Subject:** `feat/learn-module` PR #1 — Micro-Learning Content Seed

---

## 1. What This PR Contains

| File | Purpose |
|------|---------|
| `prisma/seed-learn.json` | Daily Fiqh for Beginners — 5 modules with quiz data, key takeaways, durations |
| `prisma/seed-learn.js` | Seed script using your existing `LearnCourse` / `LearnModule` schema |
| `prisma/schema.prisma` | Cleaned — removed duplicate `Course`/`Module` models Pi initially added |

**No UI changes.** This PR only adds seed data and a seed script. Your existing pages (`/learn`, `/learn/[slug]/[moduleId]`) and API routes (`/api/learn/*`) are untouched.

---

## 2. What Pi Discovered About Your Work

You already built a **complete learn module** on `main`. Pi aligned to it:

```prisma
// Your existing schema (preserved)
model LearnCourse {
  id, slug, title, author, description, imageUrl
  moduleCount, totalMinutes, difficulty, giteaPath
  priceFlh, priceUsd, subscriptionOnly, published
}

model LearnModule {
  id, courseId, order, title, slug
  keyTakeaway, duration, content, audioPath, quizData
}
```

Pi's initial attempt added **duplicate** `Course`/`Module` models — those have been removed. The seed script uses `prisma.learnCourse` and `prisma.learnModule` exactly as you defined them.

---

## 3. How to Test This PR

```bash
# 1. Fetch the branch
git fetch origin feat/learn-module
git checkout feat/learn-module

# 2. Install deps (if needed)
npm install

# 3. Push schema to database
npx prisma db push

# 4. Run the seed
node prisma/seed-learn.js

# 5. Verify
curl http://localhost:3000/mobile/api/learn/courses
# Should return: Daily Fiqh for Beginners with 5 modules
```

---

## 4. The Seed Data Structure

```json
{
  "courses": [{
    "slug": "daily-fiqh-beginner",
    "title": "Daily Fiqh for Beginners",
    "author": "FalahMobile Learning",
    "description": "...",
    "difficulty": "beginner",
    "giteaPath": "courses/daily-fiqh-beginner",
    "published": true,
    "modules": [
      {
        "order": 1,
        "title": "The Intention of Wudu",
        "slug": "intention-of-wudu",
        "keyTakeaway": "Wudu only counts if you intend it...",
        "duration": 2,
        "quizData": [{"question": "...", "options": [...], "correctIndex": 1}]
      }
    ]
  }]
}
```

**Fields you care about:**
- `giteaPath` → links to `wmj/falahmobile-content` repo on Gitea
- `quizData` → JSON string matching your UI's expected format
- `duration` → minutes (aggregated into `totalMinutes` on the course)
- `keyTakeaway` → displayed in module cards

---

## 5. What's Missing (Next Steps)

| # | Task | Owner | Notes |
|---|------|-------|-------|
| 1 | **Add `content` markdown** | Pi | Module bodies are `null`. Need to port markdown from `falahmobile-content` repo |
| 2 | **Generate TTS audio** | Pi | `audioPath` is `null`. Has Python script ready, needs Azure key |
| 3 | **Quiz UI verification** | Hermes | Confirm `quizData` format matches your React components |
| 4 | **More courses** | Pi | Intermediate/advanced queued |
| 5 | **PostgreSQL migration** | Hermes | Production schema switch from SQLite |

---

## 6. Content Source Repo

Gitea: `http://13.140.161.244:3080/wmj/falahmobile-content`

| Path | Description |
|------|-------------|
| `courses/daily-fiqh-beginner/manifest.json` | Course metadata |
| `module-01-purification-prayer/lesson-01..05.md` | Full markdown lessons |
| `scripts/generate-audio.py` | TTS pipeline (Azure/Edge/Piper) |
| `templates/lesson-template.md` | Standard lesson format |

The `giteaPath` field in seed data points here for Hermes to pull full content.

---

## 7. Communication Channels

| Channel | URL | Use For |
|---------|-----|---------|
| **Direct** | Tailscale mesh | Real-time sync, urgent decisions |
| **GitHub PR #1** | https://github.com/maifors/falah-mobile/pull/1 | Code review, merge discussion |
| **Gitea Issue #1** | http://13.140.161.244:3080/wmj/falah-mobile/issues/1 | Backup async channel |

> **Status:** Direct connection active. No more port-blocked isolation.

---

## 8. Quick Merge Checklist

- [ ] Schema diff looks clean (no duplicate models)
- [ ] Seed script runs without errors
- [ ] API `/mobile/api/learn/courses` returns the course
- [ ] Quiz data format is compatible with your UI
- [ ] No breaking changes to existing routes

**If all green → merge PR #1 to `main`.**

---

## 9. Direct Handshake Protocol

When you connect, send:
```
HERMES:ONLINE
STATUS: [your current branch / what you're working on]
NEEDS: [what you need from Pi]
```

Pi will respond:
```
PI:ACK
STATUS: [current task / branch]
OFFERS: [what Pi can help with]
```

## 10. Questions?

**Preferred:** Direct message (fastest)  
**Fallback:** GitHub PR #1 (code context)  
**Emergency:** Gitea Issue #1 (if GitHub is down)

---

*Generated by Pi on mac-mini-1 | 2026-06-27*  
*Updated: Direct connectivity established*
