1
0

refactor: 重构文档结构,采用渐进式信息披露模式

将 README.md 拆分为多个专题文档,减少认知负荷:
- 用户文档迁移到 docs/ (用户指南、元素、模板、参考等)
- 开发文档迁移到 docs/development/ (架构、模块、规范)
- README.md 精简至 ~290 行,仅保留概览和导航
- 删除 README_DEV.md,内容已迁移
- 归档 OpenSpec 变更 refactor-docs-progressive-disclosure
This commit is contained in:
2026-03-06 15:11:36 +08:00
parent 98098dc911
commit 124ef0e5ce
41 changed files with 5238 additions and 2228 deletions

123
docs/reference/commands.md Normal file
View File

@@ -0,0 +1,123 @@
# 命令行选项
yaml2pptx 提供三个主要命令check、convert、preview。
## check 命令
验证 YAML 文件的正确性。
### 语法
```bash
uv run yaml2pptx.py check <input> [--template <path>]
```
### 选项
| 选项 | 说明 |
|------|------|
| `input` | 输入的 YAML 文件路径(必需) |
| `--template` | 模板库文件路径 |
### 示例
```bash
# 验证基本文件
uv run yaml2pptx.py check presentation.yaml
# 验证使用模板的文件
uv run yaml2pptx.py check presentation.yaml --template ./templates.yaml
```
## convert 命令
将 YAML 文件转换为 PPTX 文件。
### 语法
```bash
uv run yaml2pptx.py convert <input> [output] [options]
```
### 选项
| 选项 | 说明 |
|------|------|
| `input` | 输入的 YAML 文件路径(必需) |
| `output` | 输出的 PPTX 文件路径(可选) |
| `--template` | 模板库文件路径 |
| `--skip-validation` | 跳过自动验证 |
| `--force` / `-f` | 强制覆盖已存在文件 |
### 示例
```bash
# 基本转换(自动生成输出文件名)
uv run yaml2pptx.py convert presentation.yaml
# 指定输出文件
uv run yaml2pptx.py convert presentation.yaml output.pptx
# 使用模板库
uv run yaml2pptx.py convert presentation.yaml output.pptx --template ./templates.yaml
# 跳过验证
uv run yaml2pptx.py convert presentation.yaml --skip-validation
# 强制覆盖
uv run yaml2pptx.py convert presentation.yaml output.pptx --force
```
## preview 命令
启动预览服务器,实时查看演示文稿效果。
### 语法
```bash
uv run yaml2pptx.py preview <input> [options]
```
### 选项
| 选项 | 说明 |
|------|------|
| `input` | 输入的 YAML 文件路径(必需) |
| `--template` | 模板库文件路径 |
| `--port` | 服务器端口(默认:随机端口 30000-40000 |
| `--host` | 主机地址默认127.0.0.1 |
| `--no-browser` | 不自动打开浏览器 |
### 示例
```bash
# 启动预览(自动打开浏览器)
uv run yaml2pptx.py preview presentation.yaml
# 指定端口
uv run yaml2pptx.py preview presentation.yaml --port 8080
# 允许局域网访问
uv run yaml2pptx.py preview presentation.yaml --host 0.0.0.0
# 不自动打开浏览器
uv run yaml2pptx.py preview presentation.yaml --no-browser
# 使用模板
uv run yaml2pptx.py preview presentation.yaml --template ./templates.yaml
```
## 通用选项
所有命令都支持以下行为:
- 自动安装依赖(通过 uv
- 显示友好的错误信息
- 支持相对路径和绝对路径
## 退出代码
- `0` - 成功
- `1` - 错误(文件不存在、验证失败等)
[返回文档索引](../README.md)