git.iko.soy/opencode-android
on 3c09796 help sign in
opencode-android/CLAUDE.md
40 lines 1.6 kB history raw
1# opencode-android
3Native Android client for the opencode server, built with Crux (Rust core), Kotlin, and Jetpack Compose.
5## Architecture
7- **shared/** — Rust Crux core (canonical spec, unit-tested with `cargo test`)
8- **app/** — Android shell with Kotlin port of the reducer (`OpencodeCore`)
9- All app logic in `OpencodeCore.kt`; UI is a thin Compose shell
10- Three screens: Connect → Sessions → Chat
12## Key Files
14- `app/src/main/java/soy/iko/opencode/core/OpencodeCore.kt` — reducer, all state management
15- `app/src/main/java/soy/iko/opencode/core/ViewModel.kt` — UiState, Event, data classes
16- `app/src/main/java/soy/iko/opencode/core/Protocol.kt` — wire types, SSE event parser
17- `app/src/main/java/soy/iko/opencode/core/HttpClient.kt` — OkHttp wrapper
18- `app/src/main/java/soy/iko/opencode/core/SseClient.kt` — SSE stream client
19- `app/src/main/java/soy/iko/opencode/ui/screens/` — ConnectScreen, SessionsScreen, ChatScreen
20- `app/src/main/java/soy/iko/opencode/ui/components/MessageBubble.kt` — message rendering
22## Build
24```sh
25source .buildenv.sh
26nix develop -c ./gradlew assembleDebug
27```
29## Code Conventions
31- Kotlin + Jetpack Compose (Material 3)
32- State flows through `MutableStateFlow<UiState>` → `collectAsStateWithLifecycle`
33- All state mutations on main dispatcher (viewModelScope)
34- Network I/O on `Dispatchers.IO` inside HttpClient/SseClient
35- Keep the Rust core and Kotlin port behaviourally identical
37## Version Control
39- Uses `jj` (jujutsu) colocated with git
40- Push to master: `jj git push --change @` to create a bookmark, or commit then push