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 reposConfiguring a single repo's workflow from scratch — use
/configure:workflows
Propagating an improvement from one repo to manyDebugging a failing CI run — use
github-actions-inspection
Identifying which repos have outdated configsCreating a reusable workflow — use
/configure:reusable-workflows
Extracting novel patterns from a repo to shareChecking a single repo's compliance — use
/configure:status
适用场景其他场景(使用其他方法)
在所有FVH仓库之间对比工作流/配置从零开始配置单个仓库的工作流 — 使用
/configure:workflows
将某一个仓库的改进点传播到多个仓库调试失败的CI运行 — 使用
github-actions-inspection
识别哪些仓库的配置已过时创建可复用工作流 — 使用
/configure:reusable-workflows
从某一个仓库提取新颖的配置模式并共享检查单个仓库的合规性 — 使用
/configure:status

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

模式

  1. extract [repo-name]
    — Identify improvements in a source repo
  2. diff <file-pattern>
    — Compare a specific config across all repos
  3. apply <file-pattern> [--from repo] [--to repo1,repo2,...|--all]
    — Propagate config to targets
  1. extract [repo-name]
    — 识别源仓库中的改进点
  2. diff <file-pattern>
    — 在所有仓库之间对比特定配置文件
  3. apply <file-pattern> [--from repo] [--to repo1,repo2,...|--all]
    — 将配置传播到目标仓库

Options

选项

  • --from <repo>
    — Source repo for apply mode (default: best version detected)
  • --to <repo1,repo2,...>
    — Target repos (comma-separated)
  • --all
    — Target all repos that have the file
  • --dry-run
    — Show what would change without creating branches/PRs (default behavior)
  • --confirm
    — Actually create branches and PRs
  • --from <repo>
    — apply模式的源仓库(默认:检测到的最优版本)
  • --to <repo1,repo2,...>
    — 目标仓库(逗号分隔)
  • --all
    — 目标为所有包含该文件的仓库
  • --dry-run
    — 显示将会发生的变更,但不创建分支/PR(默认行为)
  • --confirm
    — 实际创建分支和PR

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 PatternDescription
.github/workflows/claude.yml
Claude Code workflow
renovate.json
Renovate dependency updates
完全复制 — 不期望存在仓库特定的差异。
文件模式描述
.github/workflows/claude.yml
Claude Code工作流
renovate.json
Renovate依赖更新配置

Tier 2: Parameterized (shared core with known variation points)

第二类:参数化同步(共享核心结构,存在已知可变点)

Shared structure with specific fields that vary per repo.
File PatternVariation Points
.github/workflows/auto-merge-image-updater.yml
Branch prefix pattern
.github/workflows/release-please.yml
Publish job, extra steps
.github/workflows/renovate.yml
Standalone (infrastructure) vs reusable caller (all others)
共享结构,但部分字段因仓库而异。
文件模式可变点
.github/workflows/auto-merge-image-updater.yml
分支前缀模式
.github/workflows/release-please.yml
发布任务、额外步骤
.github/workflows/renovate.yml
独立版(基础设施仓库) vs 可复用调用版(其他所有仓库)

Tier 3: Structural (standard skeleton, project-specific bodies)

第三类:结构同步(标准框架,项目特定内容)

Standard recipe/section names must conform; bodies are project-specific.
File PatternConformance Target
justfile
Standard recipe names from justfile-template conventions
标准的任务/章节名称必须符合规范;内容部分为项目特定。
文件模式合规目标
justfile
遵循justfile-template约定的标准任务名称

Tier 4: Pattern-based (categorized by tech stack)

第四类:基于模式的同步(按技术栈分类)

Group by detected stack, extract general best practices only.
File PatternStack Detection
Dockerfile*
package.json
→ Node,
pyproject.toml
→ Python,
go.mod
→ Go,
Cargo.toml
→ Rust
.github/workflows/container-build.yml
Same as Dockerfile
按检测到的技术栈分组,仅提取通用最佳实践。
文件模式技术栈检测依据
Dockerfile*
package.json
→ Node,
pyproject.toml
→ Python,
go.mod
→ Go,
Cargo.toml
→ Rust
.github/workflows/container-build.yml
与Dockerfile检测规则相同

Tier 5: Reference (compare and report, selective apply)

第五类:参考同步(对比并报告,选择性应用)

