Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: kindle-drop-ui
description: kindle-drop's product design and UI writing guide, covering the agreed screens and flows, the voice, the vocabulary, and the copy for buttons, statuses, errors, and empty states. Use before designing or changing any screen, flow, or user-facing string in apps/mobile, and when reviewing UI work.
name: dropcap-ui
description: dropcap's product design and UI writing guide, covering the agreed screens and flows, the voice, the vocabulary, and the copy for buttons, statuses, errors, and empty states. Use before designing or changing any screen, flow, or user-facing string in apps/mobile, and when reviewing UI work.
---

# kindle-drop UI
# dropcap UI

Dropcap sends books from the user's phone to their Kindle. The interface should feel like a well-made system app: calm, quiet, and professional. Every word earns its place.

Expand All @@ -13,7 +13,7 @@ The design below was researched and agreed with the user on 2026-10-28. Build wh

- The app is **Dropcap**: one word, capital D only. "Kindle" names the device and nothing else, because the app must not borrow Amazon's mark. The package id and `kindledrop://` scheme keep the old name, since the installed app depends on them.
- The icon is a first-quarter moon over water, and the moon is the D. Its reflection breaks into lines of text. Production shows the full night-sky art. Dev, preview, and the themed icon use the flat mark (`assets/icon-mark.svg`).
- The layers live in `assets/icon-*.svg` on a shared 108 dp canvas. After editing one, run `pnpm vp run --filter @kindle-drop/mobile icons`. The icon is part of the native fingerprint, so a change needs a native build.
- The layers live in `assets/icon-*.svg` on a shared 108 dp canvas. After editing one, run `pnpm vp run --filter @dropcap/mobile icons`. The icon is part of the native fingerprint, so a change needs a native build.

## Writing rules

Expand Down Expand Up @@ -136,7 +136,7 @@ Write new copy in this voice and add it to the catalog.

## Verifying UI work

Drive the change on the emulator or a device with the `test-kindle-drop-android` skill. Save screenshots of every state you touched, in light and dark. Read the copy out loud against the rules above before you report.
Drive the change on the emulator or a device with the `test-dropcap-android` skill. Save screenshots of every state you touched, in light and dark. Read the copy out loud against the rules above before you report.

## Sources

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
name: test-kindle-drop-android
description: Install and drive kindle-drop's Android dev client on an emulator or device, then capture screenshots as evidence. Use for verifying a user-visible change on a real Android surface.
name: test-dropcap-android
description: Install and drive dropcap's Android dev client on an emulator or device, then capture screenshots as evidence. Use for verifying a user-visible change on a real Android surface.
---

# Test kindle-drop on Android
# Test dropcap on Android

Ask before driving a device unless the task already authorizes it. Only touch the `com.listlessbird.kindledrop.dev` package.

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
run: pnpm vp run test

- name: Generated theme is current
run: pnpm --filter @kindle-drop/mobile generate --check
run: pnpm --filter @dropcap/mobile generate --check
12 changes: 6 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# kindle-drop
# dropcap

kindle-drop is an Android app built with Expo and React Native. It is the user's personal reading app, and it starts as a foundation: app variants, Effect state and persistence, theming, a UI kit, and navigation. Product features arrive later.
dropcap is an Android app built with Expo and React Native. It is the user's personal reading app, and it starts as a foundation: app variants, Effect state and persistence, theming, a UI kit, and navigation. Product features arrive later.

