Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / music / AGENTS.md
| 1 | # AGENTS.md — music/ (':music') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `music/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install music (dev by default)._ |
| 6 | <!-- last-reviewed: 2026-10-16 --> |
| 7 | - Gradle: :music / dir: music/ |
| 8 | - Package roots present: ui, data, platform, intents, service |
| 9 | - Entry files: MainActivity.kt, Route.kt, Navigation.kt |
| 10 | - Deps: :library:room, :library:image, :sdk:cast, :library:media |
| 11 | - Metadata: metadata_data/music.md (present) |
| 12 | - Rust: no / screenshotTest: yes |
| 13 | |
| 14 | ## Overview |
| 15 | **Purpose:** Offline M3Y music player — local library by song/album/artist/playlist, synced lyrics from file tags, Cast to TV, Android Auto. No network permission at all. |
| 16 | **Key features:** |
| 17 | - Library scan into Room (`Music`/`Album`/`Artist`/`Playlist`) with `SyncWorker`; now-playing + queue + shuffle, wide-layout player |
| 18 | - Embedded + synced lyrics views; playlist CRUD dialogs; audio-preview + play/search assistant intents |
| 19 | - Playback in `service/PlaybackService` (local) / `CastingPlayer` (remote via `:sdk:cast`); `MusicLibraryTree` exposes the Auto tree |
| 20 | **Architecture / data-flow:** `ui/` tabs + now-playing → `platform/MusicViewModel` (+ `MusicUiContract`) + `platform/PlaybackManager` → `data/MusicRepository` over Room + `service/PlaybackService`; `platform/CastPlayback` + `service/CastQueue` take over when casting. |
| 21 | **Entry points + reading order:** `Route` → `MainActivity.kt` → `Navigation.kt` → `ui/MusicTabsScreen.kt` → `platform/PlaybackManager.kt` → `service/PlaybackService.kt` → `data/MusicRepository.kt`. |
| 22 | **Gotchas:** |
| 23 | - Playback state lives in the service, not the ViewModel — UI binds, never owns |
| 24 | - Cast and local are separate player paths sharing one queue model; test handoff, not just each side |
| 25 | |
| 26 | ## Key files |
| 27 | ### Root — entry + navigation |
| 28 | - com/vayunmathur/music/MainActivity.kt |
| 29 | - com/vayunmathur/music/Navigation.kt |
| 30 | - com/vayunmathur/music/Route.kt |
| 31 | ### data/ — Room library |
| 32 | - com/vayunmathur/music/data/MusicDatabase.kt |
| 33 | - com/vayunmathur/music/data/MusicRepository.kt |
| 34 | - com/vayunmathur/music/data/Music.kt |
| 35 | - com/vayunmathur/music/data/Album.kt |
| 36 | - com/vayunmathur/music/data/Artist.kt |
| 37 | - com/vayunmathur/music/data/Playlist.kt |
| 38 | ### platform/ — ViewModel, playback glue, lyrics |
| 39 | - com/vayunmathur/music/platform/MusicViewModel.kt |
| 40 | - com/vayunmathur/music/platform/MusicUiContract.kt |
| 41 | - com/vayunmathur/music/platform/PlaybackManager.kt |
| 42 | - com/vayunmathur/music/platform/CastPlayback.kt |
| 43 | - com/vayunmathur/music/platform/Lyrics.kt |
| 44 | - com/vayunmathur/music/platform/EmbeddedLyrics.kt |
| 45 | - com/vayunmathur/music/platform/SyncWorker.kt |
| 46 | - com/vayunmathur/music/platform/Util.kt |
| 47 | ### service/ — playback + Auto tree + cast queue |
| 48 | - com/vayunmathur/music/service/PlaybackService.kt |
| 49 | - com/vayunmathur/music/service/MusicLibraryTree.kt |
| 50 | - com/vayunmathur/music/service/CastingPlayer.kt |
| 51 | - com/vayunmathur/music/service/CastQueue.kt |
| 52 | ### intents/ — assistant playback IPC |
| 53 | - com/vayunmathur/music/intents/PlayIntent.kt |
| 54 | - com/vayunmathur/music/intents/SearchIntent.kt |
| 55 | - com/vayunmathur/music/intents/AudioPreviewActivity.kt |
| 56 | ### ui/ + ui/components/ + ui/dialogs/ — library, player, playlists |
| 57 | - com/vayunmathur/music/ui/MusicTabsScreen.kt |
| 58 | - com/vayunmathur/music/ui/HomeScreen.kt |
| 59 | - com/vayunmathur/music/ui/SongsScreen.kt |
| 60 | - com/vayunmathur/music/ui/SongScreen.kt |
| 61 | - com/vayunmathur/music/ui/AlbumScreen.kt |
| 62 | - com/vayunmathur/music/ui/AlbumDetailScreen.kt |
| 63 | - com/vayunmathur/music/ui/AlbumDetailContent.kt |
| 64 | - com/vayunmathur/music/ui/ArtistScreen.kt |
| 65 | - com/vayunmathur/music/ui/ArtistDetailScreen.kt |
| 66 | - com/vayunmathur/music/ui/PlaylistScreen.kt |
| 67 | - com/vayunmathur/music/ui/PlaylistDetailScreen.kt |
| 68 | - com/vayunmathur/music/ui/NowPlayingScreen.kt |
| 69 | - com/vayunmathur/music/ui/NowPlayingColumn.kt |
| 70 | - com/vayunmathur/music/ui/NowPlayingQueue.kt |
| 71 | - com/vayunmathur/music/ui/NowPlayingWideLayout.kt |
| 72 | - com/vayunmathur/music/ui/LyricsView.kt |
| 73 | - com/vayunmathur/music/ui/components/NowPlayingBar.kt |
| 74 | - com/vayunmathur/music/ui/components/PlayingBottomBar.kt |
| 75 | - com/vayunmathur/music/ui/components/PlayShuffleRow.kt |
| 76 | - com/vayunmathur/music/ui/components/ShufflePlayFab.kt |
| 77 | - com/vayunmathur/music/ui/components/NewPlaylistFab.kt |
| 78 | - com/vayunmathur/music/ui/components/AddToPlaylistButton.kt |
| 79 | - com/vayunmathur/music/ui/components/MusicTabsBar.kt |
| 80 | - com/vayunmathur/music/ui/components/TrackListItem.kt |
| 81 | - com/vayunmathur/music/ui/dialogs/AddToPlaylistDialog.kt |
| 82 | - com/vayunmathur/music/ui/dialogs/CreatePlaylistDialog.kt |
| 83 | |
| 84 | ## Verify (this module only) |
| 85 | ``` |
| 86 | ./gradlew :music:compileDevKotlin |
| 87 | ./gradlew :music:lint |
| 88 | ./gradlew :music:checkMetadata |
| 89 | ``` |