---
description: Scan the entire MindLyst repo and regenerate WINDSURF_CONTEXT.md with full project understanding
---

# Scan Repo & Update Context

This workflow scans the entire MindLyst repository, builds a comprehensive understanding, and writes/updates `WINDSURF_CONTEXT.md` at the repo root.

## Steps

1. **Read all key documentation files** to understand the current project state:
   - `AGENTS.md` — AI agent onboarding guide
   - `ARCHITECTURE.md` — Technical architecture
   - `README.md` — Project overview
   - `CONTRIBUTING.md` — Contribution guidelines
   - `.windsurfrules` — Windsurf-specific rules
   - `docs/mindlyst-mvp-prd.md` — Product requirements
   - `docs/mindlyst-ux-mobile-web.md` — UX specification
   - `docs/design_system_review.md` — Design system review
   - `design-system/README.md` — Design system overview
   - `mindlyst-native/IMPLEMENTATION_PLAN.md` — Phase tracker

2. **Scan the KMP shared module** for current business logic:
   - List all files under `mindlyst-native/shared/src/commonMain/kotlin/com/mindlyst/shared/`
   - Read key files: `MindLystCore.kt`, `di/SharedModule.kt`, `model/Models.kt`
   - Read all repository files under `repository/`
   - Read `theme/MindLystTokens.kt` for design token state
   - Note any `androidMain/` or `iosMain/` actual implementations

3. **Scan the Android app** for UI state:
   - List all files under `mindlyst-native/androidApp/src/main/java/com/mindlyst/android/`
   - Read `MainActivity.kt` and all files under `ui/`
   - Read `build.gradle.kts` for dependencies

4. **Scan the iOS app** for UI state:
   - List all files under `mindlyst-native/iosApp/`
   - Read `MindLystApp.swift`, `MindLystTheme.swift`, `ContentView.swift`
   - Read all files under `Components/` and `Screens/`

5. **Scan the web app** for UI state:
   - Read `mindlyst-native/web/package.json` for dependencies
   - Read all files under `mindlyst-native/web/src/pages/`
   - Read `mindlyst-native/web/src/styles/globals.css`

6. **Scan Gradle build configuration**:
   - Read `mindlyst-native/build.gradle.kts` (root)
   - Read `mindlyst-native/settings.gradle.kts`
   - Read `mindlyst-native/gradle/libs.versions.toml` for dependency versions
   - Read `mindlyst-native/gradle.properties`
   - Read `mindlyst-native/shared/build.gradle.kts`

7. **Run verification commands** (non-destructive, read-only):
   // turbo
   - `cd mindlyst-native && ./gradlew projects` — verify module structure
   // turbo
   - `cd mindlyst-native/web && cat package.json | head -20` — verify web deps

8. **Generate WINDSURF_CONTEXT.md** at the repo root with the following sections:

   ```markdown
   # WINDSURF_CONTEXT.md
   > Auto-generated by /scan-repo workflow. Last updated: <YYYY-MM-DD HH:MM>
   > Re-run with: /scan-repo-and-update-windsurf-context

   ## Project Summary
   <1-paragraph summary of MindLyst, current state, and what phase we're in>

   ## Architecture
   <Brief architecture description: KMP shared + native UI shells>

   ## Module Map
   <Table of all modules/directories with purpose and key files>

   ## Shared Logic (KMP commonMain)
   <List every class/file in shared module with one-line description>

   ## Platform UI State
   ### Android
   <List screens, components, what's implemented vs stubbed>
   ### iOS
   <List screens, components, what's implemented vs stubbed>
   ### Web
   <List pages, what's implemented vs stubbed>

   ## Design Tokens
   <Current color palette, fonts, spacing from MindLystTokens.kt>

   ## Dependencies
   <Key dependency versions from libs.versions.toml>

   ## Build Status
   <What builds, what doesn't, known issues>

   ## Implementation Progress
   <Phase checklist from IMPLEMENTATION_PLAN.md — copy current status>

   ## Open Issues / TODOs
   <Any TODOs found in code, known blockers, next steps>

   ## Key Files Quick Reference
   <Table: "When you need to..." → "Edit this file">
   ```

9. **Write the file** to `WINDSURF_CONTEXT.md` at the repo root. Create it if it doesn't exist; overwrite it completely if it does.

10. **Verify** the generated file is complete and accurate by re-reading it.

11. **Commit and push**:
   - `git add WINDSURF_CONTEXT.md`
   - `git commit -m "docs: update WINDSURF_CONTEXT.md via /scan-repo-and-update-windsurf-context"`
   - `git push`

## Notes
- This workflow creates `WINDSURF_CONTEXT.md` if it doesn't exist, or fully replaces it if it does
- It commits and pushes the updated file automatically
- Run this periodically to keep context fresh, especially after major changes
- The output should be comprehensive enough that any AI agent can onboard from this single file
