Commit graph

70 commits

Author SHA1 Message Date
coffeegoddd☕️✨
7e0d09cbf8 /{internal,cmd}: fix CommitPending 2026-05-01 11:15:02 -07:00
seanmartinsmith
f368f98830
fix: wire embedded backend compat migrations by relocating runner (#3413)
The embedded Dolt backend open path ran only the embedded SQL
migrations via schema.MigrateUp. The defensive backward-compat
migration runner was invoked only from the server-mode path in
dolt.initSchemaOnDB. Pre-existing embedded databases opened by a
newer bd binary therefore skipped every compat migration 001-017,
leaving missing columns and tables unrepaired.

The runner itself has no coupling to package dolt -- it drives
idempotent migration functions that already live in the migrations/
subpackage. Relocating CompatMigration, compatMigrationsList,
RunCompatMigrations, and ListCompatMigrations into package migrations
puts them alongside the functions they drive, and lets both the
server and embedded backends share them without a cross-backend
import.

Changes:
- New internal/storage/dolt/migrations/runner.go with the runner,
  registry list, and the exported List function.
- internal/storage/dolt/migrations.go trimmed to CreateIgnoredTables.
- internal/storage/dolt/store.go and cmd/bd/migrate.go updated to
  call through package migrations.
- internal/storage/embeddeddolt/store.go opens a fresh sql.DB after
  the schema-migration tx commits and calls RunCompatMigrations.
- Regression test: synthetic old-schema DB (drop issues.started_at),
  reopen, assert the compat runner re-adds the column.

Refs GH#3412.

Hook-bypass-reason: local pre-commit hook fails on Windows with
CGO_ENABLED=0 because cmd/bd/init.go references sanitizeDBName,
defined in cmd/bd/store_factory.go which is gated //go:build cgo.
Reproduced against pristine origin/main; not introduced by this
change. Upstream fix in flight at GH#3402 / GH#3403.
2026-04-24 13:56:41 -07:00
coffeegoddd☕️✨
50f715b124 /{cmd,internal}: move local only state to dolt ignored tables 2026-04-14 14:47:30 -07:00
Okano, Osamu
ef6c6e3e48
Follow up remaining runtime .beads fallbacks after GH#3124 (#3183)
* fix(workspace): align resolved workspace messaging and config lookup

intent(workspace): pure worktrees and external BEADS_DIR setups should work without implying a local .beads directory is required
decision(config): derive config repo roots from FindBeadsDir-backed workspace resolution instead of a local-only .beads walk
constraint(workspace-detection): keep FindBeadsDir ordering and storage behavior unchanged while making bd where the primary diagnostic hint
learned(testing): shared-server env and global .beads ignore rules can distort CGO suites, so regression coverage now normalizes those test paths

* fix(bootstrap): align no-workspace JSON wording

intent(bootstrap): machine-readable no-workspace output should match the resolved-workspace guidance used elsewhere on this branch
decision(bootstrap-json): reuse the shared workspace error helpers through a dedicated payload builder so tests can lock the JSON contract
constraint(review-loop): keep the bootstrap CLI flow unchanged outside the no-workspace JSON branch while adding a focused regression test

* fix(where): allow no-workspace diagnostics without db (beads-9f74-5l1)

intent(where): no-workspace guidance should point to a command that actually runs when workspace resolution fails
decision(startup): treat top-level where as a no-db command so it reaches its own handler before database preflight
constraint(where-tests): subprocess mode can change the exact hint text, so the regression test locks the JSON contract and stable guidance fragments instead

* fix(bootstrap): restore bd where guidance for no-workspace output (beads-9f74-3c3)

intent(bootstrap): no-workspace bootstrap guidance should match the resolved-workspace diagnostics introduced on this branch
decision(no-workspace-hints): reuse the shared hint that mentions bd where instead of the bootstrap-specific fallback text
constraint(bootstrap-tests): cover both the payload helper and subprocess CLI path so wording regressions are caught before release

* fix(workspace): remove no-workspace .beads fallbacks (beads-9f74-gr1)

intent(workspace-resolution): finish the GH#3124 follow-up for runtime paths that still fabricated local .beads state
rejected(no-workspace-fallback): inventing ./ .beads paths outside an active workspace hid shared-worktree resolution and created stray files
decision(setup-recipes): keep built-in bd setup recipes usable without a workspace but require an active workspace for custom recipe state
constraint(worktree-support): completion and backup helpers still need to resolve shared main-repo workspaces from a git worktree

* fix(config): skip no-workspace store init for store-free commands

intent(config): review-fix-loop found no-workspace config commands should reach their own graceful paths instead of failing in PersistentPreRun
decision(config-preflight): detect store-free config subcommands before DB synthesis so config.yaml, git-backed, and diagnostic flows can run without an opened store
constraint(json-contract): keep bd config validate --json machine-readable on stdout once pre-run stops short-circuiting into low-level DB errors
learned(config-preflight): the parent config command not being in noDbCommands leaked store init into show, validate, drift, apply, and yaml-only config helpers

* fix(ci): restore init prefix normalization and formatting

intent(ci): clear the current PR failures instead of leaving the branch blocked behind known red checks

decision(init-prefix): normalize dotted prefixes before persisting issue_prefix so config, metadata.json, and Dolt database naming stay aligned for Julia-style repos
constraint(fmt-check): CI runs gofmt over the whole repo, so the existing spacing drift in internal/jira/tracker_test.go had to be cleaned up on this branch to get a green run
learned(ci): the latest main CI was already red on the same formatting file and the same embedded shard, so rebasing surfaced pre-existing blockers rather than introducing a new shard-only regression
2026-04-10 21:23:14 -07:00
coffeegoddd☕️✨
40e5eb11a9 /internal/storage/schema: use shared schema package 2026-04-06 15:03:20 -07:00
coffeegoddd☕️✨
a35edfd28e /{internal,cmd,.goreleaser,.github}: embedded mode by default 2026-03-28 13:47:20 -07:00
coffeegoddd☕️✨
f4b04e2ecd /cmd/bd: remove docker tip in embeddeddolt mode 2026-03-26 11:13:02 -07:00
coffeegoddd☕️✨
979d4f7052 /{cmd,internal}: bootstrap, compact, migrate 2026-03-26 10:59:57 -07:00
coffeegoddd☕️✨
c8bab0c547 /cmd/bd: migrate with tests 2026-03-26 10:14:09 -07:00
coffeegoddd☕️✨
ec6b65d2e1 /{cmd,internal}: fix commands 2026-03-25 13:48:13 -07:00
collins
ac9ac70911 feat: add bd context command and safe-first error guidance (fix-merge PR #2496)
Add bd context command showing effective backend identity (beads dir, repo
root, dolt mode, server endpoint, database, project ID, role) without requiring
DB open -- useful for degraded-state diagnostics. Supports --json.

Update error messages across 13 commands to suggest bd doctor for diagnosis
before bd init for reset, preventing unsafe destructive recovery paths.

Fix: use cfg.GetDoltServerPort() instead of doltserver.DefaultConfig() for
correct port resolution in context command. Add env var isolation in tests
to prevent BEADS_DOLT_PORT interference.

Co-Authored-By: matt wilkie <maphew@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:32:36 -07:00
gastown/crew/mel
87493ce917 fix: remove Beads Classic SQLite backend and migration infrastructure
SQLite is dead. Dolt is the only backend.

- Remove BackendSQLite constant and all SQLite branches from configfile
- GetBackend() now always returns "dolt" (ignores BEADS_BACKEND env var for sqlite)
- DatabasePath() no longer has SQLite path resolution (GH#2016 compat removed)
- Delete 13 SQLite→Dolt migration files (migrate_auto, migrate_dolt, migrate_shim,
  migrate_import, migrate_safety and their tests/nocgo variants)
- Remove --to-dolt flag from bd migrate command
- Remove autoMigrateSQLiteToDolt() call from main.go startup path
- Delete broken_migration doctor check/fix (SQLite residue detection)
- Rescue CheckEmbeddedModeConcurrency into its own file (Dolt-specific, not legacy)
- Update federation and configfile tests to reflect Dolt-only world
- Net: -7,045 lines

Closes: hq-x8jhj, hq-1jaou

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 12:42:09 -08:00
Pablo LION
e5179c719a
#1380 Phase 2: hook migration apply mode (#2235)
* Stabilize hook-related tests by forcing repo-local hooksPath

* Implement hook migration apply mode and matrix execution (#2218)
2026-03-01 14:40:51 -08:00
Pablo LION
dfd9b56812 feat: add hook migration census + doctor signal (bd-w4x.1, #2217)
Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-28 21:16:53 -08:00
beads/crew/lizzy
5f023a101d refactor: remove dead SQLite helpers, connstring.go, and --to-sqlite flag (bd-o0u.6)
Delete 4 sqlite_open CGO variant files (doctor/ and fix/), connstring.go
(SQLite URI builder), handleToSQLiteMigration stubs, and --to-sqlite CLI
flag. ncruces/go-sqlite3 stays in go.mod for extractFromSQLite() legacy
upgrade path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:01:10 -08:00
beads/crew/jane
34fa1c1239 refactor(sync): make bd sync a deprecated no-op, update agent instructions
bd sync was calling CommitPending + Push on every invocation, causing
perceived slowness when agents call it at high velocity. Now prints a
deprecation message and exits immediately without opening the database.

Updated AGENTS.md, AGENT_INSTRUCTIONS.md, SKILL.md, copilot-instructions,
and init templates to reference bd dolt push/pull instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 19:07:02 -08:00
beads/crew/wickham
4102096666 refactor: standardize error handling with FatalError wrappers (bd-qioh)
Convert ~250 instances of direct fmt.Fprintf(os.Stderr)+os.Exit(1)
to FatalError/FatalErrorWithHint/FatalErrorRespectJSON across 54 files.

Complex multi-line messages, warnings, loop-internal errors, and
JSON-branching patterns intentionally preserved where the helpers
do not fit cleanly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 16:27:09 -08:00
ZenchantLive
818c6f0226 docs: remove stale daemon command references (GH#1819) 2026-02-18 22:50:21 -08:00
beads/crew/emma
ff7244b619 feat: remove JSONL sync-branch pipeline, replace with Dolt-in-Git
Remove 10,955 lines of dead code from the JSONL sync-branch pipeline,
now replaced by native Dolt push/pull via git remotes.

Deleted:
- internal/syncbranch/ (5,720 lines: worktree management, integrity checks)
- cmd/bd/deletion_tracking.go (3-way JSONL merge)
- cmd/bd/snapshot_manager.go (JSONL snapshot tracking)
- cmd/bd/doctor/sync_branch_jsonl.go (JSONL validation)
- cmd/bd/doctor/fix/sync_branch.go (sync branch repair)
- All associated test files

Preserved:
- bd export / bd import (manual tools)
- isGitRepo(), gitHasUpstream() (still have callers)
- Doctor check stubs (return StatusOK N/A)

Added:
- BootstrapFromGitRemote() for Dolt-in-Git bootstrap
- Dolt push in bd sync via store.Push()
- sync.git-remote config key
- HasRemote() on DoltStore

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-18 20:13:55 -08:00
Martin Volerich
d18e9532f4 fix(sync-branch): wire up worktree commit infrastructure to callsites
The sync-branch worktree infrastructure (EnsureWorktree, CommitToSyncBranch)
existed but was never called. This wires it up from the 4 callsites that
need it: init, sync, hook pre-commit, and migrate sync.

- init.go: create worktree after syncbranch.Set() (non-fatal)
- sync.go: commit to sync branch after JSONL export, push if remote exists
- hook.go: route to sync branch instead of staging on main when configured
- migrate.go: create worktree after syncbranch.Set() (non-fatal)
- store_nocgo.go: add missing ServerTLS field to nocgo Config stub

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:27:29 -05:00
Martin Volerich
108212253a fix(dolt): resolve database naming mismatch and JSONL export issues
Five interrelated fixes for Dolt backend initialization and runtime:

1. Always use canonical database name "beads" instead of "beads_<prefix>"
   so bd doctor, hooks, and other subcommands can find the database
   without prefix guessing.

2. Pre-commit hook no longer skips JSONL export when sync-branch is
   configured — Dolt export runs regardless of sync-branch mode.

3. runJSONLExport() now calls "bd export -o" instead of the no-op
   "bd sync --flush-only".

4. "bd sync" performs a JSONL export in Dolt mode instead of being a
   silent no-op, keeping the on-disk JSONL in sync with Dolt.

5. Wire "bd migrate sync <branch>" as a proper subcommand so that
   bd doctor's recommendation actually works.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:38:00 -05:00
beads/crew/emma
896d5ed361 Dolt-native cleanup: remove legacy code, rename API, add server watchdog
Delete migrate_hash_ids.go (760 lines) and remove hash-ids subcommand,
doctor checks, and readonly test cases. Relocate copyFile to migrate.go
for migrate_dolt.go and repair.go. Rename public API beads.NewStorage()
to beads.Open() across code, tests, examples, and docs. Clean up
transitional SQLite-era comments in store.go and context.go. Add server
mode watchdog with TCP+SQL health probes, auto-restart with stale PID
cleanup, exponential backoff, and clean shutdown.

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 23:43:20 -08:00
beads/crew/emma
b62e495943 refactor: restore --to-dolt migration, fix tests for Dolt-only backend (bd-h0zvj.3)
Restore bd migrate --to-dolt for users still on SQLite. Update all tests
that referenced .db files to use dolt/ directories. Fix FindAllDatabases
to detect dolt directories. Remove daemon-related test expectations
removed in Phase 8.

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 17:14:53 -08:00
beads/crew/emma
6c82467b71 refactor: remove SQLite migration code and legacy backend detection (bd-h0zvj.3) [WIP]
Phase 3 of Dolt-Native Pruning. Removed ~1,855 lines:
- Deleted migrate_dolt_cmd.go, migrate_dolt_cmd_nocgo.go, migration_hint.go
- Gutted migrate_dolt.go to just listMigrations()
- Removed SQLite codepaths from migrate.go (detectDatabases, getDBVersion, etc.)
- Removed BackendSQLite constant from configfile
- Removed GetConfiguredBackend, LegacyDatabaseNames from beads.go
- Removed NewSQLiteStorage from public API
- Simplified findDatabaseInBeadsDir (no more .db file scanning)
- Simplified backend_migration doctor check (always Dolt)
- Removed SQLite migration hint from main.go

WIP: Need to restore bd migrate --to-dolt as user migration path,
and fix remaining test failures in configfile, beads, cmd/bd packages.

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 17:00:55 -08:00
beads/crew/emma
12f9037d87 refactor: replace factory/memory imports with direct dolt calls (Phase 7 cleanup)
Phase 7 (a5da57e3) deleted internal/storage/factory/ and internal/storage/memory/
but left 30+ files still importing them. This commit fixes all broken references:

- Created internal/storage/dolt/open.go with NewFromConfig/NewFromConfigWithOptions
- Replaced all factory.New/NewFromConfig/NewWithOptions with dolt equivalents
- Broke import cycles in dolt/bootstrap.go (routing/utils/audit → local types)
- Removed dead storage.Config struct
- Converted all test files from memory.New() to dolt.New() test stores
- Removed tests that depended on deleted detectPrefix/LoadFromIssues/mockRemoteStore

46 files changed, 249 insertions(+), 851 deletions(-)

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 13:22:06 -08:00
beads/crew/emma
7eed8b8a1e refactor: remove tombstone/soft-delete system (Phase 4)
Remove the tombstone soft-delete mechanism across the codebase. Dolt handles
delete propagation natively, making tombstones obsolete.

Key changes:
- Remove StatusTombstone constant and all status checks
- Remove DeletedAt/DeletedBy/DeleteReason/OriginalType fields from Issue struct
- Remove resurrection mechanism (JSONL parent recovery), replace with existence checks
- Simplify schema CHECK constraint (2 clauses instead of 3)
- Remove compact_tombstone.go, resurrection.go, migrate_tombstones.go
- Remove tombstone-specific tests (resurrection, expired tombstones, migration)
- Update doctor/fix validation to skip tombstone-specific checks
- Preserve migration files for backward compatibility with existing databases
- 104 files changed, 6117 deletions, 422 insertions

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-14 21:22:24 -08:00
jasper
619f34a441 chore: add explanatory comments to silently ignored errors across codebase
Code health review found 30+ instances of error suppression using blank
identifier without explanation. Added comments to 82 files explaining WHY
each error is safely ignored (best-effort cleanup, advisory operations,
safe defaults, etc.) to improve code maintainability.

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

Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
2026-02-14 17:16:43 -08:00
Peter Chanthamynavong
f7311e9136
fix: reliable metadata writes for Dolt backend (bd_version, repo_id, clone_id) (#1741)
* fix(init): add belt-and-suspenders metadata verification for Dolt backend

bd init --backend dolt silently swallowed metadata write failures for
bd_version, repo_id, and clone_id. Doctor and daemon then failed with
confusing errors about missing metadata.

Add verifyMetadata() helper that writes each field then reads it back,
emitting a specific warning with "bd doctor --fix" guidance on failure.
Init continues (non-fatal) but failures are now visible and actionable.

- Add verifyMetadata() write+verify helper to init.go
- Replace Pattern B (warn-and-swallow) with belt-and-suspenders pattern
- Handle non-git environments gracefully (skip repo_id with warning)
- Add function-level tests for all 3 fields, failure paths, and edge cases
- Add e2e test for init→doctor roundtrip validation

Refs: steveyegge/beads#1725

* fix(doctor): add FixMissingMetadata for Dolt databases and update fix messages

Add doctor --fix metadata remediation for existing Dolt databases missing
bd_version, repo_id, or clone_id. Wire into both Database and Repo Fingerprint
doctor check cases. Update fix messages to suggest 'bd doctor --fix' instead
of 'bd migrate'.

* fix(migrate): set repo_id and clone_id when version is current

Problem:
- Migration skipped repo_id and clone_id when bd_version matched
- Missing identity fields left Dolt metadata incomplete

Solution:
- Extend Dolt metadata migration to set repo_id and clone_id
- Cover migration paths with unit and e2e tests

Impact:
- Repositories keep identity fields even when version is current
- Metadata migration behaves consistently across scenarios

* fix(init): remove unused quiet parameter from verifyMetadata

golangci-lint flagged the quiet parameter as unused (unparam). The
function always prints warnings on failure, and callers already gate
success messages externally. Metadata write warnings should always
be visible regardless of quiet mode.
2026-02-14 14:50:31 -08:00
mayor
a72f3bfe36 fix(migrate): use config-based backend instead of hardcoded Dolt
The schema version update path in `bd migrate` was hardcoded to open
the database as Dolt (`storagefactory.New(ctx, BackendDolt, path)`),
which fails for SQLite-backend databases with:
  "bootstrap failed: failed to create Dolt store: mkdir .beads/beads.db: not a directory"

Use `NewFromConfigWithOptions` (which reads backend from metadata.json)
like every other code path in migrate.go already does.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:51:35 +05:45
emma
6258234f9e fix: resolve remaining CI lint, formatting, and Windows build failures
- Fix unused `force` param in doExportSync (sync.go)
- Fix unused `ctx` param in shouldUseIncrementalExport (sync_export.go)
- Fix Windows build: move dolt.ListMigrations() behind CGO build tag
  via listMigrations() bridge in migrate_dolt.go/migrate_dolt_nocgo.go
- Run gofmt on 19 remaining unformatted files across cmd/bd/ and internal/

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-10 12:47:29 -08:00
collins
237f47ba7e feat: delete SQLite storage backend (Phase 2 of Dolt transition)
Remove the entire internal/storage/sqlite/ package (~43K lines) and update
all 80+ files that imported it to use either the Dolt backend directly
(test files) or the storage factory (production files).

Key changes:
- Delete internal/storage/sqlite/ directory (150+ files)
- Update factory to make Dolt the sole backend, treating "sqlite" as alias for "dolt"
- Replace sqlite.New() calls with dolt.New() in tests, factory.New() in production
- Replace *sqlite.SQLiteStorage with storage.Storage interface throughout
- Replace :memory: SQLite URIs with t.TempDir() for Dolt compatibility
- Inline sqlite.GenerateIssueID() as SHA-256 content hashing where needed
- Fix import cycle in routing/routes.go (routing→factory→dolt→routing)
- Preserve backward-compatible beads.NewSQLiteStorage() wrapper in public API

228 files changed, 605 insertions, 43,821 deletions.
go vet ./... passes clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 12:23:15 -08:00
beads/crew/lizzy
2bb827facb style: run gofmt across entire codebase (bd-nmk12)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:35:20 -08:00
beads/crew/lizzy
69ab6b67cb fix: add bounds checks for slice/string access in migrate.go (dolt-test-atg)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:23:13 -08:00
jasper
82f64353c6 fix(migrate): use storage factory for backend-aware database access
The migrate command hardcoded sqlite.New() in several code paths, causing
failures when the backend is Dolt (directory-based storage). This fixes:

- handleUpdateRepoID: uses storagefactory.NewFromConfigWithOptions instead
  of sqlite.New, so bd migrate --update-repo-id works with both backends
- Main migrate flow: detects Dolt backend early and handles metadata
  updates via storage factory, avoiding the SQLite-only detectDatabases
  flow that cannot find Dolt directories
- handleInspect: opens database via storage factory for read-only inspection
- handleToSeparateBranch: opens database via storage factory
- doctor fix/repo_fingerprint: reinitialize option now detects backend and
  uses os.RemoveAll for Dolt directories vs os.Remove for SQLite files

Fixes: gt-dolt-metadata

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

Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
2026-01-30 23:53:57 -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
beads/crew/giles
b420018b97 fix: validate sync.branch in team wizard and migrate commands (GH#923)
Two code paths bypassed syncbranch.ValidateSyncBranchName(), allowing
main/master to be set as sync.branch and causing worktree conflicts.
Now both use syncbranch.Set() for proper validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 23:42:49 -08:00
Steve Yegge
fb5fd88722 feat: integrate migration detection into bd doctor (bd-7l27)
Add a consolidated "Pending Migrations" check to bd doctor that:
- Detects sequential ID usage (suggests bd migrate hash-ids)
- Detects legacy deletions.jsonl (suggests bd migrate tombstones)
- Detects missing sync-branch config (suggests bd migrate sync)
- Detects database version mismatches (suggests bd migrate)

Also updates existing checks to use correct modern commands:
- CheckIDFormat: bd migrate hash-ids (was bd migrate --to-hash-ids)
- CheckDeletionsManifest: bd migrate tombstones (was bd migrate-tombstones)
- CheckSyncBranchConfig: bd migrate sync beads-sync (was config.yaml edit)

Removes TODO(bd-7l27) comments from migrate_*.go files.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:06:42 -08:00
Steve Yegge
27de61fbd0 chore: Convert scattered TODOs to tracked issues (bd-lrj8)
Created 7 new beads to track TODOs that were previously inline comments:

- bd-7l27: Integrate migration detection into bd doctor (5 files)
- bd-6x6g: Add multi-repo target repo switching in bd create
- bd-ag35: Add daemon RPC endpoints for config and stale check
- bd-2dwo: Remove deprecated daemon logger function
- bd-0qx5: Implement Jira issue timestamp comparison for sync
- bd-7zka: Implement formula features (repeat, for_each, branch, gate, split)
- bd-h048: Refactor sync_test to use direct import logic

Updated 16 TODO comments to include bead ID references for tracking.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:34:24 -08:00
Steve Yegge
135802f1aa Consolidate CLI commands to reduce top-level surface area
- migrate-* commands → subcommands of `bd migrate`
- relate/unrelate → subcommands of `bd dep`
- daemons subcommands → available under `bd daemon`
- comment alias → hidden with deprecation warning

All old commands still work with deprecation warnings for backwards
compatibility. Reduces visible top-level commands from ~73 to 66.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 13:52:21 -08:00
Steve Yegge
e67f27c092 bd sync: 2025-12-23 23:38:57 2025-12-24 00:06:41 -08:00
Steve Yegge
2de1695615 bd sync: 2025-12-23 22:33:32 2025-12-23 22:33:33 -08:00
Steve Yegge
cf9e5a597b bd sync: 2025-12-23 20:50:50 2025-12-23 20:50:50 -08:00
Steve Yegge
9c8761abc9 bd sync: 2025-12-23 20:45:19 2025-12-23 20:45:19 -08:00
Steve Yegge
03b12e4b4b Standardize error handling: use FatalError in compact.go, sync.go, migrate.go
Replace direct fmt.Fprintf(os.Stderr, "Error:...") + os.Exit(1) patterns with
FatalError() and FatalErrorWithHint() helpers for consistent error handling.

Files updated:
- compact.go: All 48 os.Exit(1) calls converted
- sync.go: All error patterns converted (kept 1 valid summary exit)
- migrate.go: Partial conversion (4 patterns converted)

This is incremental progress on bd-qioh. Remaining work: ~326 error patterns
across other cmd/bd files.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 13:46:43 -08:00
Steve Yegge
25061ea9a7 chore: code health review - test fix and error comments (bd-9g1z, bd-ork0)
- Remove TestFindJSONLPathDefault from .test-skip (now passes)
- Add explanatory comments to 24 ignored error locations in cmd/bd:
  - Cobra flag methods (MarkHidden, MarkRequired, MarkDeprecated)
  - Best-effort cleanup/close operations
  - Process signaling operations

Part of code health review epic bd-tggf.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 21:30:57 -08:00
Steve Yegge
fc0b98730a refactor: consolidate duplicate path-finding utilities (bd-74w1, bd-4nqq)
- Add git.GetRepoRoot() with Windows path normalization
- Update beads.findGitRoot() to delegate to git.GetRepoRoot()
- Replace findBeadsDir() with beads.FindBeadsDir() across 8 files
- Remove duplicate findBeadsDir() and findGitRoot() function definitions
- Remove dead test code (TestInfoCommand, TestInfoWithNoDaemon)
- Update tests to work with consolidated APIs

Part of Code Health Review Dec 2025 epic (bd-tggf).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 21:15:41 -08:00
Ryan Snodgrass
6ca141712c
refactor(ui): standardize on lipgloss semantic color system
Replace all fatih/color usages with internal/ui package that provides:
- Semantic color tokens (Pass, Warn, Fail, Accent, Muted)
- Adaptive light/dark mode support via Lipgloss AdaptiveColor
- Ayu theme colors for consistent, accessible output
- Tufte-inspired data-ink ratio principles

Files migrated: 35 command files in cmd/bd/

Add docs/ui-philosophy.md documenting:
- Semantic token usage guidelines
- Light/dark terminal optimization rationale
- Tufte and perceptual UI/UX theory application
- When to use (and not use) color in CLI output
2025-12-20 17:09:50 -08:00
Steve Yegge
28a661a320 feat: add --readonly flag for worker sandboxes (gt-ymo)
Add a --readonly flag that blocks all write operations, allowing workers
to read beads state without modifying it. Workers can use:
- bd show, bd list, bd ready (read operations)

Workers cannot use:
- bd create, bd update, bd close, bd sync, etc. (write operations)

The flag can be set via:
- --readonly flag on command line
- BD_READONLY=true environment variable
- readonly: true in config file

This enables swarm workers to see their assigned work from a static
snapshot of the beads database without accidentally modifying it.

Commands protected by readonly mode:
- create, update, close, delete, edit
- sync, import, reopen
- comment add, dep add/remove, label add/remove
- repair-deps, compact, migrate, migrate-hash-ids, migrate-issues
- rename-prefix, validate --fix-all, duplicates --auto-merge
- epic close-eligible, jira sync

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 23:44:22 -08:00
Steve Yegge
57253f93a3 Context propagation with graceful cancellation (bd-rtp, bd-yb8, bd-2o2)
Complete implementation of signal-aware context propagation for graceful
cancellation across all commands and storage operations.

Key changes:

1. Signal-aware contexts (bd-rtp):
   - Added rootCtx/rootCancel in main.go using signal.NotifyContext()
   - Set up in PersistentPreRun, cancelled in PersistentPostRun
   - Daemon uses same pattern in runDaemonLoop()
   - Handles SIGINT/SIGTERM for graceful shutdown

2. Context propagation (bd-yb8):
   - All commands now use rootCtx instead of context.Background()
   - sqlite.New() receives context for cancellable operations
   - Database operations respect context cancellation
   - Storage layer propagates context through all queries

3. Cancellation tests (bd-2o2):
   - Added import_cancellation_test.go with comprehensive tests
   - Added export cancellation test in export_test.go
   - Tests verify database integrity after cancellation
   - All cancellation tests passing

Fixes applied during review:
   - Fixed rootCtx lifecycle (removed premature defer from PersistentPreRun)
   - Fixed test context contamination (reset rootCtx in test cleanup)
   - Fixed export tests missing context setup

Impact:
   - Pressing Ctrl+C during import/export now cancels gracefully
   - No database corruption or hanging transactions
   - Clean shutdown of all operations

Tested:
   - go build ./cmd/bd ✓
   - go test ./cmd/bd -run TestImportCancellation ✓
   - go test ./cmd/bd -run TestExportCommand ✓
   - Manual Ctrl+C testing verified

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 21:57:23 -05:00
Steve Yegge
734579b1a2 Remove version field from metadata.json
- Removes noisy version mismatch warnings on every bd upgrade
- Version field in metadata.json was redundant with daemon version checking via RPC
- Daemon version mismatches still detected via HealthResponse
- Removes checkVersionMismatch() function and related test file
- Updates .beads/.gitignore to properly ignore merge artifacts

Amp-Thread-ID: https://ampcode.com/threads/T-7ba8aff2-97a0-4d0c-9008-e858bdfadd61
Co-authored-by: Amp <amp@ampcode.com>
2025-11-08 18:16:39 -08:00