Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
translate ▾

Modern-Apps.git / flashcards / AGENTS.md

AGENTS.md5.3 KiBRenderedCodeRaw

AGENTS.md — flashcards/ (':flashcards')

Scoped supplement. Global rules in root AGENTS.md apply. Stay inside flashcards/ + allowed shared modules. Do not root-scan.

Install: ./install flashcards (dev by default).

  • Gradle: :flashcards / dir: flashcards/
  • Package roots present: ui, data
  • Entry files: MainActivity.kt, Route.kt
  • Deps: :library:room, :library:image
  • Metadata: metadata_data/flashcards.md (present)
  • Rust: no / screenshotTest: yes

Overview

Purpose: Offline spaced-repetition flashcards — Anki-style notes/templates/decks with FSRS scheduling, review reminders, deck file sharing, APKG import/export. 100% offline. 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. Entry points: MainActivity.kt → ui/DeckListPage.kt → util/FlashcardsViewModel.kt → data/FlashcardsRepository.kt → util/Scheduler.kt → ui/ReviewPage.kt. Gotchas:

  • util/ is NOT a closed package root — don't add more files there
  • Scheduling correctness (FSRS) is the product — scheduler changes need review-log-driven tests, not just UI checks
  • APKG import/export must stay compatible with Anki's format — test round-trips, not just one direction
  • 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)

Key files

Root — entry

  • com/vayunmathur/flashcards/MainActivity.kt
  • 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)

data/ — notes, decks, review log (Room)

  • com/vayunmathur/flashcards/data/FlashcardsDatabase.kt
  • com/vayunmathur/flashcards/data/FlashcardsRepository.kt
  • com/vayunmathur/flashcards/data/Note.kt
  • com/vayunmathur/flashcards/data/NoteType.kt
  • com/vayunmathur/flashcards/data/NoteTypeField.kt
  • com/vayunmathur/flashcards/data/Card.kt
  • com/vayunmathur/flashcards/data/CardTemplate.kt
  • com/vayunmathur/flashcards/data/Deck.kt
  • com/vayunmathur/flashcards/data/ReviewLog.kt

util/ — ViewModel, scheduler, import/export

  • com/vayunmathur/flashcards/util/FlashcardsViewModel.kt
  • com/vayunmathur/flashcards/util/FlashcardsViewModelHelper.kt
  • com/vayunmathur/flashcards/util/FlashcardsUiContract.kt
  • com/vayunmathur/flashcards/util/Scheduler.kt
  • com/vayunmathur/flashcards/util/FsrsOptimizer.kt
  • com/vayunmathur/flashcards/util/ReviewSession.kt
  • com/vayunmathur/flashcards/util/CardGenerator.kt
  • com/vayunmathur/flashcards/util/TemplateEngine.kt
  • com/vayunmathur/flashcards/util/HtmlConvert.kt
  • com/vayunmathur/flashcards/util/ApkgImport.kt
  • com/vayunmathur/flashcards/util/ApkgExport.kt
  • com/vayunmathur/flashcards/util/DeckIo.kt
  • com/vayunmathur/flashcards/util/MediaStore.kt
  • com/vayunmathur/flashcards/util/TtsSpeaker.kt
  • com/vayunmathur/flashcards/util/ReviewReminderWorker.kt
  • 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)

ui/ — decks, notes, review, stats

  • com/vayunmathur/flashcards/ui/DeckListPage.kt
  • com/vayunmathur/flashcards/ui/Navigation.kt — tab stack plus DialogPage() entries
  • com/vayunmathur/flashcards/ui/FlashcardsDialogEntries.kt — dialog route entries (perform the action, pop)
  • com/vayunmathur/flashcards/ui/ReviewPage.kt
  • com/vayunmathur/flashcards/ui/ReviewGradeButtons.kt
  • com/vayunmathur/flashcards/ui/StudyModeRow.kt
  • com/vayunmathur/flashcards/ui/NoteListPage.kt
  • com/vayunmathur/flashcards/ui/NoteListScreen.kt
  • com/vayunmathur/flashcards/ui/NoteRowItem.kt
  • com/vayunmathur/flashcards/ui/NoteEditPage.kt
  • com/vayunmathur/flashcards/ui/NoteListFileHelpers.kt
  • com/vayunmathur/flashcards/ui/ReorderableNoteList.kt
  • com/vayunmathur/flashcards/ui/NoteTypeEditorPage.kt
  • com/vayunmathur/flashcards/ui/NoteTypeEditorSection.kt
  • com/vayunmathur/flashcards/ui/TagFilterRow.kt
  • com/vayunmathur/flashcards/ui/StatsPage.kt
  • com/vayunmathur/flashcards/ui/FlashcardsCharts.kt
  • com/vayunmathur/flashcards/ui/MarkdownContent.kt
  • com/vayunmathur/flashcards/ui/SettingsPage.kt

ui/dialogs/ — stateless dialog contents for the dialog routes

  • com/vayunmathur/flashcards/ui/dialogs/AddDeckDialog.kt
  • com/vayunmathur/flashcards/ui/dialogs/DeleteDeckDialog.kt
  • com/vayunmathur/flashcards/ui/dialogs/CustomStudyDialog.kt
  • com/vayunmathur/flashcards/ui/dialogs/MoveDeckDialog.kt
  • com/vayunmathur/flashcards/ui/dialogs/TagDialog.kt
  • com/vayunmathur/flashcards/ui/dialogs/ResetSchedulingDialog.kt
  • com/vayunmathur/flashcards/ui/dialogs/DeleteNoteTypeDialog.kt
  • com/vayunmathur/flashcards/ui/dialogs/PresetNameDialog.kt
  • com/vayunmathur/flashcards/ui/dialogs/ReminderTimeDialog.kt

Verify (this module only)

./gradlew :flashcards:compileDevKotlin
./gradlew :flashcards:lint
./gradlew :flashcards:checkMetadata