* cmd/bd: extract sanitizeDBName to its own file for CGO_ENABLED=0 lint
sanitizeDBName lived in store_factory.go which is //go:build cgo,
but init.go (no tag) calls it. The pre-commit golangci-lint runs
with CGO_ENABLED=0 and flagged it as undefined. Move the pure-Go
function to its own untagged file and drop the now-unused strings
import from store_factory.go. No behavior change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* schema: tolerate "does not have column" errors in migration runner
Broadens isConcurrentInitError to also treat "does not have column"
as a benign migration error, symmetric with the existing "duplicate
column" tolerance for ADD races. Makes DROP COLUMN migrations
idempotent across databases bootstrapped with different base schemas.
Observed failure: migration 0032 (DROP COLUMN applied_at) loops
forever on any database that lands at v31 without the column. Dolt
has no DROP COLUMN IF EXISTS, so the SQL itself can't be guarded;
handling it in the runner keeps the migration file trivial.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Add migration 0032 idempotence tests (bd-7mh.3)
* Document bd execution metadata workflow (bd-b1a)
* Revert "Document bd execution metadata workflow (bd-b1a)"
This reverts commit 0d6a96babd.
* Reapply "Document bd execution metadata workflow (bd-b1a)"
This reverts commit df90cf5404.
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
Upgrading from v0.63.x (Go-based migrations, no schema_migrations tracking)
to v1.0.x hits the backfillMigrations path because schema_migrations is
empty but issues already exists. In that path runMigrations ran each
.up.sql as a single multi-statement Exec with tolerateExisting=true.
Migration 0027 has two ALTERs (issues, wisps); EnsureIgnoredTables has
already added started_at to the dolt-ignored wisps table, so the second
ALTER errors with duplicate column. Depending on driver multi-statement
semantics this can abort the batch before the issues ALTER takes effect,
while the version is still recorded — schema_migrations lies about what
was applied and bd list later fails with:
Error 1105: column "started_at" could not be found in any table in scope
Two-layer fix:
- Split each migration's SQL into individual statements and execute them
one-by-one. Guarantees every statement is attempted regardless of
driver batch-abort behavior, without changing error tolerance.
- Add MigrateAddStartedAtColumn compat migration (017) that idempotently
ensures started_at exists on issues and wisps. Runs after the SQL
pipeline and repairs databases already broken by the batch-abort race.
Regression test covers drop → migrate → re-run idempotency.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* 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>
* feat(issues): add started_at timestamp (GH#2796)
Adds a `started_at` field to issues that is auto-populated when an
issue transitions to in_progress status. Preserved across subsequent
status changes.
- Migration 0027 adds started_at column to issues and wisps tables
- ManageStartedAt() in issueops mirrors ManageClosedAt() pattern
- Query filter support: `started>2026-01-01`, `started<...`
- Displayed in `bd show` between Created and Updated
- Exposed in --json output via struct tag
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: gofmt alignment in update.go and types.go
Amp-Thread-ID: https://ampcode.com/threads/T-019d887d-4eb1-7648-96be-8d906797c382
Co-authored-by: Amp <amp@ampcode.com>
* fix(claim): set started_at when claiming via --claim (GH#2796)
ClaimIssueInTx had its own bespoke UPDATE that only wrote assignee, status,
and updated_at. Since `bd update --claim` is the canonical way agents transition
issues to in_progress, started_at was left NULL in the common case. Set it on
first transition, mirroring ManageStartedAt's guard (preserve existing value on
re-claim).
Also document the `started` field in `bd query --help`.
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Amp <amp@ampcode.com>