The architecture is adapted from [T3 Code](https://github.com/pingdotgg/t3code)'s mobile app. When you need a pattern this repo does not have yet, look at how T3 Code's `apps/mobile` solves it before inventing one, then port only what the feature needs.

Expand All @@ -21,7 +21,7 @@ These instructions are good defaults, not hard rules. My direct requests overrid
- `pnpm install` installs. Worktrees get this from the `t3.json` setup script. While `.t3/setup-running` names a live PID, wait for it. It ends with `.t3/setup-done` or `.t3/setup-failed`.
- `vp` is Vite+, the task runner, test runner, formatter, and linter. It is a dev dependency, so run it as `pnpm vp <command>` unless a global `vp` is on your PATH. Package scripts run with `pnpm vp run <script>`.
- `pnpm vp run mobile:install android` installs the dev client that matches this checkout's native fingerprint on the only connected device or emulator. It reuses a cached APK and builds only when native inputs changed. Prefer it over `expo run:android` or `gradlew`, which rebuild from scratch.
- `pnpm vp run --filter @kindle-drop/mobile dev:client` starts Metro for the dev client.
- `pnpm vp run --filter @dropcap/mobile dev:client` starts Metro for the dev client.
- OTA updates use `expo-updates` with a fingerprint runtime version, so an update only reaches binaries whose native inputs match.
- `android/` is generated by `expo prebuild` and is gitignored. Native configuration lives in `apps/mobile/app.config.ts` and config plugins, never in `android/`.
- Native builds compile the Rust in `apps/mobile/modules/kindle-core` through Gradle. They need `cargo`, `cargo-ndk`, and the `aarch64-linux-android` and `x86_64-linux-android` rustup targets. JS-only work and CI do not: the ubrn bindings are committed. After changing the Rust API, regenerate them with the commands in its `ubrn.config.yaml`.
Expand All @@ -36,14 +36,14 @@ These instructions are good defaults, not hard rules. My direct requests overrid
- Logic, data, and state bugs get a failing test first, then the fix. Purely visual bugs get before and after screenshots as proof and no test.
- `it.effect` runs on a `TestClock`. Advance time with `TestClock.adjust`. No sleeps, polling loops, per-test timeouts, retries, or `Date.now()` deltas. Await the `Deferred` or the event that marks the milestone. Lint enforces this.
- `it.skip` needs a tracking issue on the line above: `// quarantine: #12 <why>`.
- Upon request, user-visible changes get one pass on a real device with the `test-kindle-drop-android` skill. Ask before driving a device.
- Upon request, user-visible changes get one pass on a real device with the `test-dropcap-android` skill. Ask before driving a device.

## Where code lives

- `apps/mobile`: the Expo app. `src/Stack.tsx` declares every screen and its deep link path. `src/components/ui` is the UI kit, `src/features/<feature>` holds screens and feature logic, `src/state` holds atoms, `src/persistence` holds storage services, and `src/lib` holds small shared modules.
- The UI kit is Android-only: Compose controls through `@expo/ui` and Tabler icons through `AppSymbol`. Its dev-only catalog (`kindledrop-dev://dev/components`) renders every component with the theme controls on top. Add a new kit component to it.
- `apps/mobile/modules/kindle-core`: the EPUB to Kindle converter, a Rust crate (`rust/`) exposed as the `KindleCore` turbo module by uniffi-bindgen-react-native. The app reaches it through the `KindleCore` service in `src/lib/kindleCore.ts`.
- `apps/worker`: the Cloudflare Worker + R2 mailbox between the app and the user's Kindle, an Effect `HttpApi` deployed with Alchemy. `src/Api.ts` is the contract: the app derives its client from it, and the Kindle's `kindle/dropcap/dropcap.sh` speaks it with curl, so keep status codes and the text listing stable. `pnpm vp run --filter @kindle-drop/worker dev` serves it locally, and its tests boot the same stack in workerd.
- `apps/worker`: the Cloudflare Worker + R2 mailbox between the app and the user's Kindle, an Effect `HttpApi` deployed with Alchemy. `src/Api.ts` is the contract: the app derives its client from it, and the Kindle's `kindle/dropcap/dropcap.sh` speaks it with curl, so keep status codes and the text listing stable. `pnpm vp run --filter @dropcap/worker dev` serves it locally, and its tests boot the same stack in workerd.
- `kindle`: `dropcap/` is the KUAL extension the Kindle runs, one `dropcap.sh` entry point over `lib/` modules for delivery, optional Tailscale SSH, Wi-Fi tools and the boot job. `kindle/kd` reads the Kindle's status and logs from the Worker, opens SSH, and deploys. Use the `kindle-device` skill for any work on the device, and read `docs/internals/kindle.md` first.
- `oxlint-plugin-kd`: this repo's lint rules, ported from T3 Code.
- `oxlint-plugin-anti-slop`: vendored [anti-slop](https://github.com/dmmulroy/anti-slop) rules. Update it with the `install-anti-slop` skill; never overwrite it. Provenance is in its `UPSTREAM.md`.
Expand All @@ -58,7 +58,7 @@ These instructions are good defaults, not hard rules. My direct requests overrid
- The React Compiler owns memoization. Do not write `useMemo`, `useCallback`, or `React.memo`.
- React effects are for synchronizing with something outside React. Derive in render and act in handlers. `kd/react-effect-budget` holds each file to its count in `scripts/effect-budget.json`. A new effect states its reason with `// oxlint-disable-next-line kd/react-effect-budget -- <why>`.
- `components/ui` exports own their look. Pick a `variant` or `size` rather than restyling one with `className`. Colors come from theme tokens, never literals.
- The palette lives in `apps/mobile/src/lib/theme.ts` as semantic roles (`--color-card`, `--color-foreground-muted`). After editing it, run `pnpm vp run --filter @kindle-drop/mobile generate` to rewrite the Uniwind theme CSS. Material You fills the same roles from the wallpaper in `src/lib/materialYou.ts`.
- The palette lives in `apps/mobile/src/lib/theme.ts` as semantic roles (`--color-card`, `--color-foreground-muted`). After editing it, run `pnpm vp run --filter @dropcap/mobile generate` to rewrite the Uniwind theme CSS. Material You fills the same roles from the wallpaper in `src/lib/materialYou.ts`.
- Default to no comment. Write one only for a constraint, an external quirk, or an invariant the code cannot show, in four lines at most. `kd/no-low-value-comments` enforces the cap.
- No continuously repainting animations. They peg the GPU on high-refresh displays.

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="apps/mobile/assets/icon-production.png" width="64" height="64" alt="">

# kindle-drop
# dropcap

**Dropcap** sends books (`EPUB`, `AZW3`, `PDF`, `TXT`) and web articles from Android to a jailbroken stock-reader Kindle over Wi-Fi, with lock-screen covers and no Send to Kindle or USB.

Expand All @@ -23,7 +23,7 @@ Deploy the Worker and R2 bucket (`kindle-mailbox`):

```bash
pnpm install
pnpm vp run --filter @kindle-drop/worker deploy
pnpm vp run --filter @dropcap/worker deploy
```

### 2. Set up the Kindle
Expand All @@ -49,12 +49,12 @@ For SSH and Taildrop, put the static `arm` Tailscale binaries (`tailscale`, `tai

### 3. Install and pair the Android app

Download the latest `dropcap-*.apk` from [Releases](https://github.com/listlessbird/kindle-drop/releases) (or build with `pnpm vp run --filter @kindle-drop/mobile eas:android:prod`).
Download the latest `dropcap-*.apk` from [Releases](https://github.com/listlessbird/dropcap/releases) (or build with `pnpm vp run --filter @dropcap/mobile eas:android:prod`).

Print a pairing QR code on your computer and scan it in Dropcap:

```bash
pnpm vp run --filter @kindle-drop/worker pair --server https://<your-worker>.workers.dev
pnpm vp run --filter @dropcap/worker pair --server https://<your-worker>.workers.dev
```

## Development
Expand All @@ -63,14 +63,14 @@ JS-only changes and CI need Node `>= 24.15` and `pnpm` 10 (UniFFI bindings are c

```bash
# Local Worker
APP_TOKEN=dev-app KINDLE_TOKEN=dev-kindle pnpm vp run --filter @kindle-drop/worker dev
APP_TOKEN=dev-app KINDLE_TOKEN=dev-kindle pnpm vp run --filter @dropcap/worker dev

# Android dev client (fingerprint-cached APK) + Metro
pnpm vp run mobile:install android
pnpm vp run --filter @kindle-drop/mobile dev:client
pnpm vp run --filter @dropcap/mobile dev:client

# Pair dev client on an emulator
pnpm vp run --filter @kindle-drop/worker pair --server http://10.0.2.2:1337 --key dev-app --scheme kindledrop-dev
pnpm vp run --filter @dropcap/worker pair --server http://10.0.2.2:1337 --key dev-app --scheme kindledrop-dev

# Format, lint, typecheck, and affected tests
pnpm vp run check:changed
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@kindle-drop/mobile",
"name": "@dropcap/mobile",
"version": "0.0.0",
"private": true,
"main": "index.ts",
Expand All @@ -19,12 +19,12 @@
"eas-build-pre-install": "bash scripts/eas-install-rust.sh"
},
"dependencies": {
"@dropcap/worker": "workspace:*",
"@effect/atom-react": "catalog:",
"@expo-google-fonts/dm-sans": "^0.4.2",
"@expo/metro-runtime": "~58.0.14",
"@expo/ui": "58.0.20",
"@kindle-drop/kindle-core": "workspace:*",
"@kindle-drop/worker": "workspace:*",
"@react-navigation/elements": "2.9.45",
"@react-navigation/native": "7.5.1",
"@react-navigation/native-stack": "7.21.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/scripts/generate-uniwind-themes.mts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ for (const [file, contents] of outputs) {
if (current === contents) continue;

if (check) {
console.error(`${file} is stale. Run vp run --filter @kindle-drop/mobile generate.`);
console.error(`${file} is stale. Run vp run --filter @dropcap/mobile generate.`);
process.exitCode = 1;
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/features/kindle/KindleScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
type CommandId,
type Device,
type QueuedCommand,
} from "@kindle-drop/worker/Api";
} from "@dropcap/worker/Api";
import { useFocusEffect } from "@react-navigation/native";
import type * as DateTime from "effect/DateTime";
import * as Option from "effect/Option";
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/features/kindle/kindleCopy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Command,
type Outcome,
type QueuedCommand,
} from "@kindle-drop/worker/Api";
} from "@dropcap/worker/Api";
import * as DateTime from "effect/DateTime";
import * as Option from "effect/Option";

Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/features/kindle/kindleCopy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
type BookPath,
type Device,
type QueuedCommand,
} from "@kindle-drop/worker/Api";
} from "@dropcap/worker/Api";
import type * as Cause from "effect/Cause";
import type * as DateTime from "effect/DateTime";
import * as Match from "effect/Match";
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/features/sending/book.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert, describe, it } from "@effect/vitest";
import { ItemKey, ItemName, itemKey } from "@kindle-drop/worker/Api";
import { ItemKey, ItemName, itemKey } from "@dropcap/worker/Api";
import * as DateTime from "effect/DateTime";
import * as Duration from "effect/Duration";
import * as Option from "effect/Option";
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/features/sending/book.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
nameOfKey,
uploadedAtOfKey,
type MailboxStatus,
} from "@kindle-drop/worker/Api";
} from "@dropcap/worker/Api";
import * as Arr from "effect/Array";
import * as Data from "effect/Data";
import * as DateTime from "effect/DateTime";
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/features/sending/sender.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert, describe, it } from "@effect/vitest";
import { ItemName, itemKey, nameOfKey, type ItemKey } from "@kindle-drop/worker/Api";
import { ItemName, itemKey, nameOfKey, type ItemKey } from "@dropcap/worker/Api";
import * as Clock from "effect/Clock";
import * as DateTime from "effect/DateTime";
import * as Deferred from "effect/Deferred";
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/features/sending/sender.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ItemName, type ItemKey, type MailboxStatus } from "@kindle-drop/worker/Api";
import { ItemName, type ItemKey, type MailboxStatus } from "@dropcap/worker/Api";
import * as Arr from "effect/Array";
import * as Cause from "effect/Cause";
import * as Clock from "effect/Clock";
Expand Down Expand Up @@ -108,7 +108,7 @@ export class Sender extends Context.Service<
*/
readonly refresh: Effect.Effect<MailboxStatus, MailboxError | Cause.NoSuchElementError>;
}
>()("@kindle-drop/mobile/features/sending/Sender") {}
>()("@dropcap/mobile/features/sending/Sender") {}

