mcpField
B
blueprint-sync

blueprint-sync

github.com/laurigatesAgent 工作流5955 次安装1 天前更新
代码仓库

关于 blueprint-sync

blueprint-sync 是用于检查生成规则和技能是否被修改或过时的 Agent 技能。它将文件及源 PRD 的哈希与清单比对,并提供保留、重新生成或查看差异的选项。

主要功能

  1. 01检测已修改或过时的生成内容
  2. 02将文件及 PRD 哈希与清单比对
  3. 03提供保留、重新生成和查看差异选项
  4. 04支持不修改文件的 --dry-run 报告

适用场景

  1. 01检查生成规则是否存在偏差
  2. 02审查影响生成内容的 PRD 变更
  3. 03修改文件前预览同步状态

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/laurigates/claude-plugins --skill blueprint-sync

安装后在 Claude Code 中输入/blueprint-sync确认已加载。

详细介绍

检查生成内容的状态,并为已修改或过时的文件提供选项。

何时使用此技能

在以下情况下使用此技能……在以下情况下改用 blueprint-promote……
你想检测过时或已修改的生成规则/技能你已决定保留某条已编辑的规则(单个工件)
你正在协调 .claude/rules/ 与清单之间的差异你想确认修改并停止同步警告
你想一次性获取多个文件的重新生成/提升/保留选项改用 blueprint-generate-rules,从 PRD 重新生成
你想在进行任何更改前使用 --dry-run 预览状态改用 blueprint-sync-ids 分配 ID,而非处理内容差异

标志

标志说明
--dry-run预览同步状态报告,不显示交互式提示,也不修改文件

步骤

目的:

  • 检测生成的技能/命令是否已被手动修改
  • 检测源 PRD 是否已更改(导致生成内容过时)
  • 提供适当的操作:重新生成、提升为自定义内容,或保持原样
  1. 读取清单:

    cat docs/blueprint/manifest.json
    
    • 提取 generated.rules 部分
    • 如果没有生成内容,则报告“没有需要同步的内容”
  2. 检查每条生成的规则: 对于 manifest.generated.rules 中的每条规则:

    a. 确认文件存在:

    test -f .claude/rules/{name}.md
    

    b. 计算当前内容的哈希值:

    sha256sum .claude/rules/{name}.md | cut -d' ' -f1
    

    c. 比较哈希值:

    • 如果 content_hash 匹配 → 状态:current
    • 如果 content_hash 不同 → 状态:modified

    d. 检查源内容是否为最新(适用于来自 PRD 的规则):

    • 计算当前 PRD 内容的哈希值
    • 与清单中的 source_hash 比较
    • 如果不同 → 状态:stale
  3. 显示同步报告:

    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. 如果使用 --dry-run:输出步骤 3 中的同步报告并退出。跳过所有剩余步骤。

  5. 对于已修改的内容,提供以下选项:

    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"
    

    根据所选项执行:

    • “保留修改” → 将 content_hash 更新为当前值,并标记为已确认
    • “重新生成” → 根据 PRD 重新生成此规则
    • “查看差异” → 显示差异,然后再次询问
    • “跳过” → 继续处理下一个文件
  6. 对于过时的内容,提供以下选项:

    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"
    

    根据所选项执行:

    • “重新生成” → 根据 PRD 重新生成此规则
    • “保留” → 将 source_hash 更新为当前值,并标记为最新
    • “查看” → 显示 PRD 差异,然后再次询问
    • “跳过” → 继续处理下一个文件
  7. 更改后更新清单:

    • 更新重新生成文件的 content_hash
    • 如果已确认 PRD 更改,则更新 source_hash
    • 相应地更新 status 字段
  8. 最终报告:

    Sync Complete
    
    Actions taken:
    - testing-strategies.md: Modifications acknowledged
    - implementation-guides.md: Regenerated from PRDs
    
    Current state:
    - 4 generated rules (all current)
    
    Manifest updated.
    

提示:

  • 定期运行 /blueprint:sync 检查差异
  • 确认你想保留的修改
  • 重新生成会覆盖本地更改
  • 过时的内容仍可使用,但可能缺少 PRD 中的新模式

评论

支持 Markdown