* fix(config): refuse to write secret keys to git-tracked config.yaml
P0 security fix. bd config set for secret keys (api_key, secret, token,
password) now detects git tracking of the target config file and refuses
the write with an actionable error pointing to env var alternatives.
Adds --force-git-tracked escape hatch for tests. Updates stale template
documentation and setup guides to lead with env var approach.
* fix(config): scope secret git safety check to YAML-backed keys
Use real environment variable hints for known secret config keys and avoid blocking database-backed secret-looking keys such as notion.token.
Maintainer follow-up for PR #3652.
* fix(config): silence gosec on env var hint names
The map contains environment variable names, not secret values.
---------
Co-authored-by: matt wilkie <maphew@gmail.com>
Add OAuthTokenManager for machine-to-machine authentication using
Linear's client_credentials grant. This enables CI workers to use a
service identity (actor=application) instead of personal API keys.
Key changes:
- New OAuthTokenManager with lazy acquisition, caching, thread-safe
refresh (5-min buffer before expiry), and Invalidate() for 401 retry
- AuthMode enum (APIKey vs OAuth) on Client with appropriate header
format: API keys use "Authorization: <key>", OAuth uses "Bearer"
- NewOAuthClient() constructor and WithOAuth() option
- 401 auto-retry: invalidate token and re-acquire on first 401
- Auth precedence: LINEAR_OAUTH_CLIENT_ID/SECRET env vars >
LINEAR_API_KEY env var > bd config
- Mark oauth_client_secret as secret key (uses IsSecretKey from PR-1)
- 12 new tests covering acquisition, caching, refresh, invalidation,
error handling, thread safety, and header format
Validated against Linear sandbox: client_credentials grant works with
scope=read,write, actor=application gives bot identity, 30-day TTL.
Refs: gastownhall/beads integration charter, PLAN.md §6 PR-3
P1 privacy fix. Federation push now filters issues by
federation.exclude_types config (default: ["wisp"]) before sending
to peers, consistent with the existing type filter in the sync
engine. Opt-out via federation.exclude_types = [].
Users may intentionally set 0750 for shared group access. The
previous approach forced 0700 unconditionally. Now only the other
bits (0007) are cleared: 0755→0750, 0750→0750, 0700→0700.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The non-Windows implementation was added but the Windows stub was
missing, causing a build failure on Windows CI.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When .beads/ already exists with permissive modes (e.g. created by
git clone with default umask), bd init now fixes the permissions to
0700 rather than leaving it for every subsequent bd command to warn
about.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On macOS, os.UserConfigDir() returns ~/Library/Application Support,
not ~/.config. Users following the docs create config at
~/.config/bd/config.yaml which beads never reads. This adds that
path as a config source on all platforms with dedup for Linux.
Tests that ~/.config/bd/config.yaml is loaded when os.UserConfigDir()
returns a different path (macOS), dedup works on Linux, and missing
file causes no error. These tests fail without the accompanying fix.
* Fix worktree-aware config.yaml resolution
* fix: honor shared worktree config resolution
* fix(doctor-fix): resolve shared-worktree beads paths
intent(doctor-fix): review-fix-loop found that doctor --fix should keep working when a worktree uses a shared .beads directory with no local path
constraint(doctor-fix): permission fixes must still skip chmod on local symlinked .beads directories when they exist
decision(doctor-fix): centralize resolved workspace lookup in a helper and route fix handlers through it instead of rebuilding path/.beads ad hoc
* test(doctor-fix): cover shared-worktree path resolution
intent(doctor-fix): review-fix-loop needed regressions that prove fix handlers operate on the shared workspace when a worktree has no local .beads
decision(doctor-fix): cover one config-regeneration path and two file-mutation paths so future regressions fail close to the real worktree behavior
learned(doctor-fix): metadata regeneration, stale lock cleanup, and permission repair all exercised separate path assumptions inside the fix package
* test(doctor-fix): strengthen workspace validation coverage
Why:
- shared-worktree fix coverage still left validateBeadsWorkspace edge cases loosely asserted
- fix package had no direct test for resolvedWorkspaceBeadsDir local vs shared precedence
What:
- add focused tests for resolvedWorkspaceBeadsDir local/shared selection
- make validateBeadsWorkspace reject file-backed and file-symlinked .beads explicitly
Refs:
- beads-xc4
* refactor(doctor-fix): share workspace beads dir resolution
Why:
- fix package resolved local and shared .beads paths in multiple steps even though they come from the same workspace root
- permissions handling was correct but harder to follow because local/resolved values were stitched together at the call site
What:
- extract a package-local helper that returns both local and resolved .beads paths from one workspace lookup
- make Permissions reuse that helper and add direct tests for local path behavior
Refs:
- beads-rim
* fix(config): remove shared-worktree import cycle
Why:
- shared-worktree config fallback in internal/config imported internal/beads
- that pulled internal/utils back into internal/utils test setup through storage/dolt and caused PR #37 CI import cycle failures
What:
- keep worktree fallback resolution inside internal/config
- reuse the repo-scoped git-dir fallback for config.yaml discovery without importing internal/beads
Refs:
- beads-3ix
* fix(doctor): resolve database-integrity against shared worktrees
intent(doctor): keep integrity recovery from reading a nonexistent worktree-local .beads during shared-worktree repairs
decision(database-integrity): resolve config and dolt paths from resolvedWorkspaceBeadsDir while keeping bd init --force anchored to the worktree repo root
learned(shared-worktree): the server-mode guard must inspect shared config or it can silently bypass the configured database safety check
* fix(doctor): honor shared worktrees in remote-consistency
intent(doctor): keep remote reconciliation pointed at the active shared workspace state during worktree repairs
decision(remote-consistency): resolve shared-worktree config and dolt paths once before comparing SQL and CLI remotes
constraint(remote-consistency): the fixer still runs from the worktree repo path but cannot derive paths from repoPath/.beads when that directory is absent
* fix(doctor): align shared worktree resolution (beads-u8z)
* test(config): cover shared worktree config precedence (beads-7kw)
intent(config): lock down shared worktree config resolution so future fallback fixes do not silently write or read the wrong file
decision(config-tests): cover both write precedence and Initialize() local override behavior in worktree-specific tests
constraint(shared-worktree): runtime resolution can legitimately target either worktree-local or shared .beads, so the regression coverage must assert both paths explicitly
* Add worktree path coverage for beads dir resolution
* Avoid creating .beads on normal Dolt store opens
* Prefer loaded worktree config when finding project config
* test(worktree): add shared config regression coverage (beads-z65b)
intent(worktree-config): keep shared-worktree sync.remote persistence covered at both the YAML helper and CLI command layers
decision(regression-tests): pair a loaded-state config test with a bd subprocess test because the original regression crossed initialization and command execution
constraint(cmd-bd): use the repo CGO test wrapper for command coverage because raw go test ./cmd/bd requires local ICU setup outside the supported path
* fix(doctor): sweep shared-worktree resolver into remaining checks (beads-3y9p)
intent: keep this PR's worktree bugfix coherent by removing the last redirect-only doctor resolution paths
decision: route standalone doctor checks through ResolveBeadsDirForRepo and add shared-worktree regressions for locks, mq cleanup, hook migrations, and remote consistency
constraint: leave local-only semantics alone and validate with targeted doctor tests instead of broad environment-sensitive full-suite expectations
* test(worktree): strengthen resolver regression coverage (beads-i9x1)
intent(worktree-coverage): raise patch coverage for the shared-worktree resolver PR on branches introduced by this change set
decision(config-tests): cover worktree config helpers directly in internal/config so fallback and loaded-state branches stay deterministic
decision(storage-tests): exercise lazy federation credential-key initialization with one server-backed peer lifecycle instead of broader end-to-end sync flows
constraint(doctor-tests): verify tracked runtime cleanup from the resolved main repo because shared .beads lives outside the worktree root
* fix(bootstrap): persist sync remote in resolved config
intent(bootstrap): fresh worktree bootstrap should finalize the shared workspace config instead of failing on a local .beads stub
decision(config-resolution): add a targeted yaml writer for an explicit beads directory so bootstrap can reuse the resolved workspace path
constraint(worktree-config): bare-parent and shared worktree setups can expose a local .beads directory that must not shadow the canonical config.yaml during finalize
* test(config): cover worktree resolution edge paths (beads-adan)
intent(codecov): PR #3265 needed patch coverage above the Codecov complaint on config/worktree resolution changes
decision(tests): add unit coverage in existing config, doctor/fix, and credentials suites instead of broader e2e coverage
constraint(tests): keep sanitizeDBName available to nocgo typecheck because init.go calls it outside cgo-only files
* test(embedded): allow concurrent dolt status
---------
Co-authored-by: matt wilkie <maphew@gmail.com>
* fix: rebind target workspace for db commands
* fix: isolate rebinding from caller workspace state
* fix: restore no-db target selection semantics
* fix: honor no-db target precedence consistently
* test: restore db flag state in context rebinding tests
* fix: enable auto-export by default with canonical issues.jsonl name (GH#2973)
Users expected JSONL export to refresh automatically but export.auto
defaulted to false, requiring explicit opt-in. Also the default filename
(export.jsonl) didn't match the canonical issues.jsonl used in docs and
git hooks. Change defaults: export.auto=true, export.path=issues.jsonl,
export.git-add=true so viewers (bv) and git workflows see fresh data
without extra configuration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat(init): add auto-export prompt and document export.* config (GH#2973)
Interactive bd init now asks whether to enable auto-export (default: yes).
Users can opt out during setup instead of discovering the setting later.
Also documents the export.* config namespace in bd config --help with
all four keys (export.auto, export.path, export.interval, export.git-add)
and adds export examples.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: document export.* auto-export config keys (GH#2973)
Document the export.auto/path/interval/git-add keys in docs/CONFIG.md
and note the default-on switch in CHANGELOG.md [Unreleased].
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(export): don't prime throttle on empty init and skip git-add without git (GH#2973)
Review feedback on #3204 surfaced two regressions in the default-on
auto-export path:
1. bd init's PersistentPostRun fired maybeAutoExport with zero issues,
writing an empty .beads/issues.jsonl and saving export-state.json with
the current dolt commit + timestamp. The next `bd create` was then
throttled for up to export.interval (default 60s) because the
timestamp check in maybeAutoExport returned before considering the new
commit, leaving issues.jsonl stale on fresh repos.
Skip saving state and remove the empty file when the export produced
no issues and no memories. The next write runs a real export
immediately.
2. export.git-add defaulting to true emitted
`Warning: auto-export: git add failed: exit status 128` on every
write in the supported standalone BEADS_DIR flow where init
intentionally skips `git init`. Gate the git add call on isGitRepo()
so standalone users get silent, working auto-export.
Adds a scripttest regression guard for the init -> immediate create
path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test(memory): disable auto-export in concurrent test (GH#2973)
TestEmbeddedMemoryConcurrent started failing on this branch after
auto-export became the default: every concurrent 'bd remember'/'bd
forget' call now fires maybeAutoExport, which reads store state after
the write. Under 8-worker contention this intermittently leaves a
forgotten key visible to 'bd memories'.
The test exercises memory concurrency, not export behavior; opt it
out of auto-export so the signal stays focused. Followup: investigate
the race between write commit and post-write auto-export read in
embedded Dolt concurrent paths.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add strict security validation for remote URLs and remote names to prevent
injection attacks when multi-remote support lands.
Changes:
- Add ValidateRemoteURL() with control character rejection, CLI flag
injection prevention, scheme allowlist, and per-scheme structural
validation (host/path requirements)
- Add ValidateRemoteName() aligned with existing peer-name policy
(letter-start, alphanumeric + hyphen/underscore, max 64 chars)
- Add MatchesRemotePattern() and ValidateRemoteURLWithPatterns() for
enterprise lockdown via federation.allowed-remote-patterns config
- Move config validation from simple IsRemoteURL() classifier to strict
ValidateRemoteURL() security boundary
- Add defense-in-depth validation in AddCLIRemote/RemoveCLIRemote
- Add validation at clone entry points (cache.Ensure, bootstrap)
- Tighten SCP-style URL regex to exclude control characters in path
- Add comprehensive test coverage for null bytes, control chars,
newline injection, CLI flag injection, scheme validation, structural
validation, remote name edge cases, and pattern matching
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat(telemetry): add connection pool metrics for shared-server diagnosis (GH#3140)
Add OTel metrics to diagnose shared-server degradation under multi-worktree load:
- conn_acquire_ms: time to acquire a pooled connection
- pool_wait_count/pool_wait_ms: pool exhaustion events
- serialization_errors: MySQL 1213/1205 count before retry
- pool_open/in_use/idle/max_open: observable gauges for pool utilization
These capture the first degradation signal before tools fall back to
direct dolt writes, which is the key diagnostic gap identified in GH#3140.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(dolt): configurable pool size + extended serialization retry (GH#3140)
- Add BEADS_DOLT_MAX_CONNS env var and dolt.max-conns config.yaml key
to override the default connection pool size (10). Useful for shared-server
setups with many worktrees.
- Extend withRetryTx timeout from 5s to 15s in server mode, where multiple
worktrees produce higher serialization contention.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat(dolt): per-database circuit breakers for shared-server (GH#3140)
Include the database name in circuit breaker file paths so each project
gets independent breaker state. Previously, all worktrees sharing a
server had one breaker keyed by host:port — degradation in one project
would trip the breaker for all others.
Backward compatible: empty database name produces the old filename.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(lint): suppress gosec G104 on pool gauge registrations
The OTel Int64ObservableGauge calls return errors that are intentionally
ignored (gauge registration failures are non-fatal). nolint:errcheck was
already present but gosec G104 also fires on unhandled errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Add az:// (Azure Blob Storage) as a recognized Dolt remote URL scheme.
Azure Blob Storage URLs were already functional for bootstrap via sync.git-remote, but the URL validator didn't recognize az:// — so config validate and error hints were incomplete.
Thanks to @harry-miller-trimble for the contribution!
* fix: show diverged-history guidance on auto-push failure
When dolt auto-push fails with a 'no common ancestor' error, the user
only sees a cryptic warning. The explicit 'bd dolt push' and 'bd dolt
pull' commands already detect this and print recovery guidance via
printDivergedHistoryGuidance(), but the auto-push path did not.
Now auto-push also calls isDivergedHistoryErr() and prints the same
actionable recovery options (bootstrap, force-push, or re-init).
Amp-Thread-ID: https://ampcode.com/threads/T-019d6ee7-e46d-74f8-8b6e-2a0fc1b2d4d7
Co-authored-by: Amp <amp@ampcode.com>
* fix: store secret config keys in config.yaml, not Dolt DB
Keys like github.token and linear.api_key were stored in the Dolt
database's config table. When auto-push sends that data to a GitHub
remote, GitHub's push protection blocks the push because it detects
embedded secrets in the Dolt data files.
Fix: add github.token and linear.api_key to YamlOnlyKeys so they're
written to .beads/config.yaml (local-only, gitignored) instead of
the Dolt database. Update the read paths in getGitHubConfigValue()
and getLinearConfig() to check YAML config first for these keys.
Amp-Thread-ID: https://ampcode.com/threads/T-019d6ee7-e46d-74f8-8b6e-2a0fc1b2d4d7
Co-authored-by: Amp <amp@ampcode.com>
---------
Co-authored-by: Amp <amp@ampcode.com>
Ensure yaml-only config set/get/unset resolve config.yaml from BEADS_DIR when set, before CWD walk, and add regression coverage for BEADS_DIR behavior outside repos.
Feature-Key: bd-nywzd.6
Add `bd config show` command that displays all effective configuration
across all sources with provenance annotations:
- config.yaml: project-level YAML settings via Viper
- metadata: connection settings from .beads/metadata.json
- database: integration config stored in Dolt
- env: environment variable overrides (shows var name)
- git: git config values (beads.role)
- default: built-in defaults (non-empty only)
Features:
- Sorted alphabetical output with aligned columns
- --json flag for programmatic consumption
- --source flag to filter by provenance (e.g., --source config.yaml)
- Graceful degradation when DB is unavailable
- Works without initialized database (shows yaml/metadata/env/git)
Changes:
- cmd/bd/config_show.go: new command implementation
- cmd/bd/config_show_test.go: unit tests for all helpers
- internal/config/config.go: export AllKeys() and EnvVarName()
- cmd/bd/main.go: allow config show/validate without DB
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: move hook firing into storage layer via decorator
Add HookFiringStore decorator that wraps DoltStorage and automatically
fires on_create/on_update/on_close hooks after successful mutations.
This replaces manual hookRunner.Run() calls scattered across 8+ CLI
command files, ensuring ALL mutations fire hooks — including future
commands that haven't been written yet.
Key features:
- Decorator pattern: storage layer stays clean (no hooks dependency)
- Transaction support: hookTrackingTransaction accumulates pending
hooks during RunInTransaction, fires them only after successful
commit. Rollback = no hooks.
- Covers all mutation methods: CreateIssue(s), UpdateIssue, CloseIssue,
ReopenIssue, UpdateIssueType, Add/RemoveDependency, Add/RemoveLabel,
AddIssueComment
- DeleteIssue intentionally skipped (destructive, no issue to pass)
- Nil runner safe (passthrough only, no panics)
Removed hookRunner.Run() from: create.go, update.go, close.go,
note.go, assign.go, tag.go, priority.go.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add BD_NO_HOOKS env var to disable all hook firing
Allows opting out of the HookFiringStore decorator entirely via
BD_NO_HOOKS=1. Useful for bulk imports, migrations, or environments
where eventing should not run.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add config.BeadsDirPerm (0700) and config.BeadsFilePerm (0600) constants
- Add config.CheckBeadsDirPermissions() for startup warning if permissions
are too permissive (non-fatal, checks group/world bits)
- Add config.EnsureBeadsDir() helper for consistent directory creation
- Tighten all MkdirAll calls for .beads/ paths from 0750/0755 to 0700:
init.go, doltserver.go, credentials.go, audit.go, recipes.go,
embeddeddolt store.go and flock.go
- Add startup check in loadEnvironment() (cmd/bd/main.go)
- Windows build tag with no-op implementation (ACL-based permissions)
- 6 tests: constants, dir creation perms, warning on permissive, no
warning on secure, no error on nonexistent
Fixes: bd-kl6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When `export.auto: true` is set in config.yaml, beads automatically
writes a git-tracked JSONL file (issues + memories) after mutations.
This provides full portability across machines via git alone, without
requiring a Dolt remote.
New config keys:
export.auto: false # opt-in to auto-export
export.interval: 60s # throttle interval
export.path: export.jsonl # output file relative to .beads/
export.git-add: false # auto-stage the file
The auto-export:
- Runs in PersistentPostRun after auto-backup
- Uses Dolt commit hash for change detection (no-op if nothing changed)
- Throttles by interval (default 60s)
- Skips during git hooks (BD_GIT_HOOK=1)
- Includes both issues and memories in the JSONL output
Also extracts exportToFile() as a shared helper usable by both
`bd export -o` and the auto-export system.
Files:
- cmd/bd/export_auto.go: Core auto-export logic
- cmd/bd/main.go: Wire maybeAutoExport into PersistentPostRun
- internal/config/config.go: New export.* config defaults
- internal/config/yaml_config.go: Add "export." to yaml-only prefix list
- cmd/bd/doctor/gitignore.go: Add export-state.json to gitignore
- cmd/bd/doctor/tracked_runtime.go: Flag export-state.json if tracked
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add --agents-file flag to bd init allowing users to specify a custom
filename for agent instructions (default remains AGENTS.md). This
addresses the use case where projects prefer different naming
conventions (e.g. BEADS.md) without requiring a post-init rename.
Changes:
- Add config.AgentsFile() accessor and config.ValidateAgentsFile()
with security validation (path traversal, symlinks, extension check)
- Add --agents-file flag to bd init with config persistence
- Thread configured filename through init_agent.go
- Update setup/agents.go to use config.AgentsFile()
- Update doctor checks to search configured filename
- Update onboard messaging to reference configured filename
- Add DefaultAgentsFile constant for consistent fallback
The filename is persisted to .beads/config.yaml under agents.file
and read by all subsystems via config.AgentsFile().
Fixes#2737
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply maphew PR #2749: bd config unset now routes yaml-only keys
(backup.*, routing.*, etc.) to config.yaml and beads.role to git config,
matching the routing already done by set/get. Adds UnsetYamlConfig()
that comments out the key to preserve it as documentation. Also adds
backup.* and dolt.shared-server to bd config list yaml display.
Closes#2727
Co-Authored-By: matt wilkie <maphew@gmail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace gastown-specific references with generic alternatives throughout
the codebase:
- Rename --gastown flag to --orchestrator in bd doctor
- Rename gastownMode/gastownThreshold params to orchestratorMode/orchestratorThreshold
- Rename isGasTownTownRoot() to isOrchestratorRoot()
- Replace "gastown" in CLI examples with generic rig names (my-project, other-project)
- Update comments replacing "Gas Town" with "orchestrator" or "multi-agent workspace"
- Update active docs (DOLT.md, CONFIG.md, ADVANCED.md, etc.)
- Update test data to use generic names instead of "gastown"
- Update role templates (deacon, witness, refinery) to use generic language
Preserved as historical (not changed):
- CHANGELOG.md entries (historical record)
- ARTICLES.md (links to real published articles)
- info.go version notes (historical release notes)
- gastown/ file path references in dolt-concurrency.md (point to actual repo)
Simplify actor resolution chain to: --actor > BEADS_ACTOR > BD_ACTOR (deprecated) >
git config user.name > $USER > "unknown". BD_ACTOR still works for backwards compat
but BEADS_ACTOR is now the canonical beads-native env var. Updates all code paths,
tests, and documentation.
Remove GT-specific agent_roles configuration (town_level, rig_level, named)
from beads config. This was Gas Town organizational structure baked into beads.
- Remove GetTownLevelRoles, GetRigLevelRoles, GetNamedRoles from config.go
- Remove parseAgentIDFields and sliceToSet from agent.go
- Simplify agent auto-creation to not set roleType/rig from ID parsing
- Remove corresponding tests
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three fixes for validation consistency:
1. bd create --validate now uses LintIssue() instead of ValidateTemplate(),
bringing it to parity with bd lint. A non-empty --acceptance field now
satisfies the "Acceptance Criteria" requirement without needing the
heading in --description. (GH#2468 parity)
2. --dry-run no longer bypasses --validate. Validation now runs before the
dry-run exit, so users get feedback on template issues during preview.
3. New validation.on-close config option (none|warn|error, default: none).
When enabled, warns on terse close reasons (<20 chars) or default
"Closed" reasons. Mirrors existing validation.on-create pattern.
Co-Authored-By: seanmartinsmith <114885497+seanmartinsmith@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove all remaining string/comment references to the removed SyncMode type.
Purely cosmetic cleanup with no behavioral changes.
- config.go: remove sync.mode from yamlKeys, update validate help text
- contributor_routing_e2e_test.go: rename TestRoutingWithAllSyncModes to
TestRoutingWithAllOperationalModes (also fixes unrenamed loop variable)
- kv_test.go: change test case from sync.mode to sync.git-remote
- Comment updates across test helpers and config packages
- TROUBLESHOOTING.md: update example from sync.mode to sync.git-remote
- .gitignore: add .opencode/
Co-Authored-By: Amperstrand <amperstrand@localhost>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Root cause: GetValueSource() used os.Getenv(key) != "" to detect whether
an environment variable was set. This fails when the env var is set to an
empty string (BD_BACKUP_ENABLED=), because os.Getenv returns "" for both
'not set' and 'set to empty'. In that case, GetValueSource returned
SourceDefault, causing isBackupAutoEnabled() to fall through to the
primeHasGitRemote() auto-detect path, which enables backup when a git
remote exists — ignoring the user's intent to disable it.
Fix: Replace os.Getenv(key) != "" with os.LookupEnv(key) which
distinguishes 'not set' from 'set to empty'. Apply the same fix to the
CheckOverrides function for consistency.
Also adds test cases for BD_BACKUP_ENABLED=0 and BD_BACKUP_ENABLED=
(empty string) to prevent regression.
Amp-Thread-ID: https://ampcode.com/threads/T-019ce2aa-679e-711f-bb66-ab107d9394c6
Co-authored-by: Amp <amp@ampcode.com>
config.Initialize() used a configFileSet gate that picked ONE config file
and skipped all lower-priority tiers. This meant the idle-monitor daemon
(which sets BEADS_DIR) never loaded ~/.config/bd/config.yaml, silently
ignoring user-level settings like dolt.auto-commit.
Now all config tiers are collected and merged with proper precedence:
lowest priority loaded first, then each higher tier merged on top via
Viper MergeInConfig. This preserves the documented layering:
BEADS_DIR > project .beads/ > ~/.config/bd/ > ~/.beads/
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduces BEADS_DOLT_SHARED_SERVER mode where multiple beads projects
share a single Dolt server on a fixed port (3308), avoiding per-project
server sprawl. Includes `bd init --shared-server`, `bd dolt shared-*`
commands, doctor checks, and comprehensive tests.
Co-Authored-By: Shybko <shybko@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove all BEADS_NO_DAEMON env var handling from test files (dead code
since daemon removal in v0.50.0), delete stopRepoDaemon() and daemon
file guards from test setup, remove no-daemon config key from tests,
and update daemon→server wording in docs and comments.
37 files changed, -193 lines net.
Co-Authored-By: davetashner <davetashner@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove ConflictStrategy, FieldStrategy types and all associated config
validation, getters, and tests. The 3-way merge engine was superseded by
Dolt-native cell-level merge. Also adds DOLT_ROOT_HOST=% to test containers
for Docker port-forwarding compatibility.
Co-Authored-By: Rudy Alvarez <rudygt@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Fixes#2358. When a user runs `bd config set backup-enabled false`, the
value was stored in the Dolt database. But `isBackupAutoEnabled()` checks
`config.GetValueSource("backup.enabled")` which only inspects Viper
sources (env vars, config.yaml) — never the database. The user-set value
was invisible to the backup auto-enable logic.
Fix: Add backup.* keys to the YamlOnlyKeys prefix list and explicit
entries, so `bd config set` routes them to config.yaml where
`GetValueSource` can detect them as non-default.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
getRoutingConfigValue checked config.GetString() first, which returned Viper
defaults (e.g. "~/.beads-planning" for routing.contributor) even when no YAML
config was present. This shadowed DB-stored values, causing
TestDetermineAutoRoutedRepoPath_ContributorToPlanning and
TestOpenRoutedReadStore_ContributorRouting to fail.
Now uses config.GetValueSource() to only trust explicitly-set values (config
file, env var, or runtime Set()), falling through to the DB for defaults.
Also tracks runtime Set() calls in overriddenKeys so GetValueSource can
distinguish them from Viper defaults.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/refinery
Rig: beads
Role: refinery
Infrastructure types (agent, rig, role, message) were hardcoded in
IsInfraType and duplicated in list.go. Now configurable via DB config
key "types.infra" with config.yaml fallback, following the same pattern
as types.custom. Hardcoded defaults preserved as fallback.
- Add DefaultInfraTypes and IsInfraTypeCtx to ephemeral_routing.go
- Add GetInfraTypes(ctx) to DoltStore with caching
- Add GetInfraTypesFromYAML() to config package
- Update callers in issues.go, list.go, wisp.go to use config-driven API
- Add cache invalidation for types.infra in SetConfig
Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
Solo users get zero off-machine backup by default. This flips the
default: when a git remote exists, auto-enable backup + git push
every 15 minutes. Users can override explicitly via config.yaml or
env vars (BD_BACKUP_ENABLED, BD_BACKUP_GIT_PUSH).
Also adds backup.git-repo config key for using a separate git repo
as the backup target instead of the project repo.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Adds `bd backup` command that exports all database tables to sorted JSONL
files in .beads/backup/ for off-machine recovery. Events are exported
incrementally using a high-water mark. Each table is written atomically
via temp file + rename.
Auto-backup runs in PersistentPostRun when backup.enabled is true,
throttled by backup.interval (default 15m). Optional git-push mode
auto-commits and pushes backup files.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew