claude-code/claude-zh/commands/checkpoint.md

75 lines
1.7 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.

# Checkpoint 指令
在工作流中建立或驗證檢查點 (Checkpoint)。
## 使用方式
`/checkpoint [create|verify|list] [name]`
## 建立檢查點 (Create Checkpoint)
建立檢查點時:
1. 執行 `/verify quick` 以確保目前狀態是乾淨的
2. 建立 git stash 或使用檢查點名稱進行 commit
3. 將檢查點記錄至 `.claude/checkpoints.log`
```bash
echo "$(date +%Y-%m-%d-%H:%M) | $CHECKPOINT_NAME | $(git rev-parse --short HEAD)" >> claude/checkpoints.log
```
4. 回報檢查點已建立
## 驗證檢查點 (Verify Checkpoint)
對比檢查點進行驗證時:
1. 從日誌中讀取檢查點
2. 比較目前狀態與檢查點的差異:
- 自檢查點以來新增的檔案
- 自檢查點以來修改的檔案
- 目前與當時的測試通過率
- 目前與當時的測試覆蓋率
3. 產生報告:
```
CHECKPOINT 比較:$NAME
============================
檔案變更X
測試:+Y 通過 / -Z 失敗
覆蓋率:+X% / -Y%
建置:[成功/失敗]
```
## 列出檢查點 (List Checkpoints)
顯示所有檢查點,包含:
- 名稱
- 時間戳記
- Git SHA
- 狀態 (目前、落後、超前)
## 工作流 (Workflow)
典型的檢查點流程:
```
[開始] --> /checkpoint create "功能開發開始"
|
[實作] --> /checkpoint create "核心完成"
|
[測試] --> /checkpoint verify "核心完成"
|
[重構] --> /checkpoint create "重構完成"
|
[PR] --> /checkpoint verify "功能開發開始"
```
## 參數說明 (Arguments)
$ARGUMENTS
- `create <name>` - 建立具名檢查點
- `verify <name>` - 對比具名檢查點進行驗證
- `list` - 顯示所有檢查點
- `clear` - 移除舊的檢查點 (保留最後 5 個)