Skip to content

Commit a03ac52

Browse files
authored
Merge pull request #7 from lllyys/dev
V2: Full feature delivery — 38 features, iCloud Sync foundation, 101 bugs fixed
2 parents fa9c04b + 36d0779 commit a03ac52

328 files changed

Lines changed: 49271 additions & 3601 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/tdd-guardian/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"enabled": true,
3-
"testCommand": "xcodebuild test -project vreader.xcodeproj -scheme vreader -destination 'platform=iOS Simulator,name=iPhone 16' -quiet",
3+
"testCommand": "DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild test -project vreader.xcodeproj -scheme vreader -destination 'platform=iOS Simulator,name=iPhone 17 Pro' -only-testing:vreaderTests -quiet",
44
"coverageCommand": "",
55
"coverageSummaryPath": "",
66
"mutationCommand": "",

.claude/tdd-guardian/state.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"last_gate_passed_at": "2026-03-11T12:00:00Z", "tests_passed": 1508, "coverage_passed": true, "last_head_sha": "ea2fb68e7a90bfd2a28149d1924e968151bb8909"}
1+
{"last_gate_passed_at": "2026-03-22T02:48:19Z", "tests_passed": 3167, "coverage_passed": true, "last_head_sha": "cbee04292cfa0465bd8e408e8dcd62376eec740e"}

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Shared instructions for all AI agents (Claude, Codex, etc.).
44

55
- You are an AI assistant working on the project.
6+
- **Read `docs/architecture.md` before making any code changes. Update it when adding new layers, patterns, services, or changing how components communicate.**
67
- Use English unless another language is requested.
78
- Follow the working agreement:
89
- Run `git status -sb` at session start.
@@ -21,7 +22,8 @@ Shared instructions for all AI agents (Claude, Codex, etc.).
2122
- Write a failing test (RED), implement minimally (GREEN), refactor (REFACTOR).
2223
- Coverage thresholds are enforced — `ut` fails if coverage drops.
2324
- Exceptions: CSS-only, docs, config. See `.claude/rules/10-tdd.md` for full scope.
24-
- Run ut for gates.
25+
- Run `xcodebuild test -only-testing:vreaderTests` for unit test gates. Skip UI tests during development.
26+
- Default simulator: **iPhone 17 Pro** (Dynamic Island — catches safe area bugs).
2527
- **Task workflow** (three files, one flow):
2628
- `docs/tasks.md`**inbox**. User writes free-form descriptions. Agent triages (classify only, do not fix or implement during triage). See `docs/tasks.md` for classification rules, deduplication, and triage record format.
2729
- `docs/bugs.md`**bug tracker**. Something implemented but broken. Follow the bug fix workflow defined in `docs/bugs.md` (Understand → RED → GREEN → REFACTOR → Verify → Track).

README.md

Lines changed: 82 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,83 @@
11
# VReader
22

3-
An iOS reader app for EPUB, PDF, TXT, and Markdown files — built with Swift 6, SwiftUI, and SwiftData.
3+
**Built entirely by AI — coded, tested, and debugged by AI agents. Human-directed.**
4+
5+
An iOS reader for EPUB, PDF, TXT, and Markdown — built entirely by AI coding agents, with Swift 6, SwiftUI, and SwiftData.
46

57
## About
68

7-
VReader is a modern reading app designed for iPhone and iPad. It provides a unified reading experience across multiple document formats with features like reading position persistence, bookmarks, highlights, full-text search, and reading time tracking. Documents sync across devices via iCloud.
9+
VReader is a modern reading app designed for iPhone and iPad, built entirely by AI coding agents (Claude Code + Codex CLI) with human direction on requirements and testing. It provides a dual-mode reading experience (native UIKit + unified TextKit 2 reflow) across multiple document formats with annotations, full-text search, AI assistant, TTS, book source scraping, and WebDAV backup.
810

911
## Features
1012

