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

Modern-Apps.git / everysync / AGENTS.md

AGENTS.md6.2 KiBRenderedCodeRaw
1# AGENTS.md — everysync/ (':everysync')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `everysync/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install everysync (dev by default)._
6- Gradle: :everysync / dir: everysync/
7- Package roots present: ui, data, domain, platform, network, provider, sync
8- Entry files: MainActivity.kt, Route.kt, Navigation.kt, EverySyncApplication.kt
9- Deps: :library:network, :library:e2ee-p2p (verified in build.gradle.kts)
10- Metadata: metadata_data/everysync.md (present but stale — omits vaults/E2EE relay)
11- Rust: no / screenshotTest: yes
12
13### Relay server (backend, outside this repo)
14Host: `api.maproj.org` (Cloudflare FIRST_PARTY pins). Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Live SSH: `ssh [email protected]`. Env template: `../location_share_server/.env.example` (copy to `.env`, never commit secrets). Full details: root `AGENTS.md` → "Backend server (outside this repo)".
15
16## Overview
17**Purpose:** Universal sync hub — multi-provider account sync (contacts/calendars/health) plus E2EE vault relay syncing notes/passwords/todos between a user's own devices and shared vaults.
18**Key features:**
19- CardDAV/CalDAV account sync with OAuth2 PKCE via Custom Tabs (no shipped secrets)
20- E2EE vaults + `everysync://join/<vaultId>?owner=&type=` sharing links (sealed join requests, public ids only)
21- Five sink types: Calendar / Contacts / Note / Password / Todo (incl. IPC sinks into sibling apps)
22- WorkManager periodic sync + daily snapshots, rescheduled on boot/update via `BootReceiver`
23**Architecture / data-flow:** `data/` (accounts/tokens) + `platform/` (account authenticator) → `provider/` registry + `SyncProvider` impls (incl. `E2eeProvider`) → `sync/` engine/scheduler/worker + relay blob store/merge + vault keys/roster/owner-transfer → `data/sink/` writers + `domain/format/` iCal/VCard. `EverySyncApplication.onCreate`: `NetworkClient.init(FIRST_PARTY)` → schedule periodic + daily snapshot → one-time Keystore key migration. `MainActivity`: join-link parse → `requestToJoin` + snackbar confirm.
24**Entry points + reading order:** `EverySyncApplication.kt` → `MainActivity.kt` (`parseJoinLink`/`handleJoinLink`) → `Route` (`Accounts` / `AddAccount` / `AccountDetail` / `Settings` / `RestoreSnapshotDialog`) → `sync/SyncEngine.kt` → `provider/ProviderRegistry.kt`.
25**Gotchas:**
26- KEEP `EverySyncApplication` — it does real work (network init, scheduler, key migration), not boilerplate; do NOT delete it as a "shared-base" cleanup. Manifest `android:name` must stay.
27- `singleTop` warm-start join links arrive via `onNewIntent`, not a fresh `onCreate`
28- Creds live in encrypted `TokenStore`/`VaultStore`; `Log.init` comes from the shared `MaInitProvider`, don't re-add it here
29
30## Key files
31### Root — app init, entry, navigation
32- com/vayunmathur/everysync/EverySyncApplication.kt — KEEP: sync scheduling + network init + key migration
33- com/vayunmathur/everysync/MainActivity.kt — join-link entry
34- com/vayunmathur/everysync/Navigation.kt
35- com/vayunmathur/everysync/Route.kt
36### data/ — accounts, token storage (see also platform authenticator below)
37- com/vayunmathur/everysync/data/AccountConfig.kt
38- com/vayunmathur/everysync/data/AccountStore.kt
39- com/vayunmathur/everysync/data/TokenStore.kt — encrypted
40### provider/ — sync-provider registry + impls
41- com/vayunmathur/everysync/provider/ProviderRegistry.kt
42- com/vayunmathur/everysync/provider/SyncProvider.kt
43- com/vayunmathur/everysync/provider/SyncState.kt
44- com/vayunmathur/everysync/provider/DataType.kt
45- com/vayunmathur/everysync/provider/E2eeProvider.kt
46### sync/ — engine, scheduling, relay merge, vault crypto
47- com/vayunmathur/everysync/sync/SyncEngine.kt
48- com/vayunmathur/everysync/sync/SyncScheduler.kt
49- com/vayunmathur/everysync/sync/SyncWorker.kt
50- com/vayunmathur/everysync/sync/SyncStatus.kt
51- com/vayunmathur/everysync/sync/RelayBlobStore.kt
52- com/vayunmathur/everysync/sync/RelayMerge.kt
53- com/vayunmathur/everysync/sync/VaultKeys.kt
54- com/vayunmathur/everysync/sync/VaultRoster.kt
55- com/vayunmathur/everysync/sync/OwnerTransfer.kt
56- com/vayunmathur/everysync/sync/adapters/CalendarKind.kt
57- com/vayunmathur/everysync/sync/adapters/ContactKind.kt
58- com/vayunmathur/everysync/sync/adapters/NoteKind.kt
59- com/vayunmathur/everysync/sync/adapters/PasswordKind.kt
60- com/vayunmathur/everysync/sync/adapters/TodoKind.kt
61### data/ + domain/ — sinks and iCal/VCard formats (pure domain, no Android)
62- com/vayunmathur/everysync/data/VaultStore.kt — encrypted, keystore migration
63- com/vayunmathur/everysync/data/Settings.kt
64- com/vayunmathur/everysync/data/RemoteModels.kt
65- com/vayunmathur/everysync/data/sink/CalendarSink.kt
66- com/vayunmathur/everysync/data/sink/ContactsSink.kt
67- com/vayunmathur/everysync/data/sink/NoteSink.kt
68- com/vayunmathur/everysync/data/sink/PasswordSink.kt
69- com/vayunmathur/everysync/data/sink/TodoSink.kt
70- com/vayunmathur/everysync/data/sink/TodoIpcSink.kt
71- com/vayunmathur/everysync/domain/format/ICalendar.kt
72- com/vayunmathur/everysync/domain/format/VCard.kt
73### network/ + platform/ + ui/ — relay transport, ViewModel, screens
74- com/vayunmathur/everysync/network/remote/RelaySync.kt
75- com/vayunmathur/everysync/network/remote/RelayCursorStore.kt
76- com/vayunmathur/everysync/platform/BootReceiver.kt — reschedule on boot/update
77- com/vayunmathur/everysync/platform/Authenticator.kt — account authenticator + service
78- com/vayunmathur/everysync/platform/EverySyncViewModel.kt
79- com/vayunmathur/everysync/platform/EverySyncVaults.kt
80- com/vayunmathur/everysync/platform/EverySyncUiContract.kt
81- com/vayunmathur/everysync/ui/AccountsScreen.kt
82- com/vayunmathur/everysync/ui/AddAccountScreen.kt
83- com/vayunmathur/everysync/ui/AccountDetailScreen.kt
84- com/vayunmathur/everysync/ui/SettingsScreen.kt
85- com/vayunmathur/everysync/ui/VaultSharingSection.kt
86- com/vayunmathur/everysync/ui/SnapshotSection.kt — snapshot rows; Restore pushes `Route.RestoreSnapshotDialog`
87- com/vayunmathur/everysync/ui/dialogs/RestoreSnapshotDialog.kt — stateless restore confirmation rendered by the dialog route entry in `Navigation.kt`
88
89## Verify (this module only)
90```
91./gradlew :everysync:compileDevKotlin
92./gradlew :everysync:lint
93./gradlew :everysync:checkMetadata
94```