Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / notes / AGENTS.md
| 1 | # AGENTS.md — notes/ (':notes') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `notes/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install notes (dev by default)._ |
| 6 | <!-- last-reviewed: 2026-10-16 --> |
| 7 | - Gradle: :notes / dir: notes/ |
| 8 | - Package roots present: ui, data, platform, intents |
| 9 | - Entry files: MainActivity.kt, Route.kt, Navigation.kt |
| 10 | - Deps: :library:room, :library:ink, :library:image |
| 11 | - Metadata: metadata_data/notes.md (present) |
| 12 | - Rust: no / screenshotTest: yes |
| 13 | |
| 14 | ## Overview |
| 15 | **Purpose:** Offline markdown+ note-taking app (100% offline). Close-second reference impl after `backup/`, and the canonical `intents/` IPC demo. |
| 16 | **Key features:** |
| 17 | - Block-based editor (`Note`/`NoteBlock`) with stylus ink (`:library:ink`) and images (`:library:image`, content-addressed `sha256.jpg`) |
| 18 | - `.md` import/export — opens files shared from other apps, desktop file-drop, shares notes back out |
| 19 | - OpenAssistant read/add via `intents/`; local backup/restore via `AppBackupAgent` |
| 20 | **Architecture / data-flow:** `ui/` Compose list/detail → `platform/NotesViewModel` (+ `NotesUiContract`) → `data/NotesRepository` singleton over Room (`Note`/`NoteBlock`/`NoteDatabase`). `MainActivity.onCreateBeforeContent`: repo init → one-time legacy-notes clear + image `img_<uuid>.jpg → sha256.jpg` migration with block-reference rewrite → `ready` gate before `Navigation`. |
| 21 | **Entry points + reading order:** `Route` (`NotesList` / `Note(id)` / `ExternalNote(uri)`) → `MainActivity.kt` → `Navigation.kt` → `platform/NotesViewModel.kt` → `data/NotesRepository.kt`. |
| 22 | **Gotchas:** |
| 23 | - Migrations must finish before `ready = true` — image references break if skipped |
| 24 | - External/shared URIs enter via the `ExternalNote` route, not the list |
| 25 | - `intents/` DTOs are the copy-pattern for cross-app IPC; keep them thin |
| 26 | |
| 27 | ## Key files |
| 28 | ### Root — entry + navigation |
| 29 | - com/vayunmathur/notes/MainActivity.kt |
| 30 | - com/vayunmathur/notes/Navigation.kt |
| 31 | - com/vayunmathur/notes/Route.kt |
| 32 | ### data/ — Room entities + repository |
| 33 | - com/vayunmathur/notes/data/Note.kt |
| 34 | - com/vayunmathur/notes/data/NoteBlock.kt |
| 35 | - com/vayunmathur/notes/data/NoteDatabase.kt |
| 36 | - com/vayunmathur/notes/data/NotesRepository.kt |
| 37 | ### platform/ — ViewModel, contract, stores, export |
| 38 | - com/vayunmathur/notes/platform/NotesViewModel.kt |
| 39 | - com/vayunmathur/notes/platform/NotesUiContract.kt |
| 40 | - com/vayunmathur/notes/platform/NoteImageStore.kt — content-addressed image copy + migration |
| 41 | - com/vayunmathur/notes/platform/NoteMarkdownExporter.kt |
| 42 | - com/vayunmathur/notes/platform/AppBackupAgent.kt |
| 43 | ### ui/ — list/detail/ink/external screens |
| 44 | - com/vayunmathur/notes/ui/NotesListScreen.kt |
| 45 | - com/vayunmathur/notes/ui/NotesListPage.kt |
| 46 | - com/vayunmathur/notes/ui/NoteScreen.kt |
| 47 | - com/vayunmathur/notes/ui/NotePage.kt |
| 48 | - com/vayunmathur/notes/ui/InkEditorPage.kt |
| 49 | - com/vayunmathur/notes/ui/ExternalNoteScreen.kt |
| 50 | - com/vayunmathur/notes/ui/components/NoteEditorComponents.kt |
| 51 | ### intents/ — assistant IPC demo (copy this pattern) |
| 52 | - com/vayunmathur/notes/intents/GetIntent.kt |
| 53 | - com/vayunmathur/notes/intents/InsertIntent.kt |
| 54 | |
| 55 | ## Verify (this module only) |
| 56 | ``` |
| 57 | ./gradlew :notes:compileDevKotlin |
| 58 | ./gradlew :notes:lint |
| 59 | ./gradlew :notes:checkMetadata |
| 60 | ``` |