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

Modern-Apps.git / everysync / AGENTS.md

AGENTS.md5.9 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<!-- last-reviewed: 2026-10-16 -->
7- Gradle: :everysync / dir: everysync/
8- Package roots present: ui, data, domain, platform, network, provider, auth, sync
9- Entry files: MainActivity.kt, Route.kt, Navigation.kt, EverySyncApplication.kt
10- Deps: :library:network, :library:e2ee-p2p (verified in build.gradle.kts)
11- Metadata: metadata_data/everysync.md (present but stale — omits vaults/E2EE relay)
12- Rust: no / screenshotTest: yes
13
14### Relay server (backend, outside this repo)
15Host: `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)".
16
17## Overview
18**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.
19**Key features:**
20- CardDAV/CalDAV account sync with OAuth2 PKCE via Custom Tabs (no shipped secrets)
21- E2EE vaults + `everysync://join/<vaultId>?owner=&type=` sharing links (sealed join requests, public ids only)
22- Five sink types: Calendar / Contacts / Note / Password / Todo (incl. IPC sinks into sibling apps)
23- WorkManager periodic sync + daily snapshots, rescheduled on boot/update via `BootReceiver`
24**Architecture / data-flow:** `auth/` (accounts/tokens) → `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.
25**Entry points + reading order:** `EverySyncApplication.kt` → `MainActivity.kt` (`parseJoinLink`/`handleJoinLink`) → `Route` (`Accounts` / `AddAccount` / `AccountDetail` / `Settings`) → `sync/SyncEngine.kt` → `provider/ProviderRegistry.kt`.
26**Gotchas:**
27- 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.
28- `singleTop` warm-start join links arrive via `onNewIntent`, not a fresh `onCreate`
29- Creds live in encrypted `TokenStore`/`VaultStore`; `Log.init` comes from the shared `MaInitProvider`, don't re-add it here
30
31## Key files
32### Root — app init, entry, navigation
33- com/vayunmathur/everysync/EverySyncApplication.kt — KEEP: sync scheduling + network init + key migration
34- com/vayunmathur/everysync/MainActivity.kt — join-link entry
35- com/vayunmathur/everysync/Navigation.kt
36- com/vayunmathur/everysync/Route.kt
37### auth/ — accounts, OAuth PKCE, token storage
38- com/vayunmathur/everysync/auth/AccountConfig.kt
39- com/vayunmathur/everysync/auth/AccountStore.kt
40- com/vayunmathur/everysync/auth/Authenticator.kt
41- com/vayunmathur/everysync/auth/TokenStore.kt — encrypted
42### provider/ — sync-provider registry + impls
43- com/vayunmathur/everysync/provider/ProviderRegistry.kt
44- com/vayunmathur/everysync/provider/SyncProvider.kt
45- com/vayunmathur/everysync/provider/SyncState.kt
46- com/vayunmathur/everysync/provider/DataType.kt
47- com/vayunmathur/everysync/provider/impl/E2eeProvider.kt
48### sync/ — engine, scheduling, relay merge, vault crypto
49- com/vayunmathur/everysync/sync/SyncEngine.kt
50- com/vayunmathur/everysync/sync/SyncScheduler.kt
51- com/vayunmathur/everysync/sync/SyncWorker.kt
52- com/vayunmathur/everysync/sync/SyncStatus.kt
53- com/vayunmathur/everysync/sync/RelayBlobStore.kt
54- com/vayunmathur/everysync/sync/RelayMerge.kt
55- com/vayunmathur/everysync/sync/VaultKeys.kt
56- com/vayunmathur/everysync/sync/VaultRoster.kt
57- com/vayunmathur/everysync/sync/OwnerTransfer.kt
58- com/vayunmathur/everysync/sync/adapters/CalendarKind.kt
59- com/vayunmathur/everysync/sync/adapters/ContactKind.kt
60- com/vayunmathur/everysync/sync/adapters/NoteKind.kt
61- com/vayunmathur/everysync/sync/adapters/PasswordKind.kt
62- com/vayunmathur/everysync/sync/adapters/TodoKind.kt
63### data/ + domain/ — sinks and iCal/VCard formats (pure domain, no Android)
64- com/vayunmathur/everysync/data/VaultStore.kt — encrypted, keystore migration
65- com/vayunmathur/everysync/data/Settings.kt
66- com/vayunmathur/everysync/data/RemoteModels.kt
67- com/vayunmathur/everysync/data/sink/CalendarSink.kt
68- com/vayunmathur/everysync/data/sink/ContactsSink.kt
69- com/vayunmathur/everysync/data/sink/NoteSink.kt
70- com/vayunmathur/everysync/data/sink/PasswordSink.kt
71- com/vayunmathur/everysync/data/sink/TodoSink.kt
72- com/vayunmathur/everysync/data/sink/TodoIpcSink.kt
73- com/vayunmathur/everysync/domain/format/ICalendar.kt
74- com/vayunmathur/everysync/domain/format/VCard.kt
75### network/ + platform/ + ui/ — relay transport, ViewModel, screens
76- com/vayunmathur/everysync/network/remote/RelaySync.kt
77- com/vayunmathur/everysync/network/remote/RelayCursorStore.kt
78- com/vayunmathur/everysync/platform/BootReceiver.kt — reschedule on boot/update
79- com/vayunmathur/everysync/platform/EverySyncViewModel.kt
80- com/vayunmathur/everysync/platform/EverySyncVaults.kt
81- com/vayunmathur/everysync/platform/EverySyncUiContract.kt
82- com/vayunmathur/everysync/ui/AccountsScreen.kt
83- com/vayunmathur/everysync/ui/AddAccountScreen.kt
84- com/vayunmathur/everysync/ui/AccountDetailScreen.kt
85- com/vayunmathur/everysync/ui/SettingsScreen.kt
86- com/vayunmathur/everysync/ui/VaultSharingSection.kt
87
88## Verify (this module only)
89```
90./gradlew :everysync:compileDevKotlin
91./gradlew :everysync:lint
92./gradlew :everysync:checkMetadata
93```