Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / flashcards / AGENTS.md
| 1 | # AGENTS.md — flashcards/ (':flashcards') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `flashcards/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | _Install: ./install flashcards (dev by default)._ |
| 6 | - Gradle: :flashcards / dir: flashcards/ |
| 7 | - Package roots present: ui, data |
| 8 | - Entry files: MainActivity.kt, Route.kt |
| 9 | - Deps: :library:room, :library:image |
| 10 | - Metadata: metadata_data/flashcards.md (present) |
| 11 | - Rust: no / screenshotTest: yes |
| 12 | |
| 13 | ## Overview |
| 14 | **Purpose:** Offline spaced-repetition flashcards — Anki-style notes/templates/decks with FSRS scheduling, review reminders, deck file sharing, APKG import/export. 100% offline. |
| 15 | **Key features:** Note-type editor + templating (`TemplateEngine`, `HtmlConvert`), card generation, review sessions with grading, FSRS optimizer, stats/charts, TTS speaker, media store; reminders via `ReviewReminderWorker`. |
| 16 | **Entry points:** `MainActivity.kt` → `ui/DeckListPage.kt` → `util/FlashcardsViewModel.kt` → `data/FlashcardsRepository.kt` → `util/Scheduler.kt` → `ui/ReviewPage.kt`. |
| 17 | **Gotchas:** |
| 18 | - `util/` is NOT a closed package root — don't add more files there |
| 19 | - Scheduling correctness (FSRS) is the product — scheduler changes need review-log-driven tests, not just UI checks |
| 20 | - APKG import/export must stay compatible with Anki's format — test round-trips, not just one direction |
| 21 | - Platform backup must never ship the raw SQLCipher DB: its passphrase is wrapped by a non-exportable KeyStore key, so a restored raw copy cannot be opened. The DB travels only via `platform/AppBackupAgent` + `SqlCipherDbCodec` (plaintext in the payload, re-encrypted under the new device's passphrase, minted by `flashcardsDbConfigs` when restore runs before first launch) |
| 22 | |
| 23 | ## Key files |
| 24 | ### Root — entry |
| 25 | - com/vayunmathur/flashcards/MainActivity.kt |
| 26 | - com/vayunmathur/flashcards/Route.kt — decks/notes/review/stats destinations plus the dialog destinations (add/delete deck, custom study, move/tag/reset notes, delete note type, preset name, reminder time) |
| 27 | ### data/ — notes, decks, review log (Room) |
| 28 | - com/vayunmathur/flashcards/data/FlashcardsDatabase.kt |
| 29 | - com/vayunmathur/flashcards/data/FlashcardsRepository.kt |
| 30 | - com/vayunmathur/flashcards/data/Note.kt |
| 31 | - com/vayunmathur/flashcards/data/NoteType.kt |
| 32 | - com/vayunmathur/flashcards/data/NoteTypeField.kt |
| 33 | - com/vayunmathur/flashcards/data/Card.kt |
| 34 | - com/vayunmathur/flashcards/data/CardTemplate.kt |
| 35 | - com/vayunmathur/flashcards/data/Deck.kt |
| 36 | - com/vayunmathur/flashcards/data/ReviewLog.kt |
| 37 | ### util/ — ViewModel, scheduler, import/export |
| 38 | - com/vayunmathur/flashcards/util/FlashcardsViewModel.kt |
| 39 | - com/vayunmathur/flashcards/util/FlashcardsViewModelHelper.kt |
| 40 | - com/vayunmathur/flashcards/util/FlashcardsUiContract.kt |
| 41 | - com/vayunmathur/flashcards/util/Scheduler.kt |
| 42 | - com/vayunmathur/flashcards/util/FsrsOptimizer.kt |
| 43 | - com/vayunmathur/flashcards/util/ReviewSession.kt |
| 44 | - com/vayunmathur/flashcards/util/CardGenerator.kt |
| 45 | - com/vayunmathur/flashcards/util/TemplateEngine.kt |
| 46 | - com/vayunmathur/flashcards/util/HtmlConvert.kt |
| 47 | - com/vayunmathur/flashcards/util/ApkgImport.kt |
| 48 | - com/vayunmathur/flashcards/util/ApkgExport.kt |
| 49 | - com/vayunmathur/flashcards/util/DeckIo.kt |
| 50 | - com/vayunmathur/flashcards/util/MediaStore.kt |
| 51 | - com/vayunmathur/flashcards/util/TtsSpeaker.kt |
| 52 | - com/vayunmathur/flashcards/util/ReviewReminderWorker.kt |
| 53 | - com/vayunmathur/flashcards/platform/AppBackupAgent.kt — platform backup agent: SQLCipher codec round-trip for the DB plus settings datastore and media dir; the raw encrypted DB and `secure_prefs` are excluded in `res/xml/data_extraction_rules.xml` (device transfer) |
| 54 | ### ui/ — decks, notes, review, stats |
| 55 | - com/vayunmathur/flashcards/ui/DeckListPage.kt |
| 56 | - com/vayunmathur/flashcards/ui/Navigation.kt — tab stack plus `DialogPage()` entries |
| 57 | - com/vayunmathur/flashcards/ui/FlashcardsDialogEntries.kt — dialog route entries (perform the action, pop) |
| 58 | - com/vayunmathur/flashcards/ui/ReviewPage.kt |
| 59 | - com/vayunmathur/flashcards/ui/ReviewGradeButtons.kt |
| 60 | - com/vayunmathur/flashcards/ui/StudyModeRow.kt |
| 61 | - com/vayunmathur/flashcards/ui/NoteListPage.kt |
| 62 | - com/vayunmathur/flashcards/ui/NoteListScreen.kt |
| 63 | - com/vayunmathur/flashcards/ui/NoteRowItem.kt |
| 64 | - com/vayunmathur/flashcards/ui/NoteEditPage.kt |
| 65 | - com/vayunmathur/flashcards/ui/NoteListFileHelpers.kt |
| 66 | - com/vayunmathur/flashcards/ui/ReorderableNoteList.kt |
| 67 | - com/vayunmathur/flashcards/ui/NoteTypeEditorPage.kt |
| 68 | - com/vayunmathur/flashcards/ui/NoteTypeEditorSection.kt |
| 69 | - com/vayunmathur/flashcards/ui/TagFilterRow.kt |
| 70 | - com/vayunmathur/flashcards/ui/StatsPage.kt |
| 71 | - com/vayunmathur/flashcards/ui/FlashcardsCharts.kt |
| 72 | - com/vayunmathur/flashcards/ui/MarkdownContent.kt |
| 73 | - com/vayunmathur/flashcards/ui/SettingsPage.kt |
| 74 | ### ui/dialogs/ — stateless dialog contents for the dialog routes |
| 75 | - com/vayunmathur/flashcards/ui/dialogs/AddDeckDialog.kt |
| 76 | - com/vayunmathur/flashcards/ui/dialogs/DeleteDeckDialog.kt |
| 77 | - com/vayunmathur/flashcards/ui/dialogs/CustomStudyDialog.kt |
| 78 | - com/vayunmathur/flashcards/ui/dialogs/MoveDeckDialog.kt |
| 79 | - com/vayunmathur/flashcards/ui/dialogs/TagDialog.kt |
| 80 | - com/vayunmathur/flashcards/ui/dialogs/ResetSchedulingDialog.kt |
| 81 | - com/vayunmathur/flashcards/ui/dialogs/DeleteNoteTypeDialog.kt |
| 82 | - com/vayunmathur/flashcards/ui/dialogs/PresetNameDialog.kt |
| 83 | - com/vayunmathur/flashcards/ui/dialogs/ReminderTimeDialog.kt |
| 84 | |
| 85 | ## Verify (this module only) |
| 86 | ``` |
| 87 | ./gradlew :flashcards:compileDevKotlin |
| 88 | ./gradlew :flashcards:lint |
| 89 | ./gradlew :flashcards:checkMetadata |
| 90 | ``` |