Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / desktop / passwords / AGENTS.md
| 1 | # AGENTS.md — desktop/passwords/ (':desktop:passwords') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `desktop/passwords/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | - Gradle: :desktop:passwords / dir: desktop/passwords/ |
| 6 | - Package roots present: com.vayunmathur.desktop.passwords (plain Kotlin, no Compose) |
| 7 | - Entry files: Main.kt, PasswordSync.kt, PasswordVault.kt, KdbxCompat.kt |
| 8 | - Deps: :library:everysync-core, kotlinx-serialization-json, okhttp, jna (all via catalog) |
| 9 | - Metadata: none (CLI shell, no app metadata) |
| 10 | - Rust: no (consumes e2ee_pqc host lib via core's JvmPqcCrypto) / screenshotTest: no |
| 11 | |
| 12 | ## Overview |
| 13 | **Purpose:** Desktop JVM shell on the shared EverySync core for the passwords vault (Phase 2a). Syncs `RemotePassword` records over `JvmRelayTransport` through the shared `SyncDriver` + `PasswordKind` merge. No Compose UI yet — UI lands after the core proves. |
| 14 | **Key features:** |
| 15 | - File-backed `PasswordVault` implementing core `SyncSink<RemotePassword>` with hard-delete semantics |
| 16 | - One-shot `PasswordSync.drive` via shared `SyncDriver` (null-pull aborts, never merges a failed pull) |
| 17 | - `KdbxCompat` KeePass-style CSV/JSON interchange using verbatim shared `EntryMapper` key names |
| 18 | - `Main.kt` CLI: init transport, sync once, print counts |
| 19 | **Architecture / data-flow:** `Main` (FileSecureStore + JvmRelayTransport.init) → `PasswordSync.syncOnce` (vault key load-or-create → pullRecords since 0 → fold → SyncDriver.drive → append) → `PasswordVault` (rows + `MemoryBaselineStore` snapshots on disk). |
| 20 | **Entry points + reading order:** `Main.kt` → `PasswordSync.kt` → `PasswordVault.kt` → `KdbxCompat.kt`. |
| 21 | **Gotchas:** |
| 22 | - Passwords HARD-delete: `listLocal` never returns deleted rows; `delete()` removes the row and keeps the baseline snapshot so the merge reads "baseline present + row absent" as a local delete. Only explicit `deleted=true` relay envelopes delete (see `PasswordKind`). |
| 23 | - Relay log is append-only: `syncOnce` folds the FULL log (last envelope per uid wins) before driving; a null pull aborts the cycle. |
| 24 | - `KdbxCompat` carries field maps only — no new crypto, no KDBX encryption. File protection stays out of scope. |
| 25 | - JVM-only module: no `Toast`, no `Icon`/`Scaffold`, no Compose, no Room strings. |
| 26 | |
| 27 | ## Key files |
| 28 | - com/vayunmathur/desktop/passwords/PasswordVault.kt — file JSON store + SyncSink with hard-delete rule |
| 29 | - com/vayunmathur/desktop/passwords/PasswordSync.kt — FileSecureStore, RelayStore adapter, syncOnce drive |
| 30 | - com/vayunmathur/desktop/passwords/KdbxCompat.kt — KeePassXC-compat field-map import/export |
| 31 | - com/vayunmathur/desktop/passwords/Main.kt — CLI entry (sync once, print counts) |
| 32 | |
| 33 | ## Verify (this module only) |
| 34 | ``` |
| 35 | ./gradlew :desktop:passwords:compileKotlin |
| 36 | ``` |
| 37 | (Orchestrator verifies; do not run Gradle from this task.) |