CI/CD Integration
CI/CD Integration
Section titled “CI/CD Integration”This guide shows how to integrate coding standards into your continuous integration and deployment workflow so that standards drift is caught automatically.
How Standards Stay Current
Section titled “How Standards Stay Current”Three layers keep your project in sync:
- Git hooks – detect updates after every pull or merge.
- Sync scripts – manually or programmatically update all agent configs.
- CI/CD checks – block pull requests when standards are out of date.
Standards Check in CI
Section titled “Standards Check in CI”Add a job that fails when the standards submodule is behind the remote:
name: Check Standards
on: [push, pull_request]
jobs: check-standards: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true
- name: Check standards are up to date run: make check-standardsmake check-standards compares the local submodule commit with origin/main. If they differ, the step exits with a non-zero code and the workflow fails.
Agent Config Drift Check
Section titled “Agent Config Drift Check”The submodule can be current while a generated agent config (CLAUDE.md, AGENTS.md, .cursorrules, …) has drifted from what the standards would assemble. diff-standards.sh --exit-code catches that: it exits 1 when any declared agent’s assembled config would change or be created, and prints the exact command to fix it. Content below the BEGIN PROJECT-SPECIFIC marker is yours and never counts as drift. Auxiliary files that sync copies verbatim (.aiderrc, .gemini/settings.json, .claude/settings.json, Cursor commands) are outside the gate.
- name: Agent configs match the standards run: ./.standards/scripts/diff-standards.sh --exit-codeRun it from the project root (never make -C .standards ...); the script refuses to run when the project root resolves to .standards/.
Scheduled Auto-Update
Section titled “Scheduled Auto-Update”Create a workflow that opens a commit (or a pull request) when new standards are available:
name: Update Standards
on: schedule: - cron: '0 0 * * 1' # Every Monday at midnight UTC workflow_dispatch:
jobs: update: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: true
- name: Update standards submodule run: | cd .standards git pull origin main cd .. git add .standards git commit -m "chore: update standards submodule" || exit 0 git pushGit Hooks
Section titled “Git Hooks”The scripts/setup.sh script installs a post-merge hook that runs after every git pull or git merge. The hook fetches from the standards remote and prints a notice if newer commits exist. It does not pull or sync; you run the sync.
# Installed at .git/hooks/post-merge#!/bin/bashif [ -d ".standards" ]; then cd .standards git fetch origin >/dev/null 2>&1 LOCAL=$(git rev-parse HEAD) REMOTE=$(git rev-parse origin/main 2>/dev/null || git rev-parse origin/master 2>/dev/null) if [ "$LOCAL" != "$REMOTE" ] && [ -n "$REMOTE" ]; then echo "📋 Standards repository has updates. Run: ./.standards/scripts/sync-standards.sh" fifiCommit Message Hooks (Conventional Commits)
Section titled “Commit Message Hooks (Conventional Commits)”Branch commits are validated locally by a commit-msg hook. The standards repo
ships templates for the two common hook managers; setup.sh prints the install
commands but never installs a hook manager for you:
# husky (v9+)npx husky init # once, if .husky/ does not exist yetcp .standards/templates/husky-commit-msg.example .husky/commit-msgchmod +x .husky/commit-msg
# lefthookcp .standards/templates/lefthook.yml.example lefthook.yml # or merge the blocks into yourslefthook installBoth call .standards/scripts/check-commit-message.sh --file <msg>, which
enforces <type>(<scope>): <subject> plus the optional commits.scopes
allow-list from .standards.yml. make doctor recognises lefthook.yml and
.husky/ as hook managers and warns when no commit-msg hook is configured.
Because lefthook and husky take over core.hooksPath, the native
.git/hooks/post-merge reminder above stops running once they are installed —
the lefthook template includes a post-merge block that restores it.
The same applies to the pre-commit worktree guard
(templates/pre-commit-worktree-guard.example), which refuses a commit that
stages a path under the agent worktree root (worktree_dir: in
.standards.yml, default .claude/worktrees) — the way a worktree ends up
committed as a submodule. setup.sh installs it as .git/hooks/pre-commit
when no pre-commit hook exists; the lefthook template carries a pre-commit
block for it, and husky users append
sh .standards/templates/pre-commit-worktree-guard.example to
.husky/pre-commit.
PR Title Check
Section titled “PR Title Check”With squash-merge, GitHub writes the PR title as the mainline commit
subject, so hooks on branch commits do not protect history. The
standards-review action checks the PR title on every pull request and fails
by default:
- name: Run standards review uses: ./.standards/.github/actions/standards-review with: pr-title-check: fail # fail (default) | warn | offThe same action also narrows the conventional-commits lint module to the
PR’s own commits (origin/<base>..HEAD) unless .standards.yml sets
commits.since; a configured commits.window applies only when no range is
available, so it never widens a PR check to unrelated mainline history.
Monorepos
Section titled “Monorepos”One run of the action covers the whole repository: lint-standards.sh
iterates the root plus every member (members: in the root .standards.yml,
or auto-discovered */.standards.yml) and aggregates the results, so a
workflow no longer needs one linter invocation per sub-root. The PR comment
names the members and prefixes each member’s checks with its path
(server: python/banned-functions). With changed-only: true the changed-file
scope is re-based onto each member. See
Monorepos: Members.
Manual Sync
Section titled “Manual Sync”Run the sync script at any time to pull the latest standards and update all agent configuration files:
make sync-standards# or.standards/scripts/sync-standards.shAfter syncing, restart your editor to pick up the new configuration.
Update Flow
Section titled “Update Flow”Standards Repository (new commit pushed) | vProject Repositories | +-- Git hook detects update --> prints reminder +-- CI/CD job checks --> fails PR if outdated +-- Manual sync --> make sync-standards +-- Scheduled workflow --> auto-updates weekly | vAgent config files updated (.cursorrules, .aiderrc, etc.) | vRestart editor --> new rules activeBest Practices
Section titled “Best Practices”- Check on every PR. A failing standards check is the easiest way to prevent drift.
- Pin to versions in production projects. Use
git checkout v1.x.xinside the submodule so updates are intentional. - Automate notifications. Post in Slack or Discord when the scheduled update workflow pushes a new commit.
- Test first. Try new standards in a test project before rolling them out to all repositories.