Skip to content

feat: expand sync FILE_MAP to include all Claude Code agents and hooks #84

Description

@wcmchenry3-stack

Context

sync-community-health.yml currently syncs only 2 Claude Code files to org repos:

  • .claude/hooks/lint-on-edit.sh
  • .claude/agents/plan-issues.md

This leaves the PR-gate hooks and the corresponding fix agents unsynced. Org repos can run gh pr create without any lint or policy check firing, defeating the entire gate system.

What's missing from the sync:

Source (meta-repo) Destination (target repos) Purpose
.claude/hooks/lint-gate.sh .claude/hooks/lint-gate.sh Blocks gh pr create if lint fails
.claude/hooks/policy-gate.sh .claude/hooks/policy-gate.sh Blocks gh pr create if policy patterns detected
.claude/agents/lint-review.md .claude/agents/lint-review.md Auto-fix agent for lint failures
.claude/agents/policy-compliance.md .claude/agents/policy-compliance.md Auto-fix agent for policy violations
community-health/CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md (after issue #79)
community-health/CONTRIBUTING.md CONTRIBUTING.md (after issue #80)
community-health/SUPPORT.md SUPPORT.md (after issue #81)

Also missing: PreToolUse hook sync

The settings.json merge in sync-community-health.yml currently only merges the PostToolUse block (the lint-on-edit hook). It does not merge PreToolUse (the lint-gate and policy-gate hooks). The merge logic must be extended to include PreToolUse.

Implementation

1. Add to FILE_MAP in sync-community-health.yml

- src: .claude/hooks/lint-gate.sh
  dst: .claude/hooks/lint-gate.sh
  mode: "0755"
- src: .claude/hooks/policy-gate.sh
  dst: .claude/hooks/policy-gate.sh
  mode: "0755"
- src: .claude/agents/lint-review.md
  dst: .claude/agents/lint-review.md
- src: .claude/agents/policy-compliance.md
  dst: .claude/agents/policy-compliance.md
- src: community-health/CODE_OF_CONDUCT.md
  dst: CODE_OF_CONDUCT.md
- src: community-health/CONTRIBUTING.md
  dst: CONTRIBUTING.md
- src: community-health/SUPPORT.md
  dst: SUPPORT.md

2. Extend settings.json merge to include PreToolUse

The current merge logic reads the target repo's settings.json, merges in PostToolUse hooks from the meta-repo template, and writes back. Extend this to also merge the PreToolUse block:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/lint-gate.sh"
          }
        ]
      }
    ],
    "PostToolUse": [ ... existing lint-on-edit logic ... ]
  }
}

3. Update PR body string

Update the PR body generated by the sync workflow to list all newly synced files.

Acceptance Criteria

Dependencies

None for the hook/agent sync — can be done immediately.
Community health FILE_MAP entries require #79, #80, #81 to be merged first.

Issue #84 (make repo private) is blocked until this issue is complete.

Part of Epic

#77

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-agentsClaude sub-agent related workenhancementNew feature or requestinfrastructureCI/CD and tooling improvementspriority:highHigh priority - implement firstrepo:allApplies to all repos in org

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions