blueprint-sync
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCheck the status of generated content and offer options for modified or stale files.
检查生成内容的状态,并为已修改或过期的文件提供操作选项。
Flags
标记
| Flag | Description |
|---|---|
| Preview sync status report without interactive prompts or file modifications |
Purpose:
- Detect when generated skills/commands have been manually modified
- Detect when source PRDs have changed (making generated content stale)
- Offer appropriate actions: regenerate, promote to custom, or keep as-is
Steps:
-
Read manifest:bash
cat docs/blueprint/manifest.json- Extract section
generated.rules - If no generated content, report "Nothing to sync"
- Extract
-
Check each generated rule: For each rule in:
manifest.generated.rulesa. Verify file exists:bashtest -f .claude/rules/{name}.mdb. Hash current content:bashsha256sum .claude/rules/{name}.md | cut -d' ' -f1c. Compare hashes:- If matches → status:
content_hashcurrent - If differs → status:
content_hashmodified
d. Check source freshness (for rules from PRDs):- Hash current PRD content
- Compare with in manifest
source_hash - If differs → status:
stale
- If
-
Display sync report:
Generated Content Sync Status Rules (.claude/rules/): ✅ architecture-patterns.md: Current ⚠️ testing-strategies.md: Modified locally 🔄 implementation-guides.md: Stale (PRDs changed) ✅ quality-standards.md: Current Summary: - Current: 3 files - Modified: 1 file (user edited) - Stale: 1 file (source changed) -
If: Output the sync report from Step 3 and exit. Skip all remaining steps.
--dry-run -
For modified content, offer options:
question: "{name} has been modified locally. What would you like to do?" options: - label: "Keep modifications" description: "Mark as acknowledged, preserve your changes" - label: "Discard modifications (regenerate)" description: "Overwrite with fresh generation from PRDs" - label: "View diff" description: "See what changed before deciding" - label: "Skip this file" description: "Leave as-is for now"Based on selection:- "Keep modifications" → Update to current, mark as acknowledged
content_hash - "Regenerate" → Regenerate this rule from PRDs
- "View diff" → Show diff then re-ask
- "Skip" → Continue to next file
- "Keep modifications" → Update
-
For stale content, offer options:
question: "{name} is stale (PRDs have changed). What would you like to do?" options: - label: "Regenerate from PRDs (Recommended)" description: "Update with latest patterns from docs/prds/" - label: "Keep current version" description: "Mark as current without regenerating" - label: "View what changed in PRDs" description: "See PRD changes before deciding" - label: "Skip this file" description: "Leave stale for now"Based on selection:- "Regenerate" → Regenerate this rule from PRDs
- "Keep" → Update to current, mark as current
source_hash - "View" → Show PRD diff then re-ask
- "Skip" → Continue to next file
-
Update manifest after changes:
- Update for regenerated files
content_hash - Update if PRD changes acknowledged
source_hash - Update field appropriately
status
- Update
-
Final report:
Sync Complete Actions taken: - testing-strategies.md: Modifications acknowledged - implementation-guides.md: Regenerated from PRDs Current state: - 4 generated rules (all current) Manifest updated.
Tips:
- Run periodically to check for drift
/blueprint:sync - Acknowledge modifications you want to keep
- Regenerating will overwrite local changes
- Stale content still works, but may miss new patterns from PRDs
| 标记 | 描述 |
|---|---|
| 预览同步状态报告,无交互式提示或文件修改 |
用途:
- 检测生成的skills/commands是否被手动修改
- 检测源PRD是否已变更(导致生成内容过期)
- 提供合适的操作选项:重新生成、升级为自定义内容或保持原样
步骤:
-
读取manifest:bash
cat docs/blueprint/manifest.json- 提取部分
generated.rules - 若无生成内容,报告"无内容可同步"
- 提取
-
检查每个生成规则: 针对中的每条规则:
manifest.generated.rulesa. 验证文件是否存在:bashtest -f .claude/rules/{name}.mdb. 计算当前内容的哈希值:bashsha256sum .claude/rules/{name}.md | cut -d' ' -f1c. 对比哈希值:- 若匹配 → 状态:
content_hash(当前)current - 若不匹配 → 状态:
content_hash(已修改)modified
d. 检查源文件新鲜度(针对来自PRD的规则):- 计算当前PRD内容的哈希值
- 与manifest中的对比
source_hash - 若不匹配 → 状态:(过期)
stale
- 若
-
显示同步报告:
生成内容同步状态 规则文件(.claude/rules/): ✅ architecture-patterns.md:当前 ⚠️ testing-strategies.md:本地已修改 🔄 implementation-guides.md:过期(PRD已变更) ✅ quality-standards.md:当前 摘要: - 当前:3个文件 - 已修改:1个文件(用户编辑) - 过期:1个文件(源文件变更) -
若使用参数:输出步骤3的同步报告后退出,跳过所有后续步骤。
--dry-run -
针对已修改内容,提供以下选项:
问题: "{name}已被本地修改,您想要执行什么操作?" 选项: - 标签: "保留修改" 描述: "标记为已确认,保留您的修改" - 标签: "放弃修改(重新生成)" 描述: "用PRD重新生成的内容覆盖" - 标签: "查看差异" 描述: "在做决定前查看变更内容" - 标签: "跳过此文件" 描述: "暂时保持原样"根据选择执行以下操作:- "保留修改" → 将更新为当前值,标记为已确认
content_hash - "重新生成" → 从PRD重新生成此规则
- "查看差异" → 显示差异后重新询问
- "跳过" → 继续处理下一个文件
- "保留修改" → 将
-
针对过期内容,提供以下选项:
问题: "{name}已过期(PRD已变更),您想要执行什么操作?" 选项: - 标签: "从PRD重新生成(推荐)" 描述: "使用docs/prds/中的最新模式更新" - 标签: "保留当前版本" 描述: "标记为当前版本,不重新生成" - 标签: "查看PRD中的变更内容" 描述: "在做决定前查看PRD的变更" - 标签: "跳过此文件" 描述: "暂时保持过期状态"根据选择执行以下操作:- "重新生成" → 从PRD重新生成此规则
- "保留" → 将更新为当前值,标记为当前版本
source_hash - "查看" → 显示PRD差异后重新询问
- "跳过" → 继续处理下一个文件
-
变更后更新manifest:
- 为重新生成的文件更新
content_hash - 若确认PRD变更,更新
source_hash - 相应更新字段
status
- 为重新生成的文件更新
-
最终报告:
同步完成 已执行的操作: - testing-strategies.md:已确认修改 - implementation-guides.md:从PRD重新生成 当前状态: - 4个生成规则(全部为当前版本) Manifest已更新。
提示:
- 定期运行以检查内容偏差
/blueprint:sync - 确认您想要保留的修改
- 重新生成会覆盖本地修改
- 过期内容仍可使用,但可能缺少PRD中的新模式