_CONVENTIONS.md

4.4 KB · raw

rendered · source

1# Drafting Conventions — READ FIRST (peach-android remaining-gaps fan-out)23You are a **drafting subagent**. Hard rules:45- Write files **only** under `app/drafts/<ITEM>/` (create that folder). Everything6  outside `app/drafts/` is **READ-ONLY** — do not edit, create, move, or delete it.7- **Never** run `koh`, `git`, or `gradle` (no build / assembleDebug / lintDebug /8  tests). **Never** run `rm` (use `trash` if ever needed — but you delete nothing).9  The orchestrator owns all builds, wiring, koh saves.10- Produce **compilable, drop-in Kotlin** matching existing conventions, plus an11  `INTEGRATION.md` telling the orchestrator exactly how to wire it: destination12  paths, nav routes to add, new ViewModel/Repository/model APIs needed (full13  signatures + reference snippet), and insertion points quoted with a few lines of14  surrounding source as anchors.15- The brief's pseudocode uses names that **do not all exist**. Adapt to reality below.16- Return a **terse** summary only (files written, new APIs the orchestrator must add,17  risks/assumptions). Do **not** paste full code into your reply — it's on disk.1819## Verified codebase facts2021- Package root `com.peachpasswords`; screens in `com.peachpasswords.ui.<area>`.22- **Entry model** `vault/VaultEntry.kt`: `type` is `String?` = "login"|"note"|"card"23  (null == login). Helpers: `isLogin() isNote() isCard() isBreach() hasTOTP()24  hasPasskey() domainKey()`. **There is no `EntryType` enum** — use the string + helpers.25  Card fields already present: `cardholderName cardNumber expMonth expYear cvc26  cardNickname cardNetwork`. Also present: `additionalUrls: List<String>?`,27  `tags: List<String>?`, `passwordHistory: List<PasswordHistoryItem>?`, `notes`.28- **Colors** `ui/theme/PeachColors.kt` (object): `T0 T1 T2 T3 T4` (= spec t0..t3/t4),29  `Breach BreachBg BreachBorder` (= spec "breach color"), `HealthOk` (= spec "health"),30  `S1 S2 S3` (= spec s1/s2/s3), `SurfaceElevated = 0xE0131109` (the glass-panel bg the31  spec calls `Color(0xE0131109)`), `Bg`. **Runtime accent**: `val accent =32  LocalPeachAccent.current` (`import com.peachpasswords.ui.theme.LocalPeachAccent`).33  Never hardcode hex.34- **Type** `ui/theme/PeachType.kt` (object): families `Display` (= Cormorant),35  `Mono` (= IBM Plex Mono), `Body` (= Inter), `Script` (= PeachScript watermark).36  Named styles incl. `bodyMono labelMono tinyMono body hint onboardingHeadline37  lockHeadline createHeadline entryNameHero entryNameList sortPill recoveryWord38  totpCode totpCountdown`. Build a local `TextStyle(fontFamily = PeachType.Display,39  fontStyle = FontStyle.Italic, fontSize = 44.sp)` etc. when no named style fits.40  **Never** use `MaterialTheme.typography`.41- **No `PeachField` composable exists.** For text inputs use `BasicTextField` with the42  underline style in `ui/vault/EntryEditScreen.kt` (private `Field` / `PasswordField`43  composables — read and mirror them). **No `OutlinedTextField`.**44- **Background**: screens use the `ShellBackground` composable (see `ImportScreen.kt`,45  `TrashScreen.kt`, `ExportScreen.kt` for the wrapper pattern). Check whether a46  `RuneBackground` exists (`grep -rn RuneBackground app/src/main`); if absent, note it47  in INTEGRATION.md as a TODO and omit it rather than inventing one.48- **Nav**: routes in `ui/PeachNav.kt` (sealed class `PeachNav(val route: String)` —49  add a `data object`/`data class`). Wired in `ui/PeachAppNavHost.kt` via50  `composable(PeachNav.X.route){ ... }`, using `val nav: (PeachNav)->Unit` and51  `val back: ()->Unit`. **Do not edit these files** — specify the exact additions in52  INTEGRATION.md.53- **DI/VM**: `@HiltViewModel` + `hiltViewModel()`; inject `VaultRepository`54  (`vault/VaultRepository.kt`) and `@ApplicationContext Context` when needed (see55  `ImportViewModel`/`ExportViewModel`). New repo/VM methods → describe in56  INTEGRATION.md with signature + reference impl; don't edit the real repo.57- Match sibling screens for SAF, clipboard, FLAG_SECURE, haptics58  (`haptics/PeachHaptics.kt`) patterns. Read before drafting.5960## Shared-file discipline6162Several items target the **same** existing files (EntryEditScreen, EntryDetailScreen,63VaultListScreen, SettingsScreen/SettingsCardBodies). You only draft — never edit them —64but to make merging clean: draft **self-contained composables/helpers** in your65`app/drafts/<ITEM>/` folder and, in INTEGRATION.md, give the **precise insertion anchor**66(quote ~3 lines of the real file where your block goes) plus any new imports. Do not67reproduce the whole target file.