File PatternNotes
release-please-config.json
Varies by project type
.release-please-manifest.json
Version tracking
skaffold.yaml
Dev environment config
文件模式说明
release-please-config.json
因项目类型而异
.release-please-manifest.json
版本跟踪配置
skaffold.yaml
开发环境配置

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
/Users/lgates/repos/ForumViriumHelsinki/<repo-name>
. Otherwise use the current working directory (must be inside an FVH repo).
如果指定了仓库名称,使用
/Users/lgates/repos/ForumViriumHelsinki/<repo-name>
。 否则使用当前工作目录(必须在FVH仓库内)。

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/*.yml
  • justfile
  • Dockerfile*
  • renovate.json
  • release-please-config.json
  • .release-please-manifest.json
  • skaffold.yaml
扫描所有受跟踪的配置类别:
bash
fd -t f -d 3 '(claude|renovate|auto-merge|release-please|container-build|Dockerfile|justfile|skaffold)' <repo-path>
同时检查:
  • .github/workflows/*.yml
  • justfile
  • Dockerfile*
  • renovate.json
  • release-please-config.json
  • .release-please-manifest.json
  • skaffold.yaml

Step 3: Compare against workspace patterns

步骤3:与工作区内的模式对比

For each file found:
  1. 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.
  2. Parameterized tier: Extract the shared core (strip known variation points) and compare structure.
  3. Structural tier (justfile): Check for standard recipes (
    default
    ,
    help
    ,
    dev
    ,
    build
    ,
    clean
    ,
    lint
    ,
    format
    ,
    format-check
    ,
    test
    ,
    pre-commit
    ,
    ci
    ). Report missing standard recipes and non-standard names (e.g.,
    check
    instead of
    lint
    ).
  4. Pattern-based tier: Detect tech stack, then check for best practices:
    • Pinned base images (not
      latest
      )
    • .dockerignore
      present
    • Multi-stage builds
    • Non-root user
    • SHA-pinned GitHub Actions
    • SBOM/provenance attestation
  5. Reference tier: Note divergences from the most common configuration.
对于每个找到的文件:
  1. 完全同步类:计算文件内容的哈希值,与所有仓库中最常见的版本对比。报告该仓库是否拥有更新/不同的版本。
  2. 参数化同步类:提取共享核心结构(移除已知可变点)并对比结构。
  3. 结构同步类(justfile):检查标准任务是否存在(
    default
    ,
    help
    ,
    dev
    ,
    build
    ,
    clean
    ,
    lint
    ,
    format
    ,
    format-check
    ,
    test
    ,
    pre-commit
    ,
    ci
    )。报告缺失的标准任务和非标准名称(例如用
    check
    代替
    lint
    )。
  4. 基于模式的同步类:检测技术栈,然后检查最佳实践:
    • 固定基础镜像版本(非
      latest
    • 存在
      .dockerignore
      文件
    • 多阶段构建
    • 使用非root用户
    • GitHub Actions使用SHA固定版本
    • SBOM/来源证明
  5. 参考同步类:记录与最常见配置的差异。

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:
    claude.yml
    → search in
    .github/workflows/
  • Glob:
    *.yml
    → match all workflows
解析命令参数中的文件模式:
  • 完整路径:
    .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 4
bash
fd -t f '<pattern>' /Users/lgates/repos/ForumViriumHelsinki --max-depth 4

Step 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:
  1. Most common hash (majority rules)
  2. If tie: most recently modified
  3. If tie: from
    infrastructure
    repo (reference repo)
选择标准版本的启发式规则:
  1. 最常见的哈希值(多数规则)
  2. 若平局:选择最近修改的版本
  3. 若平局:来自
    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
    --from
    specified, use that repo's version
  • Otherwise, run diff mode internally to find the canonical version
  • 如果指定了
    --from
    ,使用该仓库的版本
  • 否则,内部运行diff模式以找到标准版本

Step 2: Determine targets

步骤2:确定目标

  • If
    --to
    specified, use those repos
  • If
    --all
    , use all repos that currently have the file (excluding source)
  • 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:
  • auto-merge-image-updater.yml
    : preserve
    BRANCH_PREFIX
    value
  • release-please.yml
    : preserve extra publish/deploy jobs
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:
  1. Create a branch:
    config-sync/<filename-slug>
  2. Copy/update the file
  3. Commit with conventional message:
    chore: sync <filename> from <source-repo>
  4. Push and create PR via
    gh pr create
bash
cd /Users/lgates/repos/ForumViriumHelsinki/<target-repo>
git checkout -b config-sync/claude-yml
对每个目标仓库:
  1. 创建分支:
    config-sync/<filename-slug>
  2. 复制/更新文件
  3. 使用约定式提交信息提交:
    chore: sync <filename> from <source-repo>
  4. 推送并通过
    gh pr create
    创建PR
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
    .github/workflows/claude.yml
    to match canonical version
  • 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
undefined

Agentic Optimizations

Agent优化示例

ContextCommand
Quick workflow comparison
/configure:config-sync diff claude.yml
Find improvements in a repo
/configure:config-sync extract theme-management
Propagate renovate config
/configure:config-sync apply renovate.json --from infrastructure --all
Preview changes only
/configure:config-sync apply claude.yml --all
(dry-run is default)
Create PRs
/configure:config-sync apply claude.yml --all --confirm
场景命令
快速对比工作流
/configure:config-sync diff claude.yml
查找仓库中的改进点
/configure:config-sync extract theme-management
传播renovate配置
/configure:config-sync apply renovate.json --from infrastructure --all
仅预览变更
/configure:config-sync apply claude.yml --all
(试运行是默认行为)
创建PR
/configure:config-sync apply claude.yml --all --confirm

Safety

安全机制

  • Dry-run by default:
    apply
    only shows diffs unless
    --confirm
    is passed or user explicitly approves
  • 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

相关功能

  • /configure:workflows
    — Single-repo workflow compliance
  • /configure:reusable-workflows
    — Install reusable workflow patterns
  • /configure:justfile
    — Single-repo justfile compliance
  • /configure:dockerfile
    — Single-repo Dockerfile compliance
  • /configure:all
    — Run all compliance checks on current repo
  • /configure:workflows
    — 单个仓库的工作流合规性检查
  • /configure:reusable-workflows
    — 安装可复用工作流模式
  • /configure:justfile
    — 单个仓库的justfile合规性检查
  • /configure:dockerfile
    — 单个仓库的Dockerfile合规性检查
  • /configure:all
    — 对当前仓库运行所有合规性检查