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

Modern-Apps.git / todo / AGENTS.md

AGENTS.md3.6 KiBRenderedCodeRaw
1# AGENTS.md — todo/ (':todo')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `todo/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install todo (dev by default)._
6<!-- last-reviewed: 2026-11-01 -->
7- Gradle: :todo / dir: todo/
8- Package roots present: ui, data, domain, platform, sync, notifications, widget, service, intents
9- Entry files: MainActivity.kt, Route.kt, Navigation.kt, TodoApplication.kt
10- Deps: :library:room, :library:widgets
11- Metadata: metadata_data/todo.md (present)
12- Rust: no / screenshotTest: yes
13
14## Overview
15**Purpose:** Offline task manager: lists, smart views, subtasks, priorities, timed due dates, repeats, reminders, natural-language quick add, widgets, calendar mirror, import/export, and E2EE sync via EverySync.
16**Architecture / data-flow:** `ui/` (stateless `*Screen` + binding `*Page`) → `platform/TodoViewModel` / `platform/TodoEditor` → `data/TodoRepository` over Room (`Todo`, `TodoList`, `SyncSnapshot`). Pure logic lives in `domain/` (no Android): `TodoQuery` (views/sort/groups), `QuickAddParser`, `Recurrence`, `Completion`, `Positions`, `DueDates`, `format/` (todo.txt, CSV, VTODO). `platform/TodoBackground` (started by `TodoApplication`) reacts to any data change: reminder alarms, digest, per-list channels, widgets, calendar mirror.
17**Entry points + reading order:** `Route` → `Navigation.kt` → `ui/TodoShell` → `ui/TodoListPage` → `platform/TodoViewModel` → `domain/TodoQuery` → `data/TodoRepository` → `sync/RelayTodoProvider`.
18**Gotchas:**
19- Relay envelopes (`sync/RelayEnvelopes.kt`) mirror everysync's `RemoteTodo` / `RemoteTodoList` field-for-field. Never rename a key; new fields need defaults (encodeDefaults is off, so legacy hashes stay identical). Update both sides together.
20- Lists sync on their own `todolists:<vault>` channel so pre-list builds never see them as tasks.
21- All-day `dueAt` is **local** midnight. The Material date picker speaks UTC midnight — go through `DueDates.fromPickerMillis` / `toPickerMillis` (or `ui/TodoDatePickerDialog`).
22- Editor writes run on `TodoRepository.appScope` and flush on close; a new task is only inserted once it has a title (`platform/TodoEditor`).
23- Completing a repeating task rolls the same row forward (`domain/Completion`), it does not create a copy.
24- `exportSchema = true`: bump the DB version and commit `schemas/…/<n>.json` with every schema change; extend `TodoMigrationTest`.
25- `settings.gradle.kts` lists `:todo` twice — harmless Gradle quirk.
26
27## Key files
28### Root
29- MainActivity.kt (intent capture → `platform/IntentRouter`), Navigation.kt, Route.kt, TodoApplication.kt
30### data/
31- Todo.kt, TodoList.kt, TodoDatabase.kt (DAOs), TodoMigrations.kt, TodoRepository.kt, TodoSettings.kt (DataStore)
32### domain/
33- TodoQuery.kt, TodoView.kt, QuickAddParser.kt + QuickAddWords.kt, Recurrence.kt, Completion.kt, DueDates.kt, DueBuckets.kt, Positions.kt, Reminders.kt, format/
34### platform/
35- TodoViewModel.kt, TodoEditor.kt, TodoListUiContract.kt, TodoEditorUiContract.kt, TodoBackground.kt, IntentRouter.kt, TodoDataTransfer.kt, AppBackupAgent.kt
36### sync/
37- RelayTodoProvider.kt, RelayEnvelopes.kt, CalendarMirror.kt
38### notifications/ widget/ service/ intents/
39- ReminderScheduler, ReminderReceiver, ReminderActionReceiver, BootReceiver, DigestScheduler; TodayWidget, QuickAddWidget; QuickAddTileService; Get/Insert/CompleteTodoIntent (openassistant tools)
40
41## Verify (this module only)
42```
43./gradlew :todo:compileDevKotlin :todo:testDevUnitTest :todo:lint
44./gradlew checkMetadata
45./gradlew :todo:metadata # regenerate listing screenshots after UI changes
46```
47Relay changes: also `./gradlew :everysync:testDevUnitTest`.