11-
- **Multi-format support** — Read EPUB, PDF, TXT, and Markdown files in a single app
12-
- **Reading position persistence** — Automatically saves and restores your scroll position per book, surviving app backgrounding, kills, and relaunches
13-
- **CJK & encoding support** — Automatic encoding detection for GBK, Big5, Shift-JIS, EUC-KR, and other non-UTF-8 files
14-
- **Large file performance** — Chunked rendering (UITableView) for TXT files over 500K characters; no glyph storage blowup
15-
- **Bookmarks & highlights** — Save your place and annotate passages with color-coded highlights and notes
16-
- **EPUB/PDF annotation** — Text selection + highlight/note actions in EPUB (CSS Highlight API) and PDF (PDFAnnotation). Persists across sessions via unified AnnotationAnchor schema
17-
- **Full-text search** — Search across your entire library with SQLite FTS5 and CJK-aware tokenization. Highlights match at destination
18-
- **Reading progress bar** — Draggable scrubber in all 4 formats: continuous for TXT/MD, page-based for PDF, chapter-based for EPUB
19-
- **Table of contents** — Auto-generated for Markdown (heading extraction), built-in for EPUB/PDF
20-
- **AI assistant** — Summarize sections, multi-turn chat with book context, bilingual translation (9 languages), general AI chat. OpenAI-compatible API
21-
- **Reading time tracking** — Automatic session tracking with per-book statistics and reading speed calculations
22-
- **Reader settings** — Configurable font size, font family, line spacing, letter spacing, and theme
23-
- **Library management** — Grid/list view with persistent preferences, book info sheet, share, context menu
24-
- **Import from anywhere** — Open files via Share Sheet, Files app, or direct download
13+
### Reading
14+
- **Multi-format** — EPUB, PDF, TXT, Markdown in a single app
15+
- **Dual-mode engine** — Native (UIKit bridges) + Unified (TextKit 2 reflow) rendering
16+
- **Reading position** — Auto-saves scroll position, survives app kills and relaunches
17+
- **CJK encoding** — Auto-detect GBK, Big5, Shift-JIS, EUC-KR (8KB sample-based)
18+
- **Large file support** — Chunked UITableView for TXT files >500K characters
19+
- **Paginated mode** — CSS columns (EPUB), TextKit containers (TXT/MD), PDFKit pages
20+
- **Page turn animations** — Slide, cover-flip, or instant
21+
- **Auto page turning** — Timer-based advancement with configurable interval
22+
- **Configurable tap zones** — Left/center/right zones mapped to customizable actions
23+
24+
### Annotations
25+
- **Bookmarks, highlights, notes** — Full CRUD for all formats (TXT/MD/PDF/EPUB)
26+
- **EPUB highlights** — CSS Highlight API with JS bridge + buffered delivery
27+
- **PDF highlights** — PDFAnnotation-based with selection detection
28+
- **TXT/MD highlights** — NSAttributedString with persistent rendering
29+
- **Export/import** — Markdown + JSON export, VReader JSON round-trip import
30+
31+
### Search & Navigation
32+
- **Full-text search** — SQLite FTS5 with CJK tokenization, persistent index
33+
- **Reading progress bar** — Draggable scrubber (continuous, page-based, chapter-based)
34+
- **Table of contents** — EPUB nav/NCX, PDF outline, TXT auto-detection (25 Legado rules), MD headings
35+
- **Dictionary** — System dictionary lookup + AI translation on text selection
36+
37+
### AI
38+
- **Summarization** — Section and chapter summaries via OpenAI-compatible API
39+
- **Chat** — Multi-turn conversation with book context
40+
- **Translation** — Bilingual view (9 languages)
41+
- **General chat** — AI chat without book context
42+
43+
### Library
44+
- **Grid/list view** — Persistent sort order and view mode
45+
- **Collections** — Tags, series, custom groups
46+
- **Custom covers** — Set from photo library
47+
- **Context menu** — Info, share, set cover, delete
48+
- **OPDS catalog** — Browse and download from OPDS 1.2 feeds
49+
- **Book sources** — Legado-compatible rule engine for web novel scraping
50+
51+
### Text Processing
52+
- **TTS** — System (AVSpeechSynthesizer) + cloud HTTP TTS with playback controls
53+
- **TTS sentence highlight** — NLTokenizer-based sentence detection synced to speech position
54+
- **TTS auto-scroll** — Text view follows speech position in real-time
55+
- **Simp/Trad Chinese** — Toggle conversion via ICU (live re-apply without reloading)
56+
- **Content replacement** — Regex rules for text cleanup (live re-apply via source text storage)
57+
- **Reading time tracking** — Per-book session stats and speed calculations
58+
59+
### Sync & Backup
60+
- **iCloud Sync** (foundation) — CloudKit sync engine, record mapper (8 types), device identity, change tokens, durable tombstones, settings bridge (NSUbiquitousKeyValueStore)
61+
- **WebDAV backup** — Archive to any WebDAV server (Nutstore compatible)
62+
- **Per-book settings** — Font, theme, spacing overrides per book (JSON-persisted)
63+
- **Theme backgrounds** — Custom background images via PhotosPicker with per-theme opacity
2564

2665
## Tech Stack
2766

