sync-pd2-wiki/README.md

120 lines
2.8 KiB
Markdown
Raw Permalink 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.

# PD2 Wiki Sync Tool
Project Diablo 2 Wiki 中英文同步工具,用于同步英文 Wiki 变更到中文翻译文档。
## 前置要求
### 1. 安装 Claude Code
本工具需要通过 [Claude Code](https://github.com/anthropics/claude-code) 来使用。
```bash
# 安装 Claude Code
npm install -g @anthropic-ai/claude-code
```
### 2. 克隆仓库
```bash
git clone <repository-url>
cd sync-pd2-wiki
```
### 3. 创建虚拟环境并安装依赖
```bash
python -m venv venv
source venv/bin/activate # Linux/macOS
# 或
.\venv\Scripts\activate # Windows
pip install -r requirements.txt
```
## 使用方法
### 启动 Claude Code
在项目目录下运行:
```bash
claude
```
### 使用 Skill 同步 Wiki
在 Claude Code 中使用 `/wiki-sync-translate` 命令:
#### 示例 1同步特定时间的所有页面变更
```
/wiki-sync-translate 帮我同步从2026-01-02以来的所有变更
```
#### 示例 2同步特定页面
```
/wiki-sync-translate 同步 Maps 页面的变更
```
#### 示例 3同步特定时间范围的单个页面
```
/wiki-sync-translate 同步从2026-01-01开始的 General Changes 页面
```
#### 示例 4同步最近的变更
```
/wiki-sync-translate 同步最近一周的所有变更
```
## 输出文件
同步完成后,文件会保存在 `wiki_sync_output/<时间戳>/` 目录:
```
wiki_sync_output/20260322_145110/
├── new_pages/ # 新创建的页面
│ └── [页面名].full.txt # 英文完整内容
├── changed_pages/ # 有变更的页面
│ ├── [页面名].full.txt # 英文最新版本
│ ├── [页面名].cn.txt # 中文原文
│ ├── [页面名].comparison.json # 结构化变更信息
│ └── [页面名].old.txt # 英文历史版本
└── result_pages/ # 更新后的中文文档
└── [页面名].cn.txt # 可直接复制到 Wiki
```
## 变更配对算法
工具使用**内容相似度算法**来判断变更是否应该配对:
- 相似度阈值0.550%
- 只有内容相似度 ≥ 50% 的行才会被配对为 `replaced`
- 这避免了将完全不同内容的行错误配对
## 目录结构
```
sync-pd2-wiki/
├── .claude/
│ └── skills/
│ └── wiki-sync-translate/
│ ├── SKILL.md # Skill 定义
│ └── scripts/
│ └── wiki_sync.py # 同步脚本
├── wiki_sync_output/ # 同步输出
├── references/ # 参考文件
├── requirements.txt # Python 依赖
├── CLAUDE.md # Claude Code 配置
└── README.md # 本文件
```
## License
MIT