From 9d171e6b30a589240a16d8fef15e2195189e52a9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 9 Jul 2025 12:40:16 +0300 Subject: docs: add documentation for --batch-run feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Document the --batch-run flag in usage section - Add to features list - Include detailed example workflow for cron automation - Explain weekly timer and state file behavior 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 791c132..1f5d6d0 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ GitSyncer is a tool for synchronizing git repositories between multiple organiza - GitHub token validation tool - Opt-in backup mode with --backup flag for resilient offline backups - AI-powered project showcase generation for documentation +- Weekly batch run mode with --batch-run for automated synchronization ## Installation @@ -111,6 +112,16 @@ Create a `gitsyncer.json` file: ./gitsyncer --full --dry-run ``` +### Automated weekly batch run +```bash +# Run full sync with showcase generation, but only once per week +# This enables --full and --showcase with a weekly timer +./gitsyncer --batch-run + +# The batch run state is saved to {workDir}/.gitsyncer-state.json +# Subsequent runs within 7 days will be skipped +``` + ### List configured organizations ```bash ./gitsyncer --list-orgs @@ -296,6 +307,27 @@ Projects can be excluded from the showcase by creating a `.nosync` file in their ## Example Workflows +### Automated weekly synchronization +The `--batch-run` feature is designed for automated weekly synchronization from cron jobs or shell scripts: + +1. Add to your crontab or shell profile: + ```bash + # Run daily - gitsyncer will only execute once per week + 0 2 * * * /path/to/gitsyncer --batch-run + ``` + +2. On each run, GitSyncer will: + - Check if a week has passed since the last batch run + - If yes: Execute full sync (--full) and showcase generation (--showcase) + - If no: Skip execution and show when the last run occurred + - Save the timestamp to `.gitsyncer-state.json` in your work directory + +3. Benefits: + - Prevents excessive API usage + - Can be safely called daily/hourly without worry + - Maintains weekly sync cadence automatically + - Shows state file location for debugging + ### Sync specific repositories 1. Create repositories on all platforms (GitHub, Codeberg, etc.) 2. Add the repository name to your `gitsyncer.json` -- cgit v1.2.3