Commit Graph

5464 Commits

Author SHA1 Message Date
obsidian
d9bf159af1 fix(version): remove git subprocess from bd version command (GH#1zonaz)
Some checks failed
CI / Check version consistency (push) Successful in 4s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 8m8s
CI / Lint (push) Failing after 2m39s
CI / Test Nix Flake (push) Failing after 54s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
Under high concurrency (17+ agent sessions), each gt command invokes
bd version to validate minimum beads version. The resolveBranch()
function was spawning git subprocesses (git symbolic-ref) which caused
severe contention and timeouts when many agents ran simultaneously.

Changes:
- Remove git subprocess fallback in resolveBranch()
- Branch info now only comes from ldflags or build info's vcs.branch
- Version number (what gt actually checks) is unaffected
- Update documentation to reflect the change

The fix reduces bd version from potentially 2 git subprocesses to zero,
eliminating the contention issue under high agent concurrency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 10:45:31 -08:00
obsidian
4d5f211601 fix(version): remove git subprocess fallback to prevent contention
Some checks failed
CI / Check version consistency (push) Successful in 5s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 9m13s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
CI / Test Nix Flake (push) Has been cancelled
CI / Lint (push) Has been cancelled
Under high concurrency (17+ sessions), each bd version spawning git
processes causes severe contention and timeouts. Remove the runtime
git symbolic-ref fallback - branch info is nice-to-have but not essential.

Fixes: GH#503

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 10:34:30 -08:00
ruby
a45b441bc5 fix(sqlite): use BEGIN IMMEDIATE without retry loop (GH#1272)
Some checks failed
CI / Check version consistency (push) Successful in 3s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 8m13s
CI / Lint (push) Failing after 3m18s
CI / Test Nix Flake (push) Failing after 1m7s
Nightly Full Tests / Full Test Suite (push) Failing after 36m59s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
The original PR added retry logic on top of BEGIN IMMEDIATE, but this caused
multi-minute hangs because:

1. Connection has busy_timeout=30s set via pragma
2. Each BEGIN IMMEDIATE waits up to 30s before returning SQLITE_BUSY
3. With 5 retries, worst case was 5 × 30s = 150+ seconds

The fix removes the retry loop since SQLite's busy_timeout already handles
retries internally. BEGIN IMMEDIATE still acquires the write lock early,
preventing deadlocks - we just let busy_timeout handle contention.

Root cause analysis in bd-9ldm.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 13:43:31 -08:00
ruby
442ad0f0e5 fix(sqlite): add retry logic to transaction entry points (GH#1272)
Update withTx to use BEGIN IMMEDIATE with exponential backoff retry
on SQLITE_BUSY errors. This prevents "database is locked" failures
during concurrent operations (daemon + CLI, multi-agent workflows).

Changes:
- withTx now uses beginImmediateWithRetry (same pattern as RunInTransaction)
- Add dbExecutor interface for helper functions that work with both
  *sql.Tx and *sql.Conn
- Update all withTx callers to use *sql.Conn
- Refactor DeleteIssue to use withTx (fixes the specific error in auto-import)
- Update markIssuesDirtyTx to accept dbExecutor interface

Affected paths:
- MarkIssuesDirty, ClearDirtyIssuesByID (dirty.go)
- AddDependency, RemoveDependency (dependencies.go)
- executeLabelOperation (labels.go)
- AddComment (events.go)
- ApplyCompaction (compact.go)
- DeleteIssue (queries.go)

Note: Some direct BeginTx calls in queries.go (CloseIssue, UpdateIssue,
ReopenIssue, DeleteIssues) still use the old pattern and could be
refactored in a follow-up.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 13:43:30 -08:00
Steve Yegge
0ee020ed76 feat(dolt): auto-commit write commands and set explicit commit authors (#1270)
Adds Dolt auto-commit functionality for write commands and sets explicit commit authors.

Includes fix for race condition in commandDidWrite (converted to atomic.Bool).

Original PR: #1267 by @coffeegoddd
Co-authored-by: Dustin Brown <dustin@dolthub.com>
2026-01-23 13:43:30 -08:00
scout/crew/picard
9fd0ea2c67 Add bd tree command for context assembly
Some checks failed
CI / Check version consistency (push) Successful in 3s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 8m28s
CI / Lint (push) Failing after 3m15s
CI / Test Nix Flake (push) Failing after 1m0s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
New command showing full context for a bead:
- ANCESTRY: Chain from leaf to epic/goal (upward traversal)
- SIBLINGS: Parallel work under same parent
- DEPENDENCIES: What blocks/is blocked by
- DECISIONS: Key decisions extracted from comments

Output modes:
- Default: Full formatted tree view
- --compact: Single-line summary
- --pr: Copy-paste ready markdown for PR descriptions
- --json: Structured output for scripting

Implements sc-ep0zq.
2026-01-22 18:25:27 -08:00
diesel
2ac04c74a4 feat(epic): add Working Model as required section for epics
Epics now require a "Working Model" section in their description,
in addition to "Success Criteria". This provides clear guidance on
HOW the epic will be executed:

- Owner role: Coordinator vs Implementer
- Delegation target: Polecats, crew, external
- Review process: Approval gates

Closes gt-0lp

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 17:32:38 -08:00
Steve Yegge
1f94b4b363 Newsletter generator: automated narrative summaries of releases
Introduces a newsletter generator script that creates narrative-style summaries.

Original PR: #1198 by @maphew
Closes #1197
2026-01-22 16:09:29 -08:00
aleiby
16749e6731 feat(bd): add --ephemeral and --persistent flags to bd update (#1263)
Adds --ephemeral and --persistent flags to bd update command.

Author: aleiby
2026-01-22 15:54:04 -08:00
groblegark
d037158624 fix(dolt): add lock retry and stale lock cleanup for operational reliability (#1260)
Adds operational improvements to the Dolt storage backend for increased
reliability in production environments with concurrent clients:

1. Lock retry with exponential backoff:
   - Add LockRetries and LockRetryDelay config options
   - Automatic retry on lock contention (default: 30 retries, ~6s window)
   - Exponential backoff starting at 100ms
   - Handles transient format version errors during manifest updates

2. Stale lock file cleanup:
   - Detect and clean orphaned .dolt/noms/LOCK files on startup
   - Prevents "database is read only" errors after crashes
   - Only removes empty locks older than 5 seconds

3. Transient error detection:
   - isTransientDoltError() detects retryable conditions
   - isLockError() identifies lock contention scenarios
   - cleanupStaleDoltLock() safely removes orphaned locks

These improvements address common issues in multi-process environments
where the Dolt embedded driver creates exclusive locks that persist
after unexpected termination.

Co-authored-by: upstream_syncer <matthew.baker@pihealth.ai>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 13:04:56 -08:00
justSteve
244b32b624 Fix PrefixOverride not respected in transaction storage layer (#1257)
When creating issues with explicit IDs via PrefixOverride (for cross-rig
creation), the storage layer was still validating against the local
config prefix, causing errors like:

  issue ID 'da-DataArchive-witness' does not match configured prefix 'hq'

The queries.go layer already handled PrefixOverride correctly, but
transaction.go did not. This fix adds the same PrefixOverride handling
to transaction.go:

1. Check if PrefixOverride is set
2. If set, use it as the prefix and skip validation (caller knows best)
3. Otherwise, fall back to existing IDPrefix/configPrefix logic

This allows gt doctor --fix to create agent beads for non-local rigs.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 13:04:52 -08:00
Aviv Kaplan
a597e013e0 Add beads-kanban-ui and beads-orchestration to Community Tools (#1255)
Web UIs:
- beads-kanban-ui: Visual Kanban board with git branch status tracking,
  epic/subtask management, design doc viewer, and activity timeline.

Claude Code Orchestration (new section):
- beads-orchestration: Multi-agent orchestration skill for Claude Code.
  Orchestrator investigates issues, manages tasks automatically, and
  delegates to tech-specific supervisors on isolated branches.
2026-01-22 13:04:48 -08:00
Cecil Ureña
040839a432 Add abacus to community tools (#1262) 2026-01-22 13:04:32 -08:00
emma
b5178e1895 fix(build): disable CGO for darwin builds in goreleaser
CGO cross-compilation for darwin from Linux CI runner fails without
osxcross. Since Dolt/federation features are now CGO-optional,
darwin builds can use CGO_ENABLED=0.

Users who need Dolt features on macOS can build from source with
CGO enabled.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 00:13:02 -08:00
emma
f91bbf3a03 fix(build): add CGO build constraints for Dolt-dependent files
The dolthub/gozstd dependency requires CGO. Several files were importing
the dolt package without build constraints, causing CI failures when
building with CGO_ENABLED=0 for Linux, FreeBSD, and Android.

Changes:
- Add //go:build cgo to federation.go and doctor/federation.go
- Create dolt_server_cgo.go/nocgo.go to abstract dolt.Server usage
- Create federation_nocgo.go with stub command explaining CGO requirement
- Create doctor/federation_nocgo.go with stub health checks
- Update daemon.go to use the dolt server abstraction

Federation and Dolt-specific features are unavailable in non-CGO builds.
Users are directed to pre-built binaries from GitHub releases.

Fixes v0.49.0 CI failure.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 00:01:37 -08:00
beads/crew/emma
9381190462 chore: Bump version to 0.49.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 23:42:07 -08:00
Roland Tritsch
5264d7aa60 fix(daemon): prevent zombie state after database file replacement (#1213)
fix(daemon): prevent zombie state after database file replacement

Adds checkFreshness() to health check paths (GetMetadata, GetConfig, GetAllConfig) and refactors reconnect() to validate new connection before closing old.

PR-URL: https://github.com/steveyegge/beads/pull/1213
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-21 22:46:59 -08:00
emma
78e1d6f229 chore: revert accidental .beads/ changes from #1231
The autoimport fix PR accidentally included local beads data changes.
This reverts the data files while keeping the code fixes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 21:51:07 -08:00
matt wilkie
1f8a6bf84e fix(autoimport): auto-correct deleted status to tombstone for JSONL compatibility (#1231)
* fix(autoimport): auto-correct deleted status to tombstone for JSONL compatibility (GH#1223)

This fix addresses the 'Stuck in sync diversion loop' issue where v0.48.0
encountered validation errors during JSONL import. The issue occurs when
JSONL files from older versions have issues with status='deleted' but the
current code expects status='tombstone' for deleted issues.

Changes:
- Add migration logic in parseJSONL to auto-correct 'deleted' status to 'tombstone'
- Ensure tombstones always have deleted_at timestamp set
- Add debug logging for both migration operations
- Prevents users from being stuck in sync divergence when upgrading

Fixes GH#1223: Stuck in sync diversion loop

* fix(autoimport): comprehensively fix corrupted deleted_at on non-tombstone issues (GH#1223)

The initial fix for GH#1223 only caught issues with status='deleted', but the real
data in the wild had issues with status='closed' (or other statuses) but also
had deleted_at set, which violates the validation rule.

Changes:
- Add broader migration logic: any non-tombstone issue with deleted_at should become tombstone
- Apply fix in all three JSONL parsing locations:
  - internal/autoimport/autoimport.go (parseJSONL for auto-import)
  - cmd/bd/import.go (import command)
  - cmd/bd/daemon_sync.go (daemon sync helper)
- Add comprehensive test case for corrupted closed issues with deleted_at
- Fixes the 'non-tombstone issues cannot have deleted_at timestamp' validation error
  during fresh bd init or import

Fixes GH#1223: Stuck in sync diversion loop

* Add merge driver comment to .gitattributes

* fix: properly clean up .gitattributes during bd admin reset

Fixes GH#1223 - Stuck in sync diversion loop

The removeGitattributesEntry() function was not properly cleaning up
beads-related entries from .gitattributes. It only removed lines
containing "merge=beads" but left behind:
- The comment line "# Use bd merge for beads JSONL files"
- Empty lines following removed entries

This caused .gitattributes to remain in a modified state after
bd admin reset --force, triggering sync divergence warning loop.

The fix now:
- Skips lines containing "merge=beads" (existing behavior)
- Skips beads-related comment lines
- Skips empty lines that follow removed beads entries
- Properly cleans up file so it's either empty (and gets deleted)
  or contains only non-beads content

---------

Co-authored-by: Amp <amp@example.com>
2026-01-21 21:50:38 -08:00
emma
1d3ca43620 chore: revert accidental .beads/issues.jsonl changes from #1243
The Codex setup feature PR accidentally included local beads data changes.
This reverts just the data file while keeping the code changes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 21:50:18 -08:00
matt wilkie
ce622f5688 feat(setup): add Codex CLI setup recipe (#1243)
* Add Codex setup recipe

* Sync beads issues (bd-1zo)

---------

Co-authored-by: Amp <amp@example.com>
2026-01-21 21:50:01 -08:00
Steve Yegge
be306b6c66 fix(routing): auto-enable hydration and flush JSONL after routed create (#1251)
* fix(routing): auto-enable hydration and flush JSONL after routed create

Fixes split-brain bug where issues routed to different repos (via routing.mode=auto)
weren't visible in bd list because JSONL wasn't updated and hydration wasn't configured.

**Problem**: When routing.mode=auto routes issues to a separate repo (e.g., ~/.beads-planning),
those issues don't appear in 'bd list' because:
1. Target repo's JSONL isn't flushed after create
2. Multi-repo hydration (repos.additional) not configured automatically
3. No doctor warnings about the misconfiguration

**Changes**:

1. **Auto-flush JSONL after routed create** (cmd/bd/create.go)
   - After routing issue to target repo, immediately flush to JSONL
   - Tries target daemon's export RPC first (if daemon running)
   - Falls back to direct JSONL export if no daemon
   - Ensures hydration can read the new issue immediately

2. **Enable hydration in bd init --contributor** (cmd/bd/init_contributor.go)
   - Wizard now automatically adds planning repo to repos.additional
   - Users no longer need to manually run 'bd repo add'
   - Routed issues appear in bd list immediately after setup

3. **Add doctor check for hydrated repo daemons** (cmd/bd/doctor/daemon.go)
   - New CheckHydratedRepoDaemons() warns if daemons not running
   - Without daemons, JSONL becomes stale and hydration breaks
   - Suggests: cd <repo> && bd daemon start --local

4. **Add doctor check for routing+hydration mismatch** (cmd/bd/doctor/config_values.go)
   - Validates routing targets are in repos.additional
   - Catches split-brain configuration before users encounter it
   - Suggests: bd repo add <routing-target>

**Testing**: Builds successfully. Unit/integration tests pending.

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

* test(routing): add comprehensive tests for routing fixes

Add unit tests for all 4 routing/hydration fixes:

1. **create_routing_flush_test.go** - Test JSONL flush after routing
   - TestFlushRoutedRepo_DirectExport: Verify direct JSONL export
   - TestPerformAtomicExport: Test atomic file operations
   - TestFlushRoutedRepo_PathExpansion: Test path handling
   - TestRoutingWithHydrationIntegration: E2E routing+hydration test

2. **daemon_test.go** - Test hydrated repo daemon check
   - TestCheckHydratedRepoDaemons: Test with/without daemons running
   - Covers no repos, daemons running, daemons missing scenarios

3. **config_values_test.go** - Test routing+hydration validation
   - Test routing without hydration (should warn)
   - Test routing with correct hydration (should pass)
   - Test routing target not in hydration list (should warn)
   - Test maintainer="." edge case (should pass)

All tests follow existing patterns and use t.TempDir() for isolation.

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

* fix(tests): fix test failures and refine routing validation logic

Fixes test failures and improves validation accuracy:

1. **Fix routing+hydration validation** (config_values.go)
   - Exclude "." from hasRoutingTargets check (current repo doesn't need hydration)
   - Prevents false warnings when maintainer="." or contributor="."

2. **Fix test ID generation** (create_routing_flush_test.go)
   - Use auto-generated IDs instead of hard-coded "beads-test1"
   - Respects test store prefix configuration (test-)
   - Fixed json.NewDecoder usage (file handle, not os.Open result)

3. **Fix config validation tests** (config_values_test.go)
   - Create actual directories for routing paths to pass path validation
   - Tests now verify both routing+hydration AND path existence checks

4. **Fix daemon test expectations** (daemon_test.go)
   - When database unavailable, check returns "No additional repos" not error
   - This is correct behavior (graceful degradation)

All tests now pass:
- TestFlushRoutedRepo* (3 tests)
- TestPerformAtomicExport
- TestCheckHydratedRepoDaemons (3 subtests)
- TestCheckConfigValues routing tests (5 subtests)

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

* docs: clarify when git config beads.role maintainer is needed

Clarify that maintainer role config is only needed in edge case:
- Using GitHub HTTPS URL without credentials
- But you have write access (are a maintainer)

In most cases, beads auto-detects correctly via:
- SSH URLs (git@github.com:owner/repo.git)
- HTTPS with credentials

This prevents confusion - users with SSH or credential-based HTTPS
don't need to manually configure their role.

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

* fix(lint): address linter warnings in routing flush code

- Add missing sqlite import in daemon.go
- Fix unchecked client.Close() error return
- Fix unchecked tempFile.Close() error returns
- Mark unused parameters with _ prefix
- Add nolint:gosec for safe tempPath construction

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

---------

Co-authored-by: Roland Tritsch <roland@ailtir.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-21 21:22:04 -08:00
Steve Yegge
abd3feb761 fix(lint): check error return from provider.Close() (#1250)
Two lint errors introduced in recent commits:
- cmd/bd/doctor/git.go:896 - unchecked provider.Close()
- cmd/bd/orphans.go:120 - unchecked provider.Close()

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 21:11:33 -08:00
beads/crew/lydia
2cc96197c0 fix(dolt): parse timestamps from TEXT columns instead of direct time.Time scan
The Dolt storage was scanning created_at and updated_at directly into
time.Time fields, but SQLite stores these as TEXT strings. The Go SQLite
driver cannot automatically convert TEXT to time.Time.

Added parseTimeString() helper and fixed all scan functions:
- issues.go: scanIssue()
- dependencies.go: scanIssueRow()
- history.go: GetIssueHistory(), GetIssueAsOf()
- transaction.go: scanIssueTx()

Fixes bd-4dqmy

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 20:48:47 -08:00
Roland Tritsch
b63e7b8cf0 fix: auto-route create with explicit ID to correct database
When bd create --id=pq-xxx is called with an ID prefix that does not
match the current database, automatically route to the correct database
based on routes.jsonl configuration.

Changes:
- Add auto-routing logic before explicit --rig/--prefix handling
- Extract prefix from explicit ID and look it up in routes.jsonl
- If prefix matches a different rig, call createInRig automatically
- Update createInRig to accept explicitID parameter
- Pass explicitID through to issue creation

This fixes the prefix mismatch error when creating issues with
explicit IDs across rigs in multi-repo setups like Gas Town.

Example:
  cd ~/gt  # Root with hq- prefix
  bd create --id=pq-xxx --title="Test"
  # Now automatically routes to pgqueue/.beads/beads.db

Fixes: gt doctor --fix failing to create agent beads
Closes: #1188

Cherry-picked from Team-Ailtir/beads PR #1188 with build fix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 20:44:45 -08:00
beads/crew/jane
2a56aab92c refactor(storage): move LocalProvider to internal/storage package
Move LocalProvider from cmd/bd/doctor/git.go to internal/storage/local_provider.go
where it belongs alongside StorageProvider. Both implement IssueProvider for
orphan detection - LocalProvider for direct SQLite access (--db flag),
StorageProvider for the global Storage interface.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 20:41:53 -08:00
beads/crew/collins
8da7f274d6 docs(design): add KV store design for Dolt team review
Inspired by PR #1164 from Piyush Jha (@Hackinet). Groups commands
under 'bd kv' subcommand for cleaner namespacing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 20:39:45 -08:00
Steve Yegge
9c3c21efe3 feat(cli): add 'view' as alias for 'show' command (#1249)
Users naturally try 'bd view <id>' when they want to see an issue.
Adding 'view' as an alias improves discoverability and UX.

Fixes bd-bpx35

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:58:49 -08:00
Peter Chanthamynavong
c11fa799be fix(orphans): honor --db flag for cross-repo orphan detection (#1200)
* fix(orphans): honor --db flag for cross-repo orphan detection

Problem:
- `bd orphans --db /path` ignored the --db flag entirely
- FindOrphanedIssues() hardcoded local .beads/ directory

Solution:
- Introduce IssueProvider interface for abstract issue lookup
- Add StorageProvider adapter wrapping Storage instances
- Update FindOrphanedIssues to accept provider instead of path
- Wire orphans command to create provider from --db flag

Closes: steveyegge/beads#1196

* test(orphans): add cross-repo and provider tests for --db flag fix

- Add TestFindOrphanedIssues_WithMockProvider (table-driven, UT-01 through UT-09)
- Add TestFindOrphanedIssues_CrossRepo (validates --db flag honored)
- Add TestFindOrphanedIssues_LocalProvider (backward compat RT-01)
- Add TestFindOrphanedIssues_ProviderError (error handling UT-07)
- Add TestFindOrphanedIssues_IntegrationCrossRepo (IT-02 full)
- Add TestLocalProvider_* unit tests

Coverage for IssueProvider interface and cross-repo orphan detection.

* docs: add bd orphans command to CLI reference

Document the orphan detection command including the cross-repo
workflow enabled by the --db flag fix in this PR.
2026-01-21 19:52:31 -08:00
Bo
a0dac11e42 refactor: reduce cyclomatic complexity in repair.go and config_values.go (#1214)
- repair.go: Extract validateRepairPaths(), findAllOrphans(), printOrphansText()
- config_values.go: Extract findConfigPath(), validateDurationConfig(), etc.
- Target: CC < 20 for each extracted function
2026-01-21 19:50:03 -08:00
beads/crew/lydia
9a9704b451 feat(sync): add per-field merge strategies for conflict resolution
Implements configurable per-field merge strategies (hq-ew1mbr.11):

- Add FieldStrategy type with strategies: newest, max, union, manual
- Add conflict.fields config section for per-field overrides
- compaction_level defaults to "max" (highest value wins)
- estimated_minutes defaults to "manual" (flags for user resolution)
- labels defaults to "union" (set merge)

Manual conflicts are displayed during sync with resolution options:
  bd sync --ours / --theirs, or bd resolve <id> <field> <value>

Config example:
  conflict:
    strategy: newest
    fields:
      compaction_level: max
      estimated_minutes: manual
      labels: union

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:40:39 -08:00
cheedo
e0dc3a37c3 feat(create): add -m as alias for --description flag
Add --message/-m as a hidden alias for --description on bd create,
matching the git commit -m convention for muscle memory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:34:29 -08:00
aleiby
0b6df198a5 fix(ready): exclude molecule steps from bd ready by default (#1246)
* fix(ready): exclude molecule steps from bd ready by default (GH#1239)

Add ID prefix constants (IDPrefixMol, IDPrefixWisp) to types.go as single
source of truth. Update pour.go and wisp.go to use these constants.

GetReadyWork now excludes issues with -mol- in their ID when no explicit
type filter is specified. Users can still see mol steps with --type=task.

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

* feat(ready): config-driven ID pattern exclusion (GH#1239)

Add ready.exclude_id_patterns config for excluding IDs from bd ready.
Default patterns: -mol-, -wisp- (molecule steps and wisps).

Changes:
- Add IncludeMolSteps to WorkFilter for internal callers
- Update findGateReadyMolecules and getMoleculeCurrentStep to use it
- Make exclusion patterns config-driven via ready.exclude_id_patterns
- Remove hardcoded MolStepIDPattern() in favor of config
- Add test for custom patterns (e.g., gastown's -role-)

Usage: bd config set ready.exclude_id_patterns "-mol-,-wisp-,-role-"

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

* docs: remove -role- example from ready.go comments

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

* docs: remove GH#1239 references from code comments

Issue references belong in commit messages, not code.

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:30:15 -08:00
Sam Estep
46b1678274 Add .direnv folder to .gitignore (#1248) 2026-01-21 19:30:07 -08:00
beads/crew/jane
97d4b174d0 fix(migrate): address code review issues in Dolt migration
Fixes from code review:

1. **Data completeness**: Now migrates events (including comments)
   and all config values, not just issues/labels/deps

2. **formatJSONArray**: Fixed to use JSON encoding for waiters field
   to match Dolt schema (was using comma-separated format)

3. **Cleanup on failure**: Removes partial Dolt directory or SQLite
   files if import fails mid-way

4. **Progress indicator**: Shows "Importing issues: N/M" for large
   migrations (100+ issues)

5. **Code deduplication**: Extracted common logic into:
   - migrationData struct
   - storageReader interface
   - extractFromStore() shared extraction
   - Helper functions for output formatting

6. **Improved dry-run output**: Now shows event count and config
   key count in migration plan

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:27:01 -08:00
beads/crew/emma
de73002c03 test(dolt): add hub+spokes multi-clone integration tests
Add integration tests for the Gas Town hub+spokes topology where:
- Hub (mayor rig) runs dolt sql-server with remotesapi
- Spokes (crew clones) configure hub as their only peer
- Data flows through hub in star topology

Tests included:
- TestHubSpokes_MultiCloneSync: Basic two-spoke convergence
- TestHubSpokes_WorkDispatch: Hub dispatches work, spokes complete it
- TestHubSpokes_ThreeSpokesConverge: Three-spoke convergence test

Note: These tests follow the same pattern as peer_sync_integration_test.go
and document current behavior including the no common ancestor limitation
that affects cross-database sync.

Closes bd-phwci

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:21:38 -08:00
Oliver Jägle
0877e1428e fix(list): stabilize tree ordering for consistent --tree output (#1228)
Motivation:
The ○ bd-e3r ● P2 Responsible-Vibe Development: beads
├── ○ bd-e3r.7 ● P1 Test feature B
│   ├── ○ bd-e3r.7.1 ● P2 Subfeature B1
│   └── ○ bd-e3r.7.2 ● P2 Subfeature B2
├── ○ bd-e3r.6 ● P1 Test feature A
│   ├── ○ bd-e3r.6.2 ● P2 Subfeature A2
│   └── ○ bd-e3r.6.1 ● P2 Subfeature A1
│       ├── ○ bd-e3r.6.1.1 ● P3 Task A1.1
│       └── ○ bd-e3r.6.1.2 ● P3 Task A1.2
├── ○ bd-e3r.8 ● P2 Test identical priority A
├── ○ bd-e3r.9 ● P2 Test identical priority B
├── ○ bd-e3r.1 ● P3 Reproduce
├── ○ bd-e3r.2 ● P3 Analyze
├── ○ bd-e3r.4 ● P3 Verify
├── ○ bd-e3r.5 ● P3 Finalize
└── ○ bd-e3r.3 ● P3 Fix

--------------------------------------------------------------------------------
Total: 16 issues (16 open, 0 in progress)

Status: ○ open  ◐ in_progress  ● blocked  ✓ closed  ❄ deferred command produced non-deterministic ordering between
consecutive executions, making [?1049h(B[?7h[?25lEvery 2.0s: bd list --treebwpm-D6KDQ60Q6R: 08:29:46in 0.343s (0)○ bd-e3r ● P2 Responsible-Vibe Development: beads
├── ○ bd-e3r.6 ● P1 Test feature A
│   ├── ○ bd-e3r.6.1 ● P2 Subfeature A1
│   │   ├── ○ bd-e3r.6.1.1 ● P3 Task A1.1
│   │   └── ○ bd-e3r.6.1.2 ● P3 Task A1.2
│   └── ○ bd-e3r.6.2 ● P2 Subfeature A2
├── ○ bd-e3r.7 ● P1 Test feature B
│   ├── ○ bd-e3r.7.2 ● P2 Subfeature B2
│   └── ○ bd-e3r.7.1 ● P2 Subfeature B1
├── ○ bd-e3r.8 ● P2 Test identical priority A
├── ○ bd-e3r.9 ● P2 Test identical priority B
├── ○ bd-e3r.1 ● P3 Reproduce
├── ○ bd-e3r.4 ● P3 Verify
├── ○ bd-e3r.5 ● P3 Finalize
├── ○ bd-e3r.2 ● P3 Analyze
└── ○ bd-e3r.3 ● P3 Fix
--------------------------------------------------------------------------------Total: 16 issues (16 open, 0 in progress)
Status: ○ open  ◐ in_progress  ● blocked  ✓ closed  ❄ deferred
[?12l[?25h[?1049l
[?1l> unusable due to
constantly changing output. Root issues and children with identical
priorities appeared in different orders across runs.

Key Changes:
- Add compareIssuesByPriority() function with primary sort by priority
  and secondary sort by ID for deterministic behavior
- Apply stable sorting to root issues in buildIssueTreeWithDeps()
- Apply stable sorting to children in childrenMap for complete consistency
- Update printPrettyTree() to use same comparison function

Side-Effects:
- Tree output now consistently orders by priority (P0→P1→P2→P3→P4)
- Items with identical priority are sorted alphabetically by ID
- Adds comprehensive TestStableTreeOrdering test with 5-run stability verification
- Minor performance overhead from sorting (negligible for typical issue counts)
- Fixes indentation inconsistencies in existing test code via gofmt
2026-01-21 19:11:25 -08:00
Johannes Schickling
3daec76ac9 fix(nix): bake shell completions into default package (#1229)
The default package now includes fish, bash, and zsh completions
at standard paths. This means users only need to install the
default package to get both the binary and completions.

The separate completion packages are kept for backwards
compatibility but now simply symlink to the default package.

Standard completion paths:
- share/fish/vendor_completions.d/bd.fish
- share/bash-completion/completions/bd
- share/zsh/site-functions/_bd
2026-01-21 19:11:21 -08:00
beads/crew/emma
bb4549abdd fix(daemon): allow read-only daemon commands with Dolt backend
The daemon guard was blocking ALL daemon commands when using Dolt
backend, including read-only commands like `status`, `stop`, `logs`.

Changes:
- Rename guard to `guardDaemonStartForDolt` (more accurate)
- Remove `PersistentPreRunE` from `daemonCmd` and `daemonsCmd`
- Add `PreRunE` guard only to `daemonStartCmd` and `daemonsRestartCmd`
- Update test to use new function name and test start command

Now:
- `bd daemon status` works with Dolt backend
- `bd daemon start` blocked unless `--federation` flag
- `bd daemon start --federation` works (starts dolt sql-server)

Fixes: bd-n7o47

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:06:06 -08:00
beads/crew/jane
4e3e9d1441 feat(migrate): add SQLite to Dolt migration tooling (hq-ew1mbr.6)
Add `bd migrate --to-dolt` and `bd migrate --to-sqlite` commands for
migrating between SQLite and Dolt storage backends.

Features:
- `--to-dolt`: Migrate from SQLite to Dolt backend
  - Creates backup of SQLite database before migration
  - Imports all issues, labels, and dependencies
  - Updates metadata.json to use Dolt backend
  - Preserves JSONL export configuration

- `--to-sqlite`: Escape hatch to migrate back to SQLite
  - Exports all data from Dolt to new SQLite database
  - Updates metadata.json to use SQLite backend

Both commands support:
- `--dry-run` flag to preview changes
- `--yes` flag for automated/scripted usage
- `--json` flag for machine-readable output
- Non-cgo stub for builds without CGO support

This implements Part 7 (Migration Tooling) of DOLT-STORAGE-DESIGN.md.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:46:15 -08:00
matt wilkie
e74cab8c6d Fix CI failures (bd 1zo sandbox tests) (#1244)
* Fix sandboxed daemon autostart tests and lint cleanup (bd-1zo)

* Restore issues jsonl to main state (bd-1zo)

* Remove .beads changes from PR (bd-1zo)

* Fix Windows build for dolt SysProcAttr (bd-1zo)

* Reset .beads/issues.jsonl to upstream main (bd-1zo)

* Reset .beads/issues.jsonl to upstream main (bd-1zo)

* Reset .beads/issues.jsonl to upstream main (bd-1zo)

* Fix Windows password prompt fd type (bd-1zo)

* Reset .beads/issues.jsonl to upstream main (bd-1zo)

---------

Co-authored-by: Amp <amp@example.com>
Co-authored-by: beads/crew/darcy <steve.yegge@gmail.com>
2026-01-21 16:59:51 -08:00
jane
77423d367f chore: move WSL2 test scripts to scripts directory
For consistency with other shell scripts in the codebase.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 16:54:24 -08:00
jane
65f0af3ff4 chore: remove PR documentation files
CI_REPORT.md and FIX_SUMMARY.md were included in PR #1242 for review
purposes but should not be part of the main codebase.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 16:54:17 -08:00
matt wilkie
ef162a954a fix(GH#1224): detect Docker Desktop bind mounts in WSL2 and disable WAL mode
Fixes stack overflow and database initialization failures when running bd on WSL2 with Docker Desktop bind mounts.

## Problem
The bd CLI crashed with stack overflow when running on WSL2 with repositories on Docker Desktop bind mounts (/mnt/wsl/docker-desktop-bind-mounts/...). SQLite WAL mode fails with 'locking protocol' error on these network filesystems.

## Solution
- Expand WAL mode detection to identify Docker bind mounts at /mnt/wsl/* (in addition to Windows paths at /mnt/[a-zA-Z]/)
- Fall back to DELETE journal mode on these problematic paths
- Add comprehensive unit tests for path detection

Fixes GH #1224, relates to GH #920

Co-authored-by: maphew <matt.wilkie@gmail.com>
2026-01-21 16:53:49 -08:00
Nelson Melo
0eb3dd05a9 fix(daemon): prevent stack overflow in handleStaleLock (#1238)
Remove recursive tryAutoStartDaemon calls from handleStaleLock that
caused infinite recursion when daemon start lock cleanup looped.

The call chain was: acquireStartLock -> handleStaleLock ->
tryAutoStartDaemon -> acquireStartLock -> ... (unbounded)

Now handleStaleLock just cleans up stale locks and returns false,
letting the caller's bounded retry loop handle retries.

Co-authored-by: Nelson Melo <nmelo@users.noreply.github.com>
2026-01-21 16:51:56 -08:00
Steve Yegge
caf4c368c4 Merge pull request #1240 from coffeegoddd/db/import-export
Enable full-fidelity JSONL import/export for Dolt backend
2026-01-21 16:40:03 -08:00
Test
01fa2d9f3f /cmd/bd/federation.go: fix windows build issue again 2026-01-21 14:08:40 -08:00
Test
7670112341 /internal/storage/dolt: fix windows build issue 2026-01-21 13:59:47 -08:00
Test
0a9bcc2dd0 /internal/importer/importer_test.go: remove skipped tests 2026-01-21 13:40:06 -08:00
Test
b849f598d7 /{cmd,docs,internal}: support import export for dolt backends 2026-01-21 13:13:24 -08:00