config-sync
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/configure:config-sync
/configure:config-sync
Extract, compare, and propagate tooling config improvements across FVH repos.
在FVH的各个仓库之间提取、比较并传播工具配置的改进。
When to Use This Skill
何时使用此技能
| Use this skill when... | Use another approach when... |
|---|---|
| Comparing a workflow/config across all FVH repos | Configuring a single repo's workflow from scratch — use |
| Propagating an improvement from one repo to many | Debugging a failing CI run — use |
| Identifying which repos have outdated configs | Creating a reusable workflow — use |
| Extracting novel patterns from a repo to share | Checking a single repo's compliance — use |
| 适用场景 | 其他场景(使用其他方法) |
|---|---|
| 在所有FVH仓库之间对比工作流/配置 | 从零开始配置单个仓库的工作流 — 使用 |
| 将某一个仓库的改进点传播到多个仓库 | 调试失败的CI运行 — 使用 |
| 识别哪些仓库的配置已过时 | 创建可复用工作流 — 使用 |
| 从某一个仓库提取新颖的配置模式并共享 | 检查单个仓库的合规性 — 使用 |
Context
上下文
- Workspace root:
/Users/lgates/repos/ForumViriumHelsinki - Repos: !
fd -t d -d 1 . /Users/lgates/repos/ForumViriumHelsinki --exclude .git --exclude node_modules - Current directory: !
pwd
- 工作区根目录:
/Users/lgates/repos/ForumViriumHelsinki - 仓库列表: !
fd -t d -d 1 . /Users/lgates/repos/ForumViriumHelsinki --exclude .git --exclude node_modules - 当前目录: !
pwd
Parameters
参数
Parse mode and options from command arguments:
从命令参数中解析模式和选项:
Modes
模式
- — Identify improvements in a source repo
extract [repo-name] - — Compare a specific config across all repos
diff <file-pattern> - — Propagate config to targets
apply <file-pattern> [--from repo] [--to repo1,repo2,...|--all]
- — 识别源仓库中的改进点
extract [repo-name] - — 在所有仓库之间对比特定配置文件
diff <file-pattern> - — 将配置传播到目标仓库
apply <file-pattern> [--from repo] [--to repo1,repo2,...|--all]
Options
选项
- — Source repo for apply mode (default: best version detected)
--from <repo> - — Target repos (comma-separated)
--to <repo1,repo2,...> - — Target all repos that have the file
--all - — Show what would change without creating branches/PRs (default behavior)
--dry-run - — Actually create branches and PRs
--confirm
- — apply模式的源仓库(默认:检测到的最优版本)
--from <repo> - — 目标仓库(逗号分隔)
--to <repo1,repo2,...> - — 目标为所有包含该文件的仓库
--all - — 显示将会发生的变更,但不创建分支/PR(默认行为)
--dry-run - — 实际创建分支和PR
--confirm
Config Categories
配置类别
Files tracked for cross-repo sync, organized by sync strategy:
跨仓库同步跟踪的文件,按同步策略分类:
Tier 1: Wholesale (100% identical across repos)
第一类:完全同步(所有仓库100%一致)
Copy verbatim — no repo-specific variations expected.
| File Pattern | Description |
|---|---|
| Claude Code workflow |
| Renovate dependency updates |
完全复制 — 不期望存在仓库特定的差异。
| 文件模式 | 描述 |
|---|---|
| Claude Code工作流 |
| Renovate依赖更新配置 |
Tier 2: Parameterized (shared core with known variation points)
第二类:参数化同步(共享核心结构,存在已知可变点)
Shared structure with specific fields that vary per repo.
| File Pattern | Variation Points |
|---|---|
| Branch prefix pattern |
| Publish job, extra steps |
| Standalone (infrastructure) vs reusable caller (all others) |
共享结构,但部分字段因仓库而异。
| 文件模式 | 可变点 |
|---|---|
| 分支前缀模式 |
| 发布任务、额外步骤 |
| 独立版(基础设施仓库) vs 可复用调用版(其他所有仓库) |
Tier 3: Structural (standard skeleton, project-specific bodies)
第三类:结构同步(标准框架,项目特定内容)
Standard recipe/section names must conform; bodies are project-specific.
| File Pattern | Conformance Target |
|---|---|
| Standard recipe names from justfile-template conventions |
标准的任务/章节名称必须符合规范;内容部分为项目特定。
| 文件模式 | 合规目标 |
|---|---|
| 遵循justfile-template约定的标准任务名称 |
Tier 4: Pattern-based (categorized by tech stack)
第四类:基于模式的同步(按技术栈分类)
Group by detected stack, extract general best practices only.
| File Pattern | Stack Detection |
|---|---|
| |
| Same as Dockerfile |
按检测到的技术栈分组,仅提取通用最佳实践。
| 文件模式 | 技术栈检测依据 |
|---|---|
| |
| 与Dockerfile检测规则相同 |
Tier 5: Reference (compare and report, selective apply)
第五类:参考同步(对比并报告,选择性应用)
| File Pattern | Notes |
|---|---|
| Varies by project type |
| Version tracking |
| Dev environment config |
| 文件模式 | 说明 |
|---|---|
| 因项目类型而异 |
| 版本跟踪配置 |
| 开发环境配置 |
Execution
执行流程
Extract Mode
Extract模式
Goal: Scan a repo and identify improvements that could benefit other repos.
目标:扫描仓库并识别可应用于其他仓库的改进点。
Step 1: Identify the source repo
步骤1:确定源仓库
If repo name provided, use .
Otherwise use the current working directory (must be inside an FVH repo).
/Users/lgates/repos/ForumViriumHelsinki/<repo-name>如果指定了仓库名称,使用。
否则使用当前工作目录(必须在FVH仓库内)。
/Users/lgates/repos/ForumViriumHelsinki/<repo-name>Step 2: Scan tooling files
步骤2:扫描工具配置文件
Scan for all tracked config categories:
bash
fd -t f -d 3 '(claude|renovate|auto-merge|release-please|container-build|Dockerfile|justfile|skaffold)' <repo-path>Also check:
.github/workflows/*.ymljustfileDockerfile*renovate.jsonrelease-please-config.json.release-please-manifest.jsonskaffold.yaml
扫描所有受跟踪的配置类别:
bash
fd -t f -d 3 '(claude|renovate|auto-merge|release-please|container-build|Dockerfile|justfile|skaffold)' <repo-path>同时检查:
.github/workflows/*.ymljustfileDockerfile*renovate.jsonrelease-please-config.json.release-please-manifest.jsonskaffold.yaml
Step 3: Compare against workspace patterns
步骤3:与工作区内的模式对比
For each file found:
- Wholesale tier: Hash the file content and compare against the most common version across all repos. Report if this repo has a newer/different version.
- Parameterized tier: Extract the shared core (strip known variation points) and compare structure.
- Structural tier (justfile): Check for standard recipes (,
default,help,dev,build,clean,lint,format,format-check,test,pre-commit). Report missing standard recipes and non-standard names (e.g.,ciinstead ofcheck).lint - Pattern-based tier: Detect tech stack, then check for best practices:
- Pinned base images (not )
latest - present
.dockerignore - Multi-stage builds
- Non-root user
- SHA-pinned GitHub Actions
- SBOM/provenance attestation
- Pinned base images (not
- Reference tier: Note divergences from the most common configuration.
对于每个找到的文件:
- 完全同步类:计算文件内容的哈希值,与所有仓库中最常见的版本对比。报告该仓库是否拥有更新/不同的版本。
- 参数化同步类:提取共享核心结构(移除已知可变点)并对比结构。
- 结构同步类(justfile):检查标准任务是否存在(,
default,help,dev,build,clean,lint,format,format-check,test,pre-commit)。报告缺失的标准任务和非标准名称(例如用ci代替check)。lint - 基于模式的同步类:检测技术栈,然后检查最佳实践:
- 固定基础镜像版本(非)
latest - 存在文件
.dockerignore - 多阶段构建
- 使用非root用户
- GitHub Actions使用SHA固定版本
- SBOM/来源证明
- 固定基础镜像版本(非
- 参考同步类:记录与最常见配置的差异。
Step 4: Generate extract report
步骤4:生成提取报告
Config Extract Report: <repo-name>
====================================
Wholesale Configs:
claude.yml ✅ Matches canonical (sha: abc123)
renovate.json ⚠️ Differs from canonical — newer features detected
Parameterized Configs:
auto-merge-image-updater.yml ✅ Core matches, variation: branch-prefix=argocd
release-please.yml ⚠️ Has publish job (novel improvement)
Structural (Justfile):
Standard recipes: 8/11 present
Missing: format-check, pre-commit, ci
Non-standard names: none
Pattern-based (Dockerfile):
Stack: Python
✅ Pinned base image (python:3.12-slim)
✅ Multi-stage build
⚠️ Missing .dockerignore
✅ Non-root user
Potential Improvements to Propagate:
1. renovate.json — has newer schedule config
2. release-please.yml — publish job pattern配置提取报告: <repo-name>
====================================
完全同步配置:
claude.yml ✅ 与标准版本一致(哈希值: abc123)
renovate.json ⚠️ 与标准版本不同 — 检测到新功能
参数化同步配置:
auto-merge-image-updater.yml ✅ 核心结构匹配,差异点: branch-prefix=argocd
release-please.yml ⚠️ 包含发布任务(新颖改进点)
结构同步(Justfile):
标准任务完成率: 11项中完成8项
缺失: format-check, pre-commit, ci
非标准名称: 无
基于模式的同步(Dockerfile):
技术栈: Python
✅ 固定基础镜像版本(python:3.12-slim)
✅ 多阶段构建
⚠️ 缺失.dockerignore文件
✅ 使用非root用户
可传播的潜在改进点:
1. renovate.json — 包含更新的调度配置
2. release-please.yml — 发布任务模式Diff Mode
Diff模式
Goal: Compare a specific file across all FVH repos.
目标:在所有FVH仓库之间对比特定文件。
Step 1: Resolve file pattern
步骤1:解析文件模式
Interpret the file pattern argument:
- Full path:
.github/workflows/claude.yml - Short name: → search in
claude.yml.github/workflows/ - Glob: → match all workflows
*.yml
解析命令参数中的文件模式:
- 完整路径:
.github/workflows/claude.yml - 短名称: → 在
claude.yml目录中搜索.github/workflows/ - 通配符: → 匹配所有工作流文件
*.yml
Step 2: Find the file across repos
步骤2:在所有仓库中查找该文件
bash
fd -t f '<pattern>' /Users/lgates/repos/ForumViriumHelsinki --max-depth 4bash
fd -t f '<pattern>' /Users/lgates/repos/ForumViriumHelsinki --max-depth 4Step 3: Group by content hash
步骤3:按内容哈希值分组
For each found file, compute a content hash:
bash
shasum -a 256 <file>Group files by identical hash. Sort groups by size (largest first = most common version).
对每个找到的文件,计算内容哈希值:
bash
shasum -a 256 <file>将文件按相同哈希值分组。按组大小排序(最大的组 = 最常见版本)。
Step 4: Identify the "best" version
步骤4:确定“最优”版本
Heuristics for selecting the canonical version:
- Most common hash (majority rules)
- If tie: most recently modified
- If tie: from repo (reference repo)
infrastructure
选择标准版本的启发式规则:
- 最常见的哈希值(多数规则)
- 若平局:选择最近修改的版本
- 若平局:来自仓库(参考仓库)
infrastructure
Step 5: Generate diff report
步骤5:生成对比报告
Config Diff: .github/workflows/claude.yml
==========================================
Group 1 (canonical) — 18 repos [sha: abc123]:
citylogger, CycleRoutePlanner, FVHIoT-python, ...
Group 2 — 2 repos [sha: def456]:
theme-management, OLMap
Differences from canonical:
- Line 12: uses different action version
- Line 25: extra step for Node setup
Not present in (5 repos):
infrastructure, helm-webapp, terraform-modules, ...
Recommendation: Update Group 2 repos to match canonical.For small files (< 100 lines), show an inline unified diff between the canonical and each outlier group.
配置对比: .github/workflows/claude.yml
==========================================
组1(标准版本)— 18个仓库 [哈希值: abc123]:
citylogger, CycleRoutePlanner, FVHIoT-python, ...
组2 — 2个仓库 [哈希值: def456]:
theme-management, OLMap
与标准版本的差异:
- 第12行: 使用不同的Action版本
- 第25行: 新增Node环境设置步骤
未包含该文件的仓库(5个):
infrastructure, helm-webapp, terraform-modules, ...
建议: 将组2的仓库更新为与标准版本一致。对于小文件(<100行),显示标准版本与每个异常组之间的内联统一差异。
Apply Mode
Apply模式
Goal: Propagate a config file from source to target repos.
目标:将配置文件从源仓库传播到目标仓库。
Step 1: Determine source
步骤1:确定源
- If specified, use that repo's version
--from - Otherwise, run diff mode internally to find the canonical version
- 如果指定了,使用该仓库的版本
--from - 否则,内部运行diff模式以找到标准版本
Step 2: Determine targets
步骤2:确定目标
- If specified, use those repos
--to - If , use all repos that currently have the file (excluding source)
--all - Otherwise, ask the user which repos to target
- 如果指定了,使用这些仓库
--to - 如果指定了,使用所有包含该文件的仓库(排除源仓库)
--all - 否则,询问用户要目标哪些仓库
Step 3: Determine sync strategy by tier
步骤3:按类别确定同步策略
Wholesale: Copy file verbatim to targets.
Parameterized: Copy file but preserve known variation points:
- : preserve
auto-merge-image-updater.ymlvalueBRANCH_PREFIX - : preserve extra publish/deploy jobs
release-please.yml
Structural (justfile): Do NOT overwrite. Instead:
- Add missing standard recipe stubs (commented templates)
- Suggest renaming non-conforming recipes
- Preserve all project-specific recipes and recipe bodies
Pattern-based: Only apply general improvements matching the target's stack:
- Pin unpinned base images
- Add missing
.dockerignore - Update SHA-pinned actions
- Do NOT change build args, multi-arch config, or app-specific steps
Reference: Show diff and ask user to confirm each change.
完全同步:将文件完全复制到目标仓库。
参数化同步:复制文件,但保留已知可变点:
- : 保留
auto-merge-image-updater.yml的值BRANCH_PREFIX - : 保留额外的发布/部署任务
release-please.yml
结构同步(justfile):不覆盖现有内容。而是:
- 添加缺失的标准任务存根(带注释的模板)
- 建议重命名不符合规范的任务
- 保留所有项目特定的任务和任务内容
基于模式的同步:仅应用与目标仓库技术栈匹配的通用改进点:
- 固定未固定的基础镜像版本
- 添加缺失的文件
.dockerignore - 更新使用SHA固定版本的Actions
- 不修改构建参数、多架构配置或应用特定步骤
参考同步:显示差异并询问用户确认每个变更。
Step 4: Preview changes (default / --dry-run)
步骤4:预览变更(默认 / --dry-run)
For each target repo, show the unified diff of what would change.
Dry Run: Apply .github/workflows/claude.yml
============================================
repo: OLMap
Status: Will update (sha def456 → abc123)
Diff:
@@ -12,1 +12,1 @@
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
repo: theme-management
Status: Will update (sha def456 → abc123)
Diff: (same as above)
Total: 2 repos would be updated对每个目标仓库,显示将会发生的变更的统一差异。
试运行: 应用.github/workflows/claude.yml
============================================
仓库: OLMap
状态: 将更新(哈希值 def456 → abc123)
差异:
@@ -12,1 +12,1 @@
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
仓库: theme-management
状态: 将更新(哈希值 def456 → abc123)
差异: 与上述相同
总计: 2个仓库将被更新Step 5: Execute changes (--confirm or user approval)
步骤5:执行变更(--confirm或用户明确批准)
For each target repo:
- Create a branch:
config-sync/<filename-slug> - Copy/update the file
- Commit with conventional message:
chore: sync <filename> from <source-repo> - Push and create PR via
gh pr create
bash
cd /Users/lgates/repos/ForumViriumHelsinki/<target-repo>
git checkout -b config-sync/claude-yml对每个目标仓库:
- 创建分支:
config-sync/<filename-slug> - 复制/更新文件
- 使用约定式提交信息提交:
chore: sync <filename> from <source-repo> - 推送并通过创建PR
gh pr create
bash
cd /Users/lgates/repos/ForumViriumHelsinki/<target-repo>
git checkout -b config-sync/claude-yml... apply changes ...
... 应用变更 ...
git add <file>
git commit -m "chore: sync claude.yml from canonical
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com"
git push -u origin config-sync/claude-yml
gh pr create --title "chore: sync claude.yml" --body "$(cat <<'EOF'
git add <file>
git commit -m "chore: sync claude.yml from canonical
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com"
git push -u origin config-sync/claude-yml
gh pr create --title "chore: sync claude.yml" --body "$(cat <<'EOF'
Summary
摘要
- Synced to match canonical version
.github/workflows/claude.yml - Source: most common version across 18 repos
- 同步以匹配标准版本
.github/workflows/claude.yml - 来源: 18个仓库中最常见的版本
Changes
变更内容
<inline diff>
🤖 Generated with Claude Code
EOF
)"
Report results:
Apply Results:
OLMap: PR #42 created — https://github.com/ForumViriumHelsinki/OLMap/pull/42
theme-management: PR #15 created — https://github.com/ForumViriumHelsinki/theme-management/pull/15
undefined<inline diff>
🤖 由Claude Code生成
EOF
)"
报告结果:
应用结果:
OLMap: PR #42已创建 — https://github.com/ForumViriumHelsinki/OLMap/pull/42
theme-management: PR #15已创建 — https://github.com/ForumViriumHelsinki/theme-management/pull/15
undefinedAgentic Optimizations
Agent优化示例
| Context | Command |
|---|---|
| Quick workflow comparison | |
| Find improvements in a repo | |
| Propagate renovate config | |
| Preview changes only | |
| Create PRs | |
| 场景 | 命令 |
|---|---|
| 快速对比工作流 | |
| 查找仓库中的改进点 | |
| 传播renovate配置 | |
| 仅预览变更 | |
| 创建PR | |
Safety
安全机制
- Dry-run by default: only shows diffs unless
applyis passed or user explicitly approves--confirm - Never overwrites justfile recipe bodies: Only adds stubs and suggests renames
- Stack-aware Dockerfile sync: Only applies improvements matching the target's tech stack
- Preserves parameterized variation points: Known customizations are not overwritten
- 默认试运行: 模式仅显示差异,除非传递
apply或用户明确批准--confirm - 永不覆盖justfile任务内容: 仅添加存根并建议重命名
- 感知技术栈的Dockerfile同步: 仅应用与目标仓库技术栈匹配的改进点
- 保留参数化可变点: 已知的自定义配置不会被覆盖
See Also
相关功能
- — Single-repo workflow compliance
/configure:workflows - — Install reusable workflow patterns
/configure:reusable-workflows - — Single-repo justfile compliance
/configure:justfile - — Single-repo Dockerfile compliance
/configure:dockerfile - — Run all compliance checks on current repo
/configure:all
- — 单个仓库的工作流合规性检查
/configure:workflows - — 安装可复用工作流模式
/configure:reusable-workflows - — 单个仓库的justfile合规性检查
/configure:justfile - — 单个仓库的Dockerfile合规性检查
/configure:dockerfile - — 对当前仓库运行所有合规性检查
/configure:all