2867
| Component | Technology |
2968
| ----------- | -------------------------------------------------- |
3069
| UI | SwiftUI |
31-
| Persistence | SwiftData + CloudKit |
70+
| Persistence | SwiftData (SchemaV4) |
3271
| EPUB | WKWebView bridge with CSS theme injection + JS highlight API |
3372
| PDF | PDFKit + PDFAnnotation for highlights |
3473
| TXT | TextKit 1 (UITextView) + chunked UITableView |
3574
| Markdown | NSAttributedString rendering via MDParser |
3675
| Search | SQLite FTS5 with CJK tokenization |
3776
| AI | OpenAI-compatible API (summarize, chat, translate) |
77+
| TTS | AVSpeechSynthesizer + HTTP cloud TTS |
78+
| Backup | WebDAV client + iCloud Sync foundation (CloudKit) |
3879
| Encoding | ICU + heuristic detection (UTF-8/GBK/Big5/Shift-JIS) |
3980
| Concurrency | Swift 6 strict concurrency |
40-
| Project gen | XcodeGen |
4181

4282
## Requirements
4383

@@ -59,27 +99,28 @@ Then select a simulator or device and run.
5999

60100
## Architecture
61101

102+
See [`docs/architecture.md`](docs/architecture.md) for the full architecture document.
103+
62104
```
63105
vreader/
64-
├── App/ # App entry point, configuration
65-
├── Models/ # SwiftData models (Book, ReadingPosition, Bookmark, etc.)
106+
├── App/ # App entry point, SwiftData schema init
107+
├── Models/ # SwiftData models, DocumentFingerprint, Locator
108+
├── ViewModels/ # Library and per-format reader view models
66109
├── Views/
67-
│ ├── Reader/ # Reader views per format (EPUB, PDF, TXT, MD)
68-
│ ├── Library/ # Library views, book info, context menu
69-
│ ├── Settings/ # AI settings, preferences
70-
│ └── AI/ # Chat view
71-
├── ViewModels/ # Per-reader and per-feature view models
110+
│ ├── Reader/ # Reader container, format bridges, chrome overlay
111+
│ ├── Bookmarks/ # BookmarkListView, TOCListView
112+
│ ├── Annotations/ # HighlightListView, AnnotationListView
113+
│ └── Settings/ # ReaderSettingsPanel, AI/TTS/WebDAV settings
72114
├── Services/
73-
│ ├── EPUB/ # EPUB parsing and rendering
74-
│ ├── TXT/ # TXT service, chunker, attributed string builder
75-
│ ├── MD/ # Markdown parser and renderer
76-
│ ├── Search/ # FTS5 indexing, text extraction, tokenization
77-
│ ├── AI/ # AI service, configuration, context extraction
78-
│ ├── Sync/ # iCloud sync coordination
79-
│ └── Locator/ # Reading position model (Readium-inspired)
80-
└── Utils/ # Helpers, extensions, encoding detection
81-
vreaderTests/ # Unit tests (2040+ test cases)
82-
vreaderUITests/ # UI tests (XCTest)
115+
│ ├── TXT/, EPUB/ # Format-specific parsing and loading
116+
│ ├── Search/ # FTS5 indexing, text extraction
117+
│ ├── AI/, TTS/ # AI service, TTS providers
118+
│ ├── Backup/ # WebDAV client, BackupProvider
119+
│ ├── Sync/ # iCloud sync engine, CloudKit mapper, tombstones
120+
│ ├── TextMapping/ # Simp/Trad, replacement rules
121+
│ └── Locator/ # Reading position (Readium-inspired)
122+
vreaderTests/ # Unit tests (3200+ test cases)
123+
vreaderUITests/ # UI tests (XCUITest)
83124
```
84125

85126
### Key Design Decisions
@@ -92,7 +133,7 @@ vreaderUITests/ # UI tests (XCTest)
92133

93134
## AI-Powered Development
94135

95-
VReader is built using an AI-assisted coding workflow with multiple agents collaborating through structured processes.
136+
All code, tests, bug fixes, and documentation are produced by AI coding agents. The human role is directing requirements, reporting bugs, and verifying on device.
96137

97138
### Tools
98139

@@ -129,6 +170,10 @@ Shared rules for all AI agents live in [`AGENTS.md`](AGENTS.md):
129170
- `CLAUDE.md` — Claude Code project instructions
130171
- `AGENTS.md` — Shared instructions for all AI coding agents
131172

173+
## Status
174+
175+
Active development. See [features](docs/features.md) (38 done) and [bugs](docs/bugs.md) (87 fixed) for current state.
176+
132177
## License
133178

134-
TBD
179+
MIT

0 commit comments

Comments
 (0)