Operations
Version Synchronization System
The version synchronization system ensures that all live version references remain consistent with dotfiles_version in defaults/.chezmoidata.toml. That manifest is the only hand-edited source; package.json, CLI metadata, discovery cards, and current documentation are generated release surfaces.
Overview
Problem Statement
Large repositories often have version numbers scattered across multiple files:
- README badges
- Documentation headers
- Feature version stamps
- Configuration files
Manually keeping these synchronized is error-prone and time-consuming.
Solution Architecture
This system provides automated version synchronization through:
- CI/CD Workflow (
.github/workflows/sync-versions.yml) - Automated synchronization on version changes - Local Script (
scripts/version-sync.sh) - Manual synchronization and verification - Verification System - Ensures all references remain consistent
Components
1. GitHub Actions Workflow
Location: .github/workflows/sync-versions.yml
Triggers:
- Push to
mainor a release branch when the canonical manifest changes - Pull requests affecting the canonical manifest or a generated surface
- Manual dispatch with optional target version
Process:
- Read Canonical Version - Reads
dotfiles_versionfrom.chezmoidata.toml - Sync Versions - Updates all markdown files with version references
- Verify Consistency - Ensures all references match target version
- Commit & Push - Automatically commits changes (except on PRs)
Features:
- Backup creation before changes
- Comprehensive change reporting
- PR comment integration
- Artifact preservation for rollback
2. Local Synchronization Script
Location: scripts/version-sync.sh
Usage:
# Sync to the canonical dotfiles_version
# Sync to specific version
# Preview changes without applying
# Verify current consistency
Options:
--dry-run- Preview changes without applying--verify- Check version consistency only--backup/--no-backup- Control backup creation--force- Force sync even if no changes detected
3. Version Patterns
The system recognizes and updates these patterns:
README.md
Documentation Files
Integration Points
CI/CD Pipeline Integration
The workflow integrates with the existing CI pipeline:
# Existing CI workflow can depend on version sync
needs:
Git Hooks Integration
For local development, add to .git/hooks/pre-commit:
#!/bin/bash
# Check version consistency before commits
|| {
}
Canonical Manifest Integration
Change the version explicitly through the synchronizer; it updates the canonical manifest and regenerates package.json in the same operation:
Workflow Examples
Scenario 1: Version Bump
# Developer updates the canonical manifest and all generated surfaces
# Push to main
# GitHub Actions automatically:
# 1. Detects version change
# 2. Updates all markdown files
# 3. Commits and pushes changes
# 4. Verifies consistency
Scenario 2: PR Review
# PR with version-surface changes
# GitHub Actions automatically:
# 1. Checks version consistency
# 2. Reports any mismatches
# 3. Comments on PR with sync status
# 4. Provides diff preview
Scenario 3: Manual Sync
# Local development
File Detection Logic
Automatic Discovery
The system automatically discovers files containing version references:
Known Files
These files are always included even if they don't currently contain versions:
README.mddocs/reference/FEATURES.md- Any file matching version patterns
Exclusions
Files that are intentionally excluded:
CHANGELOG.md- May contain historical versionspackage.json- Generated package-registry metadatadocs/security/COMPLIANCE.md- Includes external compliance spec versionsdocs/reference/FONTS.md- Includes upstream font release versionsdocs/archive/LEGACY_ROADMAP.md- Keeps historical release markersdocs/archive/PLAN.md- Captures multi-release planning referencesdocs/operations/VERSION_SYNC.md- Documentation examples and usagedocs/architecture/WALKTHROUGH.md- Contains environment-specific tag examplesdocs/guides/WSL2_NIX_TROUBLESHOOTING.md- Contains IP addresses and version-like values- Binary files
- Test fixtures
Error Handling
Common Issues
Version Mismatch
❌ Found inconsistent release in docs/reference/FEATURES.md: vX.Y.Z (expected: vA.B.C)
Solution: Run ./scripts/version-sync.sh to fix
Missing Dependencies
❌ jq is required but not installed
Solution: Install dependencies (jq, rg)
Permission Issues
❌ Permission denied writing to README.md
Solution: Check file permissions and Git status
Recovery Procedures
Rollback Changes
# Restore from backup
# Or restore from Git
Force Resync
Monitoring & Maintenance
Health Checks
# Daily verification (add to cron)
||
Metrics Tracking
The GitHub Actions workflow provides metrics:
- Files scanned
- Files updated
- Verification status
- Processing time
Backup Strategy
- Local backups in
.version-sync-backup/ - GitHub Actions artifacts (30-day retention)
- Git history for rollback
Security Considerations
Token Permissions
permissions:
contents: write # Required for commits
pull-requests: write # Required for PR comments
Validation
- Version format validation (
x.y.zpattern) - File path validation (no directory traversal)
- Change verification before commit
Audit Trail
- All changes logged in Git history
- GitHub Actions run history
- Backup preservation
Performance Optimization
Caching Strategy
- Git operations use shallow fetch when possible
- Pattern compilation cached
- File discovery optimized with
ripgrep
Parallel Processing
- File processing is sequential but optimized
- Git operations batched
- Verification runs concurrently with updates
Resource Usage
- Typical run time: 30-60 seconds
- Memory usage: <100MB
- Network usage: Minimal (only Git operations)
Future Enhancements
Planned Features
- Smart Version Detection - Semantic version awareness
- Template Support - Custom version patterns
- Multi-Format Support - YAML, JSON, TOML files
- Rollback Automation - One-command rollback
- Integration Testing - End-to-end workflow tests
Extension Points
- Custom pattern definitions
- File-specific update rules
- Pre/post-sync hooks
- External validation services
Troubleshooting
Debug Mode
# Enable verbose output
DEBUG=1
Common Solutions
| Issue | Solution |
|---|---|
| Script not executable | chmod +x scripts/version-sync.sh |
| Missing tools | apt install jq ripgrep (Ubuntu) |
| Permission denied | Check Git status and file permissions |
| Workflow not triggering | Verify the canonical manifest change is in the push |
| Changes not committed | Check branch protection rules |
Log Analysis
# View GitHub Actions logs
Contributing
Testing Changes
# Test local changes
# Test workflow changes (requires GitHub CLI)
Adding New Patterns
- Update pattern regex in script
- Add test cases
- Update documentation
- Submit PR with examples
Last Updated: 2026-02-15 Version: v0.2.503 Maintainer: Principal Automation Engineer Status: Production Ready ✅