book-story/AGENTS.md

92 lines
4.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Book's Story — Bookshelf Fork
> Форк `Acclorite/book-story` под Bookshelf: audiobookshelf + bookshelf-api + TTS + offline.
## Stack
- **Язык:** Kotlin 100%
- **UI:** Jetpack Compose + Material3
- **DI:** Dagger Hilt
- **БД:** Room
- **Настройки:** DataStore
- **Сеть:** Retrofit + OkHttp + Kotlinx Serialization
- **Аудио:** ExoPlayer (Media3) + MediaSession
- **Фоновые задачи:** WorkManager
- **Читалка:** собственная Book's Story (jsoup, pdfbox, commonmark)
- **minSdk:** 26 (план — поднять до 31 позже)
- **compileSdk/targetSdk:** 36
## Goal
- Сохранить Material You reader Book's Story.
- Добавить поддержку bookshelf-api: библиотеки, поиск, TTS, подкасты, Яндекс/YouTube.
- Добавить аудиоплеер для аудиокниг из Audiobookshelf.
- Добавить offline-кэш и синхронизацию прогресса.
## Layout
- `app/src/main/java/org/dueattendant149/bookshelf/` — основной код
- `core/` — crash handler, typealias, commonmark parser
- `data/` — repository, Room, DataStore, mappers, parsers, DI
- `domain/` — models, use cases, repository interfaces
- `presentation/` — ViewModels, MVI screens, navigator
- `ui/` — Compose UI
- `bookshelf-api` backend находится в `~/bookshelf/bookshelf-api/` (отдельный проект)
- Lissen (который дорабатывается параллельно) — `~/bookshelf/lissen/`
## API endpoints
- **bookshelf-api:** `http://bookshelf-api:8073` (или `https://tts.dueattendant149.org` после DNS)
- `GET /api/v1/books/libraries`
- `GET /api/v1/books/{item_id}`
- `GET /api/v1/books/library/{id}/search?q=...`
- `POST /api/v1/search`
- `POST /api/v1/tts`, `GET /api/v1/tts/{job_id}`, `GET /api/v1/tts/{job_id}/download`
- `GET /api/v1/tts/engines`, `GET /api/v1/tts/voices`
- `POST /api/v1/download`, `GET /api/v1/download/list`
- `POST /api/v1/podcasts`, `POST /api/v1/sources/yandex`
- **Audiobookshelf (напрямую):** для аудио файлов и обложек
- `GET /api/items/{id}/file/{ino}`
- `GET /api/items/{id}/download`
- `GET /api/items/{id}/cover`
## Git
- **origin:** `https://git.dueattendant149.org/Atte149/book-story.git` (Forgejo)
- **upstream:** `https://github.com/Acclorite/book-story.git`
- **Лицензия:** GPL-3.0-only (как у оригинала)
## Build
```bash
./gradlew :app:assembleDebug
```
## Current Status
- Phase 1: fork + package rename completed.
- Phase 2: network layer (Retrofit, OkHttp, bookshelf-api + ABS clients) completed.
- Phase 3: data layer (remote Book fields, audio/ebook/cache tables, migration 16→17) completed.
- Phase 4: domain layer (ServerSettings, RemoteLibrary repository, use cases) completed.
- Phase 5a: UI scaffold (server settings screen, RemoteLibrary tab) completed.
- Phase 5b: UI/UX polish (icons, string resources, pull-to-refresh, empty/error states) merged.
- Phase 5c: server settings validation (health check, derive ABS URL, credential checks) merged.
- Phase 6a: offline cache scaffold (CacheRepository, CacheDownloadWorker, cache use cases) merged into model.
- Current: `feature/ui-polish` builds and passes `:app:compileDebugKotlin`.
- Next: audio player (ExoPlayer + MediaSession), TTS UI + jobs, cache UI in RemoteLibrary, reader integration for ebooks, progress sync.
## WARNs
- **Не пушить в `upstream` (Acclorite/book-story).** Только в `origin` (Forgejo).
- **Lissen остаётся живым проектом.** Book's Story fork — отдельная ветка развития.
- **Секреты** (ABS token, API keys) хранить только в `.env` / `credentials.json` / DataStore, никогда в коде.
- **Package:** `org.dueattendant149.bookshelf`. Все ссылки на `ua.acclorite.book_story` в коде заменены; README оставлен с оригинальными F-Droid ссылками.
## Typical tasks
- Добавить новый endpoint bookshelf-api
- Расширить `Book` / `BookEntity` для remote полей
- Добавить аудиоплеер экран
- Добавить TTS экран
- Поднять minSdk, добавить новые разрешения
- Обновить AGENTS.md при существенных изменениях архитектуры