feat: Release v0.10 - Modular Architecture & External Config

- Refactor codebase into src/ (preprocessing, translation, assembly)
- Add pipeline/ scripts for individual stages
- Externalize configuration to config/config.yaml
- Fix Cover Image preservation
- Update documentation and manuals
This commit is contained in:
谭凯
2026-01-31 22:49:44 +08:00
parent 9ef82393be
commit 7a93c52b42
306 changed files with 30313 additions and 1071 deletions
@@ -0,0 +1,38 @@
---
trigger: always_on
---
# EPUB Bilingual Translator - File Architecture & Workspace Rules
## 1. Directory Structure
The project follows a strict modular structure. Code is in `src/`, execution scripts in `pipeline/`, and intermediate data in `.work/`.
.
├── main.py # Entry point (orchestrator)
├── pipeline/ # Executable scripts for each stage
│ ├── 01_preprocess.py # Step 1: Clean & Extract
│ ├── 02_translate.py # Step 2: LLM Translation
│ └── 03_assemble.py # Step 3: Backfill & Build
├── src/ # Source modules
│ ├── common/ # shared utils, config, paths.py
│ ├── preprocessing/ # epub_cleaner, text_extractor, profiler
│ ├── translation/ # llm_client, translator_engine, manifest_manager
│ └── assembly/ # backfiller, builder, format_restorer
├── config/
│ ├── config.yaml # System configuration (LLM, Translation)
│ └── prompts.json # LLM Prompts
└── .work/ # Working Directory (Gitignored)
└── {book_name}/ # One folder per book
├── book_structure.json # Structural skeleton (created by Step 1)
├── manifest.json # Translation source of truth
├── assets/ # Extracted images/css
└── chunks/ # Debug chunks from translation (before/after)
## 2. Path Resolution Rule
ALWAYS use `src.common.paths.get_work_dirs(input_path)` to resolve paths.
DO NOT hardcode `work/`, `.work/`, or `tmp/` paths in scripts.
## 3. Data Flow
1. Preprocess: EPUB -> .work/{book}/book_structure.json + .work/{book}/manifest.json
2. Translate: .work/{book}/manifest.json (read/write) -> .work/{book}/chunks/ (logs)
3. Assemble: .work/{book}/manifest.json + .work/{book}/book_structure.json -> output/{book}_bilingual.epub