export const make = Effect.gen(function* () {
const store = yield* BookStore;
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/lib/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const PAIRING_LINK = /^[a-z][a-z\d+.-]*:\/\/connect\/?\?/i;
export const isPairingLink = (link: string) => PAIRING_LINK.test(link);

/**
* `<scheme>://connect?server=<address>&key=<key>`, as `pnpm vp run --filter @kindle-drop/worker pair`
* `<scheme>://connect?server=<address>&key=<key>`, as `pnpm vp run --filter @dropcap/worker pair`
* prints it. Any scheme decodes, so one code pairs the production, preview and dev apps.
*/
export const PairingLink = Schema.String.check(Schema.isPattern(PAIRING_LINK)).pipe(
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/lib/kindleCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class KindleCore extends Context.Service<
outDir: string,
) => Effect.Effect<Thumbnail, ConvertError>;
}
>()("@kindle-drop/mobile/lib/KindleCore") {}
>()("@dropcap/mobile/lib/KindleCore") {}

export const make = Effect.gen(function* () {
// Imported lazily: loading the module installs the Rust crate, which Node tests cannot do.
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/src/lib/mailboxClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
type ItemKey,
type ItemName,
type MailboxStatus,
} from "@kindle-drop/worker/Api";
} from "@dropcap/worker/Api";
import * as Context from "effect/Context";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
Expand Down Expand Up @@ -68,7 +68,7 @@ export class MailboxClient extends Context.Service<
onProgress: (fraction: number) => void,
) => Effect.Effect<ItemKey, MailboxError>;
}
>()("@kindle-drop/mobile/lib/MailboxClient") {}
>()("@dropcap/mobile/lib/MailboxClient") {}

