blueprint-sync

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Check the status of generated content and offer options for modified or stale files.
检查生成内容的状态,并为已修改或过期的文件提供操作选项。

Flags

标记

FlagDescription
--dry-run
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:
  1. Read manifest:
    bash
    cat docs/blueprint/manifest.json
    • Extract
      generated.rules
      section
    • If no generated content, report "Nothing to sync"
  2. Check each generated rule: For each rule in
    manifest.generated.rules
    :
    a. Verify file exists:
    bash
    test -f .claude/rules/{name}.md
    b. Hash current content:
    bash
    sha256sum .claude/rules/{name}.md | cut -d' ' -f1
    c. Compare hashes:
    • If
      content_hash
      matches → status:
      current
    • If
      content_hash
      differs → status:
      modified
    d. Check source freshness (for rules from PRDs):
    • Hash current PRD content
    • Compare with
      source_hash
      in manifest
    • If differs → status:
      stale
  3. 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)
  4. If
    --dry-run
    : Output the sync report from Step 3 and exit. Skip all remaining steps.
  5. 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
      content_hash
      to current, mark as acknowledged
    • "Regenerate" → Regenerate this rule from PRDs
    • "View diff" → Show diff then re-ask
    • "Skip" → Continue to next file
  6. 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
      source_hash
      to current, mark as current
    • "View" → Show PRD diff then re-ask
    • "Skip" → Continue to next file
  7. Update manifest after changes:
    • Update
      content_hash
      for regenerated files
    • Update
      source_hash
      if PRD changes acknowledged
    • Update
      status
      field appropriately
  8. 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
    /blueprint:sync
    periodically to check for drift
  • Acknowledge modifications you want to keep
  • Regenerating will overwrite local changes
  • Stale content still works, but may miss new patterns from PRDs
标记描述
--dry-run
预览同步状态报告,无交互式提示或文件修改
用途:
  • 检测生成的skills/commands是否被手动修改
  • 检测源PRD是否已变更(导致生成内容过期)
  • 提供合适的操作选项:重新生成、升级为自定义内容或保持原样
步骤:
  1. 读取manifest:
    bash
    cat docs/blueprint/manifest.json
    • 提取
      generated.rules
      部分
    • 若无生成内容,报告"无内容可同步"
  2. 检查每个生成规则: 针对
    manifest.generated.rules
    中的每条规则:
    a. 验证文件是否存在:
    bash
    test -f .claude/rules/{name}.md
    b. 计算当前内容的哈希值:
    bash
    sha256sum .claude/rules/{name}.md | cut -d' ' -f1
    c. 对比哈希值:
    • content_hash
      匹配 → 状态:
      current
      (当前)
    • content_hash
      不匹配 → 状态:
      modified
      (已修改)
    d. 检查源文件新鲜度(针对来自PRD的规则):
    • 计算当前PRD内容的哈希值
    • 与manifest中的
      source_hash
      对比
    • 若不匹配 → 状态:
      stale
      (过期)
  3. 显示同步报告:
    生成内容同步状态
    
    规则文件(.claude/rules/):
    ✅ architecture-patterns.md:当前
    ⚠️ testing-strategies.md:本地已修改
    🔄 implementation-guides.md:过期(PRD已变更)
    ✅ quality-standards.md:当前
    
    摘要:
    - 当前:3个文件
    - 已修改:1个文件(用户编辑)
    - 过期:1个文件(源文件变更)
  4. 若使用
    --dry-run
    参数
    :输出步骤3的同步报告后退出,跳过所有后续步骤。
  5. 针对已修改内容,提供以下选项:
    问题: "{name}已被本地修改,您想要执行什么操作?"
    选项:
      - 标签: "保留修改"
        描述: "标记为已确认,保留您的修改"
      - 标签: "放弃修改(重新生成)"
        描述: "用PRD重新生成的内容覆盖"
      - 标签: "查看差异"
        描述: "在做决定前查看变更内容"
      - 标签: "跳过此文件"
        描述: "暂时保持原样"
    根据选择执行以下操作:
    • "保留修改" → 将
      content_hash
      更新为当前值,标记为已确认
    • "重新生成" → 从PRD重新生成此规则
    • "查看差异" → 显示差异后重新询问
    • "跳过" → 继续处理下一个文件
  6. 针对过期内容,提供以下选项:
    问题: "{name}已过期(PRD已变更),您想要执行什么操作?"
    选项:
      - 标签: "从PRD重新生成(推荐)"
        描述: "使用docs/prds/中的最新模式更新"
      - 标签: "保留当前版本"
        描述: "标记为当前版本,不重新生成"
      - 标签: "查看PRD中的变更内容"
        描述: "在做决定前查看PRD的变更"
      - 标签: "跳过此文件"
        描述: "暂时保持过期状态"
    根据选择执行以下操作:
    • "重新生成" → 从PRD重新生成此规则
    • "保留" → 将
      source_hash
      更新为当前值,标记为当前版本
    • "查看" → 显示PRD差异后重新询问
    • "跳过" → 继续处理下一个文件
  7. 变更后更新manifest:
    • 为重新生成的文件更新
      content_hash
    • 若确认PRD变更,更新
      source_hash
    • 相应更新
      status
      字段
  8. 最终报告:
    同步完成
    
    已执行的操作:
    - testing-strategies.md:已确认修改
    - implementation-guides.md:从PRD重新生成
    
    当前状态:
    - 4个生成规则(全部为当前版本)
    
    Manifest已更新。
提示:
  • 定期运行
    /blueprint:sync
    以检查内容偏差
  • 确认您想要保留的修改
  • 重新生成会覆盖本地修改
  • 过期内容仍可使用,但可能缺少PRD中的新模式