Commit Graph

4630 Commits

Author SHA1 Message Date
Ryan
ffe0dca2a3 feat(daemon): unify auto-sync config for simpler agent workflows (#904)
* feat(daemon): unify auto-sync config for simpler agent workflows

## Problem

Agents running `bd sync` at session end caused delays in the Claude Code
"event loop", slowing development. The daemon was already auto-exporting
DB→JSONL instantly, but auto-commit and auto-push weren't enabled by
default when sync-branch was configured - requiring manual `bd sync`.

Additionally, having three separate config options (auto-commit, auto-push,
auto-pull) was confusing and could get out of sync.

## Solution

Simplify to two intuitive sync modes:

1. **Read/Write Mode** (`daemon.auto-sync: true` or `BEADS_AUTO_SYNC=true`)
   - Enables auto-commit + auto-push + auto-pull
   - Full bidirectional sync - eliminates need for manual `bd sync`
   - Default when sync-branch is configured

2. **Read-Only Mode** (`daemon.auto-pull: true` or `BEADS_AUTO_PULL=true`)
   - Only receives updates from team
   - Does NOT auto-publish changes
   - Useful for experimental work or manual review before sharing

## Benefits

- **Faster agent workflows**: No more `bd sync` delays at session end
- **Simpler config**: Two modes instead of three separate toggles
- **Backward compatible**: Legacy auto_commit/auto_push settings still work
  (treated as auto-sync=true)
- **Adaptive `bd prime`**: Session close protocol adapts when daemon is
  auto-syncing (shows simplified 4-step git workflow, no `bd sync`)
- **Doctor warnings**: `bd doctor` warns about deprecated legacy config

## Changes

- cmd/bd/daemon.go: Add loadDaemonAutoSettings() with unified config logic
- cmd/bd/doctor.go: Add CheckLegacyDaemonConfig call
- cmd/bd/doctor/daemon.go: Add CheckDaemonAutoSync, CheckLegacyDaemonConfig
- cmd/bd/init_team.go: Use daemon.auto-sync in team wizard
- cmd/bd/prime.go: Detect daemon auto-sync, adapt session close protocol
- cmd/bd/prime_test.go: Add stubIsDaemonAutoSyncing for testing

* docs: add comprehensive daemon technical analysis

Add daemon-summary.md documenting the beads daemon architecture,
memory analysis (explaining the 30-35MB footprint), platform support
comparison, historical problems and fixes, and architectural guidance
for other projects implementing similar daemon patterns.

Key sections:
- Architecture deep dive with component diagrams
- Memory breakdown (SQLite WASM runtime is the main contributor)
- Platform support matrix (macOS/Linux full, Windows partial)
- Historical bugs and their fixes with reusable patterns
- Analysis of daemon usefulness without database (verdict: low value)
- Expert-reviewed improvement proposals (3 recommended, 3 skipped)
- Technical design patterns for other implementations

* feat: add cross-platform CI matrix and dual-mode test framework

Cross-Platform CI:
- Add Windows, macOS, Linux matrix to catch platform-specific bugs
- Linux: full tests with race detector and coverage
- macOS: full tests with race detector
- Windows: full tests without race detector (performance)
- Catches bugs like GH#880 (macOS path casing) and GH#387 (Windows daemon)

Dual-Mode Test Framework (cmd/bd/dual_mode_test.go):
- Runs tests in both direct mode and daemon mode
- Prevents recurring bug pattern (GH#719, GH#751, bd-fu83)
- Provides DualModeTestEnv with helper methods for common operations
- Includes 5 example tests demonstrating the pattern

Documentation:
- Add dual-mode testing section to CONTRIBUTING.md
- Document RunDualModeTest API and available helpers

Test Fixes:
- Fix sync_local_only_test.go gitPull/gitPush calls
- Add gate_no_daemon_test.go for beads-70c4 investigation

* fix(test): isolate TestFindBeadsDir tests with BEADS_DIR env var

The tests were finding the real project's .beads directory instead of
the temp directory because FindBeadsDir() walks up the directory tree.
Using BEADS_DIR env var provides proper test isolation.

* fix(test): stop daemon before running test suite guard

The test suite guard checks that tests don't modify the real repo's .beads
directory. However, a background daemon running auto-sync would touch
issues.jsonl during test execution, causing false positives.

Changes:
- Set BEADS_NO_DAEMON=1 to prevent daemon auto-start from tests
- Stop any running daemon for the repo before taking the "before" snapshot
- Uses exec to call `bd daemon --stop` to avoid import cycle issues

* chore: revert .beads/issues.jsonl to upstream/main

Per CONTRIBUTING.md, .beads/issues.jsonl should not be modified in PRs.
2026-01-06 12:52:19 -08:00
beads/crew/fang
7b0f398f11 fix(lint): address gosec, misspell, and unparam warnings
- gate.go: fix "cancelled" → "canceled" misspelling, add #nosec for
  validated GitHub IDs in exec.Command, mark checkTimer escalated as
  intentionally false, rename unused ctx param
- sync_divergence.go: add #nosec for git commands with validated paths,
  mark unused path param
- sync_branch.go: add #nosec for .git/info/exclude permissions
- setup.go: add #nosec for config file permissions
- recipes.go: add #nosec for validated config file paths
- external_deps.go: add #nosec for SQL with generated placeholders

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 22:06:52 -08:00
giles
ee179f5b6d feat(doctor): add deep integration check for pre-commit framework (bd-28r5)
Add config parsing for .pre-commit-config.yaml to detect if bd hooks are
configured. pre-commit is popular enough to warrant full support alongside
lefthook and husky.

Changes:
- Add CheckPrecommitBdIntegration() function to parse YAML config
- Check hooks.*.entry field for 'bd hooks run' pattern
- Handle stages field to determine which git hooks are configured
- Support legacy stage names (commit -> pre-commit, push -> pre-push)
- Add pre-commit to checkManagerBdIntegration switch statement
- Add comprehensive tests for all scenarios

Now supported managers with deep integration checks:
- lefthook (YAML, TOML, JSON)
- husky (.husky/ scripts)
- pre-commit (.pre-commit-config.yaml)

Detection-only managers (cannot verify config):
- overcommit, yorkie, simple-git-hooks

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 21:09:36 -08:00
giles
41d1e5b1de fix(doctor): improve messaging for detection-only hook managers (bd-par1)
When bd doctor detects hook managers we can't fully check (pre-commit,
overcommit, yorkie, simple-git-hooks), it now shows an informational
message instead of a warning:

  ✓ pre-commit detected (cannot verify bd integration)
    └─ Ensure your hook config calls 'bd hooks run <hook>'

Previously it incorrectly warned that these managers were "not calling bd"
when we simply couldn't verify their config.

Changes:
- Add DetectionOnly field to HookIntegrationStatus
- Set DetectionOnly=true for unsupported managers in CheckExternalHookManagerIntegration
- Update CheckGitHooks and CheckSyncBranchHookCompatibility to show
  informational message for detection-only managers
- Add test coverage for DetectionOnly behavior

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 21:05:56 -08:00
emma
1c8a88447b fix(npm): android only supports arm64 in goreleaser
The test incorrectly listed x64 as a supported arch for android, but
goreleaser only builds arm64 for android/termux.
2026-01-05 20:06:51 -08:00
Ariff Azman
2a579a539b feat: add native Android/Termux binary support (#887)
feat: added android support for running with termux

Adds GOOS=android arm64 build to goreleaser and platform detection in npm postinstall.

Tested by contributor on Termux where os.platform() returns 'android' and Linux binaries fail due to bionic vs glibc.
2026-01-05 20:06:25 -08:00
beads/crew/wolf
a61cbde692 fix(sync): handle .beads/redirect in git status checks (bd-arjb)
When running from a crew directory with .beads/redirect pointing to a shared
beads directory in another repo, git status commands would fail with:
  fatal: /path/to/mayor/rig/.beads: is outside repository

The fix detects when beadsDir is redirected and runs git commands from the
directory containing the actual .beads/ using git -C <targetRepoDir>.

Updated functions:
- gitHasBeadsChanges(): checks redirect and runs git from target repo
- gitHasUncommittedBeadsChanges(): same fix for pre-flight check

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 19:57:19 -08:00
Roelof Blom
ffd2e2273c feat(doctor): detect external hook managers and check bd integration (#908)
Add detection for external git hook managers (lefthook, husky, pre-commit,
overcommit, yorkie, simple-git-hooks) and check if they have bd hooks
integration configured.

- Detect manager config files in various locations/formats
- Parse lefthook YAML/TOML/JSON to check for `bd hooks run` commands
- Check husky hook scripts for bd integration
- Report which hooks have bd integration vs missing
- Use --chain flag in `bd doctor --fix` when external managers detected
- Detect active manager from git hooks when multiple present

Executed-By: mayor
Role: mayor
2026-01-05 19:12:14 -08:00
greghughespdx
e212683103 fix(update): add prefix routing like bd show (bd-618f) (#905)
bd update now uses resolveAndGetIssueWithRouting in direct mode,
matching bd show's prefix routing behavior. This enables cross-rig
issue updates from any directory using prefix-based routing.

Changes:
- Use resolveAndGetIssueWithRouting for ID resolution with routing
- Iterate over original args instead of pre-resolved IDs
- Use routed store (issueStore) and resolved ID throughout
- Remove early ID resolution that was blocking routing in direct mode
- Add proper result.Close() calls for resource cleanup

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 19:12:02 -08:00
Peter Chanthamynavong
e7d543af55 fix(sync): persist sync branch to yaml and database (GH#909) (#910)
Problem:
- Sync branch configuration was not consistently saved across storage types
- State divergence between database and config.yaml files

Solution:
- Update Set to write configuration to both yaml and database backends
- Add regression test for yaml configuration persistence

Impact:
- Guarantees configuration consistency across system reboots
- Prevents sync settings from being lost when reading from yaml
2026-01-05 19:11:55 -08:00
aaron-sangster
504e980669 fix(doctor): align duplicate detection with bd duplicates (bd-sali) (#917)
- Exclude closed issues from duplicate detection (previously only excluded tombstones)
- Use full content hash: title + description + design + acceptanceCriteria + status
- Add comprehensive test coverage for duplicate detection edge cases

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 19:11:38 -08:00
aaron-sangster
b86ce0a7e0 fix(doctor): query metadata table instead of config for last_import_time (#916)
The sync_divergence check was querying the wrong table. The sync code
writes last_import_time to the metadata table, but doctor was looking
in config. This caused spurious "No last_import_time recorded" warnings
even when sync was working correctly.

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 19:11:17 -08:00
emma
7db052a48e fix(formula): add phase=vapor to beads-release (gt-mjsjv)
Prevents accidental 'bd pour' from creating persistent issues.
Vapor formulas should only run via 'gt sling --formula' or 'bd mol wisp'.
2026-01-05 00:03:57 -08:00
fang
0caf648487 feat: add --filter-parent as alias for --parent in bd list (bd-3p4u) 2026-01-04 23:51:02 -08:00
emma
9b84ef73dd fix(sync): atomic export and force-push detection (bd-3bhl, bd-4hh5)
bd-3bhl: Add sync rollback on git commit failure
- Use exportToJSONLDeferred() instead of exportToJSONL() for atomic sync
- Call finalizeExport() only after git commit succeeds
- Rollback JSONL from git HEAD on commit failure
- Add rollbackJSONLFromGit() helper function
- Coverage: regular commit, sync branch, external beads repo paths

bd-4hh5: Fix false-positive force-push detection
- Use explicit refspec in CheckForcePush fetch
- +refs/heads/beads-sync:refs/remotes/origin/beads-sync
- Ensures tracking ref is always created/updated
- Fixes stale ref comparison causing false positives

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 23:14:11 -08:00
dave
d7221f6858 chore: Bump version to 0.44.0
Executed-By: beads/crew/dave
Rig: beads
Role: crew
2026-01-04 23:08:58 -08:00
dave
6730fce9b1 feat(setup): refactor to recipe-based architecture (bd-i3ed)
Replace tool-specific setup commands with a generic recipe-based system.
New tools become config entries, not code changes.

Changes:
- Add internal/recipes/ package with Recipe type and built-in recipes
- Add --list flag to show available recipes
- Add --print flag to output template to stdout
- Add -o flag to write template to arbitrary path
- Add --add flag to save custom recipes to .beads/recipes.toml
- Add built-in recipes: windsurf, cody, kilocode (new)
- Legacy recipes (cursor, claude, gemini, aider, factory) continue to work

The recipe system enables:
- Adding new tool support without code changes
- User-defined recipes in .beads/recipes.toml
- Shared template across all file-based integrations

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
2026-01-04 21:57:09 -08:00
Jeff McDonald
053d005956 fix(show): display external_ref field in text output (#899)
The external_ref field was stored correctly and visible in --json
output, but missing from the human-readable text display.

Added External Ref line after other metadata fields in both daemon
and direct mode paths. Added tests for external_ref display.
2026-01-04 17:30:04 -08:00
John Hogenmiller
c41d3e2b5e fix: bd ready now shows in_progress issues (#894)
The RPC server's handleReady() was explicitly setting Status to
StatusOpen, which overrode the intended behavior where an empty Status
field matches both 'open' and 'in_progress' issues.

Removed the Status field assignment so it remains empty (zero value),
allowing the SQLite storage layer to correctly return both statuses
as documented in the help text.

Fixes #5aml
2026-01-04 17:29:54 -08:00
beads/crew/wolf
fa5011b669 refactor(dep): extract warnIfCyclesExist helper to reduce duplication
The --blocks flag handler duplicated cycle detection warning logic from
depAddCmd. Extract to a shared helper function.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 16:24:26 -08:00
beads/crew/grip
85ac1e126b fix(nodb): set cmdCtx.StoreActive in initializeNoDbMode (GH#897)
The bug: initializeNoDbMode() was setting the legacy global storeActive
but not cmdCtx.StoreActive. When ensureStoreActive() checked
isStoreActive(), it used cmdCtx.StoreActive (which was false), causing
the JSONL-only mode error even when --no-db was passed.

The fix: Use accessor functions (lockStore, setStore, setStoreActive,
unlockStore) which set both the legacy globals and cmdCtx fields.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 16:24:18 -08:00
amber
659f52d6bd fix(sync): avoid double export when uncommitted JSONL detected (bd-uuo9)
Add alreadyExported flag to skip redundant export. When
gitHasUncommittedBeadsChanges() detects uncommitted changes, we export
at line 175. The flag prevents the normal flow from exporting again
at line 293.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 16:23:48 -08:00
ruby
32aea46ca6 test(sync): add unit tests for gitHasUncommittedBeadsChanges (bd-p7i2)
Extract parseGitStatusForBeadsChanges helper function from
gitHasUncommittedBeadsChanges to enable unit testing without git setup.

Add 14 test cases covering:
- Empty/no changes
- Modified files (staged, unstaged, both)
- Added files (staged, with modifications)
- Untracked files (should return false)
- Deleted files (should return false)
- Renamed/copied files
- Edge cases (short status line)

Part of GH#885 follow-up.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 16:22:20 -08:00
beads/crew/wolf
6202711b5c feat(dep): add --blocks shorthand flag for natural dependency syntax (GH#884)
Adds a --blocks (-b) shorthand flag to bd dep command for natural dependency syntax:
  bd dep bd-xyz --blocks bd-abc  # bd-xyz blocks bd-abc

Equivalent to: bd dep add bd-abc bd-xyz

- Full daemon and direct mode support
- Cycle detection and child-parent anti-pattern checks
- JSON output support

Contributed by: kraitsura
2026-01-04 16:20:45 -08:00
beads/crew/emma
426f67db41 fix(dep): ensure cycle detection runs in daemon mode for --blocks flag
The daemon code path was returning early after adding the dependency,
skipping the cycle detection that runs for direct mode. Restructure
so both paths share the cycle detection and output code.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 16:20:04 -08:00
kraitsura
44626262e2 feat(dep): add --blocks shorthand flag for natural dependency syntax
Agents naturally try to use 'bd dep <blocker> --blocks <blocked>' when
establishing blocking relationships - a desire path revealing intuitive
mental model for how dependencies should work.

When AI agents set up dependency chains, they consistently attempt:
  bd dep conduit-abc --blocks conduit-xyz

This reveals a desire path - the syntax users naturally reach for before
reading documentation. Instead of fighting this intuition, we embrace it.

- Add --blocks (-b) flag to the bd dep command
- Support syntax: bd dep <blocker-id> --blocks <blocked-id>
- Equivalent to: bd dep add <blocked-id> <blocker-id>
- Full daemon and direct mode support
- Cycle detection and child-parent anti-pattern checks
- JSON output support for programmatic use

This is purely additive. The existing command structure remains:
- 'bd dep add' subcommand works exactly as before
- All other dep subcommands (remove, list, tree, cycles) unchanged
- No breaking changes to existing workflows

  bd dep bd-xyz --blocks bd-abc    # bd-xyz blocks bd-abc
  bd dep bd-xyz -b bd-abc          # Same, using shorthand
  bd dep add bd-abc bd-xyz         # Original syntax still works

- Added TestDepBlocksFlag for flag initialization
- Added TestDepBlocksFlagFunctionality for semantic correctness
- All existing tests pass
2026-01-04 16:20:04 -08:00
beads/crew/dave
f92090344a fix: finalize metadata after commit, not after push (GH#885)
In performExport, if git commit succeeded but push failed, the
finalizeExportMetadata() was never called because we returned early.
This meant metadata would not reflect the successful export+commit.

Now finalize is called:
- Right after syncBranchCommitAndPush succeeds
- Right after gitCommit succeeds (before push attempt)
- When no git changes exist (export still happened)

Push failure still returns early, but metadata is already updated.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
2026-01-04 16:16:53 -08:00
beads/crew/emma
a1079fcbe1 fix(git): use case-insensitive path comparison for worktree validation (GH#880)
On macOS with case-insensitive filesystem, path casing differences between
the daemon socket path and git worktree registry caused sync failures.

Changed isValidWorktree() to use utils.PathsEqual() which handles
case-insensitivity on macOS/Windows, matching the fix already applied
to daemon registry in GH#869.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 16:11:37 -08:00
beads/crew/grip
b3ebedb063 fix(init): prevent parent hub contamination during bd init (GH#896)
When running bd init in a subdirectory of a hub (e.g., ~/Repos/project
where ~/Repos/.beads exists), the new database was incorrectly inheriting
issues from the parent hub.

Root cause: checkGitForIssues() computed the relative path from gitRoot
to beadsDir but did not validate that beadsDir was actually inside the
git repository. When beadsDir was outside (e.g., ../.beads), it would
still attempt to import, causing contamination.

Fix: Add a guard to reject beadsDir paths that start with .. (outside
the git repository boundary).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 15:43:57 -08:00
garnet
9d69099803 fix(slot): add cross-beads prefix routing to bd slot set (bd-hmeb)
When setting a slot to a bead from a different beads database
(e.g., setting an hq-* role bead on a gt-* agent bead), the command
now uses prefix-based routing via routes.jsonl to resolve the bead
in the correct database.

Previously, bd slot set only looked in the local database, failing
to find cross-db references like hq-polecat-role from rig beads.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 15:21:36 -08:00
beads/crew/dave
ede940b5d2 fix: defer SQLite metadata updates until after git commit (GH#885)
This fixes the atomicity gap where exportToJSONL would update SQLite
metadata (clear dirty flags, update content hash, last_import_time)
BEFORE the git commit. If git commit failed, SQLite would incorrectly
indicate the sync succeeded.

Changes:
- Add ExportResult struct to capture export metadata for deferred finalization
- Add exportToJSONLDeferred() that exports without updating metadata
- Add finalizeExport() to update metadata after git commit succeeds
- Update daemon_sync.go sync flows to defer metadata updates

Now the sync flow is truly atomic: metadata only updates after git commit.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
2026-01-04 15:16:07 -08:00
beads/crew/wolf
68f5bb24f8 feat(doctor): add sync divergence check for JSONL/SQLite/git (GH#885)
Add CheckSyncDivergence doctor check that detects:
- JSONL on disk differs from git HEAD version
- SQLite last_import_time does not match JSONL mtime
- Uncommitted .beads/ changes exist

Each issue includes auto-fix suggestions (bd sync, bd export, git commit).
Multiple divergence issues result in error status.

Part of GH#885 recovery mechanism.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 15:13:50 -08:00
beads/crew/fang
44a5c3a0ec feat: detect uncommitted JSONL changes before sync (GH#885, bd-vd8e)
Add pre-flight safety check to detect when a previous sync exported
but failed before commit, leaving JSONL in an inconsistent state.

- Add gitHasUncommittedBeadsChanges() helper in sync_git.go
- Call in sync pre-flight checks after merge/rebase check
- If uncommitted changes detected, force re-export to reconcile state

This catches the failure mode early before it compounds across worktrees.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 15:10:47 -08:00
beads/crew/dave
7b90678afe fix: canonicalize path case on macOS for git worktree operations (GH#880)
bd sync fails with exit status 128 when the daemon is started from a
terminal with different path casing than what git has stored. This
happens on macOS case-insensitive filesystem when directory names
are renamed (e.g., MyProject to myproject) but terminal sessions
retain the old casing.

The fix uses realpath(1) on macOS to get the true filesystem case
when canonicalizing paths:
- CanonicalizePath() now calls realpath on macOS
- git.GetRepoRoot() canonicalizes repoRoot via canonicalizeCase()
- syncbranch.GetRepoRoot() uses utils.CanonicalizePath()

This ensures git worktree paths match exactly, preventing the
exit status 128 errors from git operations.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
2026-01-04 13:54:07 -08:00
beads/crew/fang
fbc93e3de2 fix: prevent sparse checkout config from leaking to main repo (GH#886)
Use git sparse-checkout command instead of manually setting
core.sparseCheckout config. The sparse-checkout command properly
scopes the setting to the worktree via extensions.worktreeConfig,
avoiding the confusing sparse checkout message in git status.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 13:52:29 -08:00
topaz
b789b99537 fix(daemon): normalize paths for case-insensitive filesystems (GH#880)
On macOS (HFS+/APFS), `bd sync` would fail with exit status 128 when
the daemon was started from a terminal session with different path
casing than what git had stored for the worktree (e.g., /Users/.../
MyProject vs /Users/.../myproject).

Fixed by normalizing workspace paths using `filepath.EvalSymlinks()`
before storing in the registry and comparing during lookups:

- registry.Register(): Canonicalizes workspace path before storing
- registry.Unregister(): Canonicalizes paths before comparison
- FindDaemonByWorkspace(): Canonicalizes paths before lookup

This ensures consistent path matching across case-insensitive
filesystems since EvalSymlinks returns the actual filesystem casing.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 11:50:46 -08:00
obsidian
1a0ad09e23 fix(doctor): detect status mismatches between DB and JSONL (GH#885)
When bd sync fails mid-operation, the local JSONL can become stale while
the SQLite database has the correct state. Previously, bd doctor only
checked count and timestamp differences, missing cases where counts match
but issue statuses differ.

This adds content-level comparison to CheckDatabaseJSONLSync that:
- Compares issue statuses between DB and JSONL
- Samples up to 500 issues for performance on large databases
- Reports detailed mismatches (shows up to 3 examples)
- Suggests 'bd export' to fix the stale JSONL

Example detection:
  Status mismatch: 1 issue(s) have different status in DB vs JSONL
  Status mismatches detected:
    test-1: DB=closed, JSONL=open

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 11:35:59 -08:00
onyx
5229b3e90d feat(dep): add --blocked-by and --depends-on flag aliases (bd-09kt)
Add flag-based alternatives to the positional argument for `bd dep add`:
- `--blocked-by <id>`: Specify the blocking issue via flag
- `--depends-on <id>`: Alias for --blocked-by

This reduces token waste when Claude guesses flag-based syntax, which
is a common pattern. Previously, Claude would attempt commands like:
  bd dep add issue-123 --blocked-by issue-456

This would fail with "unknown flag" and require retry. Now both:
  bd dep add issue-123 issue-456
  bd dep add issue-123 --blocked-by issue-456

work identically.

Closes GH#888

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 11:34:38 -08:00
quartz
563f7e875d fix(merge): preserve close_reason field during merge/sync (GH#891)
The close_reason and closed_by_session fields were being silently dropped
during 3-way merge operations because the simplified Issue struct in
internal/merge/merge.go was missing these fields.

Changes:
- Add CloseReason and ClosedBySession fields to merge.Issue struct
- Implement merge logic that preserves these fields when status is closed
- Use timestamp-based conflict resolution (later closed_at wins)
- Clear close metadata when status becomes non-closed

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 11:33:32 -08:00
jasper
c848c0fce2 fix(npm): add retry logic for Windows zip extraction
On Windows, the downloaded ZIP file may remain locked by antivirus
software or Node.js file handle release delays. This causes
Expand-Archive to fail with "being used by another process" errors.

Added exponential backoff retry logic (5 attempts, 500ms-8s delays)
that detects file lock errors and retries the extraction. Non-lock
errors still fail immediately.

Fixes GH#889 (bd-5dlz)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 11:28:23 -08:00
beads/crew/grip
df66ecfe9e fix(worktree): disable sparse checkout on main repo after worktree creation (GH#886)
Git 2.38+ enables core.sparseCheckout on the main repo as a side effect
of worktree creation, causing confusing git status message:
"You are in a sparse checkout with 100% of tracked files present."

The fix explicitly disables sparse checkout on the main repo after
creating the beads worktree. This doesn't affect the worktree's sparse
checkout functionality since the patterns are already applied during
checkout.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 11:24:47 -08:00
biantaishabi2
b3d64d47b3 fix: prevent event storm when gitRefsPath is empty (#883)
When gitRefsPath is empty (not in a git repo), strings.HasPrefix(path, "")
always returns true, causing every file write in .beads/ directory
(including daemon.log) to trigger debouncer and create an event storm.

This fix adds a check to ensure gitRefsPath is not empty before the
HasPrefix comparison.

Fixes the issue where daemon.log grows rapidly (17MB+) due to the
self-triggering loop: write log -> detect change -> write log -> ...

Co-authored-by: Test User <test@example.com>
2026-01-04 11:14:36 -08:00
kustrun
28b44edd13 fix(doctor): detect missing git repo and improve daemon startup message (#890)
When not in a git repository:
- Daemon startup now shows clear message immediately instead of waiting
  5 seconds: "Note: No git repository initialized — running without
  background sync"
- Added new doctor check "Git Sync Setup" that explains the situation

Doctor check now shows three states:
1. No git repo → Warning with fix: "Run 'git init' to enable background sync"
2. Git repo, no sync-branch → OK with hint about team collaboration benefits
3. Git repo + sync-branch → OK, fully configured

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 11:13:48 -08:00
web3dev1337
661556ae62 feat: add multi-prefix support via allowed_prefixes config (#881)
feat: add multi-prefix support via allowed_prefixes config

Adds support for allowing multiple prefixes in a beads database via the
allowed_prefixes config key. This is needed for Gas Town which uses different
prefixes for different purposes (hq-, gt-, rig-specific prefixes).

Usage: bd config set allowed_prefixes "gt,hq,hmc"

PR #881 by @web3dev1337
2026-01-04 11:13:44 -08:00
kustrun
16af63dc73 fix(rename-prefix): sync JSONL before and after prefix rename (#893)
- Pull from sync-branch before rename if configured
- Import all issues from JSONL before rename to prevent data loss
- Export directly to JSONL after rename (don't rely on flushManager)
- Apply same pattern to --repair mode
- Add newSilentLogger() for production use (not test-only)
- Add comprehensive tests for JSONL update scenarios

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 10:53:31 -08:00
wolf
9880eaf734 feat(config): support daemon.auto_* settings in config.yaml (GH#871)
Allow team-wide auto-sync configuration via config.yaml instead of SQLite.
This enables teams to share auto-commit/auto-push settings through version control.

Changes:
- Add daemon.auto_commit, daemon.auto_push, daemon.auto_pull to YamlOnlyKeys
- Add daemon.* prefix to YAML-only prefixes
- Update daemon startup to read from config.yaml first, then fall back to SQLite
- Update bd init --team to write daemon settings to config.yaml

Usage:
  # In .beads/config.yaml (version controlled, shared by team)
  daemon.auto_commit: true
  daemon.auto_push: true

  # Or via bd config set
  bd config set daemon.auto_commit true

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 10:42:22 -08:00
emma
4468ff030f feat(sync): add BD_DEBUG_SYNC env for protection debugging
Adds debug logging when timestamp-aware protection triggers, controlled
by BD_DEBUG_SYNC environment variable. Helps diagnose sync issues.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 10:41:57 -08:00
beads/crew/grip
4021f49445 feat(prime): add PRIME.md override for workflow customization (GH#876)
Users can now place a .beads/PRIME.md file to fully customize the
workflow instructions output by `bd prime`. The --export flag outputs
the default content for use as a starting template.

Local .beads/PRIME.md is checked first, then redirected location,
allowing clone-specific customization even with shared beads.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 21:49:40 -08:00
dave
7df6004605 fix: code review improvements for GH#870
Review findings addressed:
1. Fixed HasSyncBranchGitignoreFlags() - now correctly returns (hasAnyFlag,
   hasSkipWorktree) since skip-worktree takes precedence in git ls-files -v
2. Added interactions.jsonl to list of files to hide (was only issues.jsonl)
3. Added idempotency check - skips setting flags if already set (checks for S)
4. Made output conditional - only prints when flags actually changed
5. Fixed addToGitExclude() pattern matching - now uses exact line match
   instead of substring to prevent false positives
6. Refactored to use setGitIndexFlags() helper to reduce duplication

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
2026-01-03 21:19:02 -08:00
matt wilkie
625ac5dff2 Add repository guards to deployment workflows (#877)
- Guard deploy-docs job to only run in canonical repository
- Guard goreleaser job to only run in canonical repository
- Guard update-homebrew job to only run in canonical repository
- Guard test-pypi job to only run in canonical repository

Prevents fork workflows from attempting to deploy, release, or publish to external services.
2026-01-03 21:16:09 -08:00