export const make = Effect.gen(function* () {
const httpClient = yield* HttpClient.HttpClient;
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/persistence/book-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class BookFiles extends Context.Service<
/** Directory names, which are book ids, including any whose record is gone. */
readonly stored: Effect.Effect<ReadonlyArray<string>>;
}
>()("@kindle-drop/mobile/persistence/BookFiles") {}
>()("@dropcap/mobile/persistence/BookFiles") {}

export const make = Effect.gen(function* () {
// Imported lazily so Node tests can load this module without the native binding.
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/persistence/book-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class BookStore extends Context.Service<
readonly save: (book: Book) => Effect.Effect<void, BookStoreError>;
readonly remove: (id: BookId) => Effect.Effect<void, BookStoreError>;
}
>()("@kindle-drop/mobile/persistence/BookStore") {}
>()("@dropcap/mobile/persistence/BookStore") {}

export const make = Effect.gen(function* () {
const database = yield* MobileDatabase.MobileDatabase;
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/persistence/connection-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class ConnectionStore extends Context.Service<
readonly save: (connection: Connection) => Effect.Effect<void, ConnectionStoreError>;
readonly clear: Effect.Effect<void, ConnectionStoreError>;
}
>()("@kindle-drop/mobile/persistence/ConnectionStore") {}
>()("@dropcap/mobile/persistence/ConnectionStore") {}

export const make = Effect.gen(function* () {
// Imported lazily so Node tests can load this module without the native binding.
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/persistence/mobile-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class MobileDatabase extends Context.Service<
) => Effect.Effect<void, MobileDatabaseError>;
readonly deleteBook: (id: string) => Effect.Effect<void, MobileDatabaseError>;
}
>()("@kindle-drop/mobile/persistence/MobileDatabase") {}
>()("@dropcap/mobile/persistence/MobileDatabase") {}

export const make = Effect.gen(function* () {
const database = yield* Effect.acquireRelease(
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/persistence/mobile-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class MobilePreferencesStore extends Context.Service<
/** Merges `patch` into the stored preferences and returns the saved result. */
readonly savePatch: (patch: Preferences) => Effect.Effect<Preferences, MobilePreferencesError>;
}
>()("@kindle-drop/mobile/persistence/MobilePreferencesStore") {}
>()("@dropcap/mobile/persistence/MobilePreferencesStore") {}

export const make = Effect.gen(function* () {
const database = yield* MobileDatabase.MobileDatabase;
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/state/kindle.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert, describe, it } from "@effect/vitest";
import { Command, commandId, type QueuedCommand } from "@kindle-drop/worker/Api";
import { Command, commandId, type QueuedCommand } from "@dropcap/worker/Api";
import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
Expand Down
Loading
Loading