feat(config): move sync-branch to config.yaml as source of truth

Previously sync.branch was stored in the database via bd config set.
Now it is in config.yaml (version controlled, shared across clones):

  sync-branch: "beads-sync"

Changes:
- Add sync-branch to .beads/config.yaml
- Update syncbranch.Get() to check config.yaml before database
- Add syncbranch.GetFromYAML() and IsConfigured() for fast checks
- Update hooks to read sync-branch from config.yaml directly
- Update bd doctor to check config.yaml instead of database
- Remove auto-fix (config.yaml changes should be committed)

Precedence: BEADS_SYNC_BRANCH env > config.yaml > database (legacy)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-30 11:15:49 -08:00
parent d02905a4fa
commit 978cb1c31f
8 changed files with 117 additions and 158 deletions

View File

@@ -28,16 +28,17 @@ if [ ! -d .beads ]; then
exit 0
fi
# Check if sync.branch is configured - if so, .beads changes go to a separate
# branch via worktree, not the current branch, so skip the uncommitted check
if command -v bd >/dev/null 2>&1; then
# Use --json to get clean output (human-readable format prints "(not set)")
SYNC_BRANCH=$(bd config get sync.branch --json 2>/dev/null | grep -o '"value": *"[^"]*"' | sed 's/"value": *"\([^"]*\)"/\1/')
if [ -n "$SYNC_BRANCH" ]; then
# sync.branch is configured, skip .beads uncommitted check
# Changes are synced to the separate branch, not this one
exit 0
fi
# Check if sync-branch is configured in config.yaml or env var
# If so, .beads changes go to a separate branch via worktree, not the current branch
SYNC_BRANCH="${BEADS_SYNC_BRANCH:-}"
if [ -z "$SYNC_BRANCH" ] && [ -f .beads/config.yaml ]; then
# Extract sync-branch value from YAML (handles quoted and unquoted values)
SYNC_BRANCH=$(grep -E '^sync-branch:' .beads/config.yaml 2>/dev/null | sed 's/^sync-branch:[[:space:]]*//' | sed 's/^["'"'"']//' | sed 's/["'"'"']$//')
fi
if [ -n "$SYNC_BRANCH" ]; then
# sync-branch is configured, skip .beads uncommitted check
# Changes are synced to the separate branch, not this one
exit 0
fi
# Optionally flush pending bd changes so they surface in JSONL