docs: add WearOS target documentation to AGENTS.md
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# SwimBuddy
|
# SwimBuddy
|
||||||
|
|
||||||
Swimming workout tracker with Apple Watch companion app. Expo 57 + React Native 0.86 + NativeWind v5 + Drizzle ORM + Swift Watch target.
|
Swimming workout tracker with Apple Watch and WearOS companion apps. Expo 57 + React Native 0.86 + NativeWind v5 + Drizzle ORM + Swift Watch target + Kotlin WearOS target.
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
@@ -11,25 +11,34 @@ npx expo prebuild -p ios # Regenerate ios/ dir (safe — targets/ persists)
|
|||||||
npx drizzle-kit generate # Regenerate SQL migrations after schema changes
|
npx drizzle-kit generate # Regenerate SQL migrations after schema changes
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**WearOS:**
|
||||||
|
```bash
|
||||||
|
./scripts/build-wearos.sh debug # Build debug APK
|
||||||
|
./scripts/build-wearos.sh release # Build release APK
|
||||||
|
./scripts/generate-wearos-icon.sh assets/icon.png # Generate launcher icons
|
||||||
|
```
|
||||||
|
|
||||||
No `npm test` or lint scripts exist yet. No `babel.config.js` — NativeWind v5 uses CSS-first config.
|
No `npm test` or lint scripts exist yet. No `babel.config.js` — NativeWind v5 uses CSS-first config.
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
src/
|
src/
|
||||||
features/<name>/screens/ # Screen components (registered in navigators)
|
features/<name>/screens/ # Screen components (registered in navigators)
|
||||||
features/<name>/components/# Feature-specific UI
|
features/<name>/components/ # Feature-specific UI
|
||||||
features/<name>/hooks/ # Feature-specific hooks
|
features/<name>/hooks/ # Feature-specific hooks
|
||||||
components/ # Shared UI primitives (flat)
|
components/ # Shared UI primitives (flat)
|
||||||
hooks/ # Shared hooks
|
hooks/ # Shared hooks
|
||||||
navigation/ # React Navigation (RootNav, TabNav, feature stacks)
|
navigation/ # React Navigation (RootNav, TabNav, feature stacks)
|
||||||
db/ # Drizzle schema, client, relations, operations
|
db/ # Drizzle schema, client, relations, operations
|
||||||
providers/ # DatabaseProvider, SettingsProvider (MMKV)
|
providers/ # DatabaseProvider, SettingsProvider (MMKV)
|
||||||
utils/ # formatTime, calculateSwolf, uuid, etc.
|
utils/ # formatTime, calculateSwolf, uuid, etc.
|
||||||
constants/ # strokes, poolLengths, colors
|
constants/ # strokes, poolLengths, colors
|
||||||
types/ # workout.ts, common.ts
|
types/ # workout.ts, common.ts
|
||||||
modules/watch-connectivity/# Expo native module bridging WCSession
|
modules/watch-connectivity/ # Expo native module bridging WCSession (Apple Watch)
|
||||||
targets/watch/ # Apple Watch app (Swift/SwiftUI) — survives prebuild
|
modules/wear-connectivity/ # Expo native module bridging Wear Data Layer (WearOS)
|
||||||
|
targets/watch/ # Apple Watch app (Swift/SwiftUI) — survives prebuild
|
||||||
|
targets/wearos/ # WearOS app (Kotlin/Compose) — survives prebuild
|
||||||
```
|
```
|
||||||
|
|
||||||
## Key Conventions
|
## Key Conventions
|
||||||
@@ -40,7 +49,7 @@ targets/watch/ # Apple Watch app (Swift/SwiftUI) — survives preb
|
|||||||
- **`className` types**: `nativewind-env.d.ts` at root — don't delete
|
- **`className` types**: `nativewind-env.d.ts` at root — don't delete
|
||||||
- **lightningcss pinned** to 1.30.1 in package.json overrides — required by NativeWind v5
|
- **lightningcss pinned** to 1.30.1 in package.json overrides — required by NativeWind v5
|
||||||
|
|
||||||
## Watch Target
|
## Watch Target (Apple Watch)
|
||||||
|
|
||||||
- Lives in `targets/watch/`, NOT in `ios/` — survives `expo prebuild --clean`
|
- Lives in `targets/watch/`, NOT in `ios/` — survives `expo prebuild --clean`
|
||||||
- Config: `targets/watch/expo-target.config.js`
|
- Config: `targets/watch/expo-target.config.js`
|
||||||
@@ -50,6 +59,15 @@ targets/watch/ # Apple Watch app (Swift/SwiftUI) — survives preb
|
|||||||
- HealthKit for swim workout tracking (indoor swimming)
|
- HealthKit for swim workout tracking (indoor swimming)
|
||||||
- Swift types `StoredWorkout`, `StoredSet`, `CompletedLap` in `WorkoutManager.swift`
|
- Swift types `StoredWorkout`, `StoredSet`, `CompletedLap` in `WorkoutManager.swift`
|
||||||
|
|
||||||
|
## WearOS Target
|
||||||
|
|
||||||
|
- Lives in `targets/wearos/` — survives `expo prebuild --clean`
|
||||||
|
- Kotlin + Jetpack Compose with Wear OS Compose libraries
|
||||||
|
- Build: `./scripts/build-wearos.sh` or open `targets/wearos/` in Android Studio
|
||||||
|
- Uses Wear Data Layer API for phone↔watch communication
|
||||||
|
- Health Services Client for swim workout tracking
|
||||||
|
- Namespace: `nl.guidoit.swimbuddy`
|
||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
- **expo-sqlite** + **Drizzle ORM** (SQLite dialect, expo driver)
|
- **expo-sqlite** + **Drizzle ORM** (SQLite dialect, expo driver)
|
||||||
@@ -94,6 +112,7 @@ These are hard-won bugs that will waste hours if rediscovered:
|
|||||||
- Watch target compiles as separate Xcode target — not a RN module
|
- Watch target compiles as separate Xcode target — not a RN module
|
||||||
- `react-native-css` is a NativeWind v5 peer dependency — don't remove
|
- `react-native-css` is a NativeWind v5 peer dependency — don't remove
|
||||||
- `@bacons/apple-targets` plugin must be in app.json plugins array
|
- `@bacons/apple-targets` plugin must be in app.json plugins array
|
||||||
|
- WearOS uses same `applicationId` as iOS bundle identifier — don't change without updating both
|
||||||
|
|
||||||
## Expo Docs
|
## Expo Docs
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user