From 01812ec1851e5c3d92a9049a41b7da4adbfbcb5d Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sat, 11 Apr 2026 11:37:27 -0400 Subject: [PATCH] fix(sync): skip OpenClaw variant branch when variants/open is absent (#222) Makes the `variants/open/` sync steps in `scripts/sync.sh` conditional on the directory actually existing in the source tree. The script is shared between the public and private repos of last30days-skill, but the OpenClaw variant only lives in the private repo (it's sanitized via `strip_for_openclaw.py` and published separately to ClawhHub). When the script runs from a checkout of the public repo, the variants/open paths don't exist and the unconditional `rsync` and `sync_target` calls error out immediately. Changes: - `sync_target()` now only creates `variants/open/references` and rsyncs `variants/open/` when `$SRC/variants/open` exists. - The trailing `sync_target "$OPENCLAW_TARGET" ...` call is now gated by the same check, with an explanatory skip message when the directory is absent. No behavior change when running from the private repo (which has `variants/open/`). When running from the public repo, the script now completes its COMMON_TARGETS loop without erroring. This also closes out the confusion from PR #211, where a contributor saw the broken `variants/open/` reference and tried to add the variant back to the public repo. The real fix was making the script tolerate the absence, not recreating the directory. Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> --- scripts/sync.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/sync.sh b/scripts/sync.sh index a7f1dde..6199d30 100755 --- a/scripts/sync.sh +++ b/scripts/sync.sh @@ -24,7 +24,7 @@ sync_target() { echo "" echo "--- Syncing to $target ---" - mkdir -p "$target/scripts/lib" "$target/variants/open/references" + mkdir -p "$target/scripts/lib" cp "$skill_md" "$target/SKILL.md" @@ -35,7 +35,13 @@ sync_target() { "$SRC/scripts/store.py" \ "$target/scripts/" rsync -a "$SRC/scripts/lib/"*.py "$target/scripts/lib/" - rsync -a "$SRC/variants/open/" "$target/variants/open/" + + # The OpenClaw variant lives in the private repo only. Skip cleanly when + # running this script from the public repo where variants/open does not exist. + if [ -d "$SRC/variants/open" ]; then + mkdir -p "$target/variants/open/references" + rsync -a "$SRC/variants/open/" "$target/variants/open/" + fi if [ -d "$SRC/scripts/lib/vendor" ]; then rsync -a "$SRC/scripts/lib/vendor" "$target/scripts/lib/" @@ -63,7 +69,16 @@ for t in "${COMMON_TARGETS[@]}"; do sync_target "$t" "$SRC/SKILL.md" done -sync_target "$OPENCLAW_TARGET" "$SRC/variants/open/SKILL.md" +# OpenClaw sync only runs when the private-repo OpenClaw variant is present +# in the source tree. The public repo does not ship variants/open (the variant +# is sanitized via strip_for_openclaw.py and published separately from +# last30days-skill-private). +if [ -d "$SRC/variants/open" ]; then + sync_target "$OPENCLAW_TARGET" "$SRC/variants/open/SKILL.md" +else + echo "" + echo "Skipping OpenClaw target (no variants/open in this repo)" +fi echo "" echo "Sync complete."