Cherry-pick Go code from community PR #2527 (maphew): adds --list flag to
enumerate all commands, --doc flag to generate per-command Docusaurus markdown,
and sidebar position mapping. Also includes lazy getGitContext() in hooks dir
resolution and test skip improvements for missing Dolt server.
Co-authored-by: matt wilkie <maphew@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- FatalError and FatalErrorWithHint now output structured JSON to stderr
when --json flag is active, preventing mixed text/JSON output
- bd restore validates issues.jsonl schema before importing, catching
incompatible export formats early (GH#2492)
- Add restoreResult.Errors and ErrorDetails fields for structured error reporting
- Add 6 JSON contract regression tests for list, show, create, close,
ready, and error output contracts
Co-Authored-By: matt wilkie <maphew@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>
Date-only inputs (--due 2099-03-15) are parsed as local midnight and stored
as UTC. In west-of-UTC timezones, the UTC date rolls back one day. The test
now computes the expected UTC prefix from the local date instead of
hardcoding the input date string.
Fixes#2371
Amp-Thread-ID: https://ampcode.com/threads/T-019cc486-ad63-76ea-9f02-2901e2430428
Co-authored-by: Amp <amp@ampcode.com>
- Protocol tests: use `comments add` instead of nonexistent `comment` command
- critical_paths_test: use epic (not task) for epic-blocks-epic relationship
- template_test: use DepRelated instead of DepBlocks for cross-type "wrong dep"
scenarios, since cross-type blocking is now rejected by storage validation
Fixes tests broken by the cross-type blocking validation added in GH#1495.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/refinery
Rig: beads
Role: refinery
Migrate 12 TestMain files to use EnsureDoltContainerForTestMain/TerminateDoltContainer
instead of the removed StartTestDoltServer/TestDoltServer API.
Replace testServer.IsCrashed()/CrashError() crash detection with standalone
testutil.DoltContainerCrashed()/DoltContainerCrashError() in 6 test files.
(bd-m7sy)
Add t.Parallel() to all 45 top-level test functions in cmd/bd/protocol.
Each test already creates a fully isolated workspace (unique Dolt prefix,
temp dir, git repo) so parallelization is safe. Reduces test time from
~135s to ~42s on the same machine.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/quartz
Rig: beads
Role: polecats
bd init --prefix was creating databases named beads_<prefix> (e.g.,
beads_sky, beads_gt). Convention should use the rig name directly as
the database name. This aligns with gastown doltserver.go which
already uses just the rig name.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/onyx
Rig: beads
Role: polecats
Pin down stable CLI behavior as permanent guardrails:
- Cycle prevention (blocks chain, self-dependency)
- Close guard (respects dep types, blocks for deps, --force override)
- Deferred excluded from ready, restored by undefer
- dep rm unblocks issue
- Supersede creates dep and closes
- Status transitions preserve labels and comments
- Label add/remove round-trip
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Protocol tests were the source of ~35 beads_t* databases on the prod
Dolt server per test run. Each test called bd init with a random prefix
(t + 8 hex chars), creating beads_t<hex> databases on port 3307.
- Add TestMain to protocol tests that starts a dedicated test Dolt server
- Pass BEADS_DOLT_PORT and BEADS_TEST_MODE through workspace env() so
the compiled bd subprocess connects to the test server
- Add beads_t to staleDatabasePrefixes in both dolt.go and doctor/server.go
as a safety net for cleaning legacy pollution
Verified: full go test ./... now creates zero test databases on prod.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The bd export command was removed in commit 1e1568fa as part of the
JSONL-to-Dolt-native refactor, breaking 11 protocol tests. Rewrite all
affected tests to verify data persistence via bd show --json instead of
export roundtrip. Remove unused parseJSONLByID helper.
Fixes: beads-iyu
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/topaz
Rig: beads
Role: polecats
Each newWorkspace() now generates a random prefix (e.g. "t1a2b3c4d")
instead of the shared "test" prefix, so each test gets its own database
(beads_t<random>) on the shared Dolt server. This prevents cross-test
pollution where tests see issues from other concurrent or prior test runs.
Fixes: beads-sqv
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
GetBlockedIssues only checked 'blocks' dependencies, making waits-for
gated issues invisible to bd blocked. Now uses computeBlockedIDs (which
handles both dep types with full gate evaluation) as the canonical
source of truth for blocked status.
Based on PR #2043 by @turian.
Co-Authored-By: Joseph Turian <turian@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bd reopen on an already-open issue now prints "already open" to stderr
and skips instead of printing a false "Reopened" message. bd undefer on
a non-deferred issue now prints "not deferred" and skips similarly.
Authored-by: turian <turian@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bd update --status previously accepted any string silently, while
bd create validated against built-in + custom statuses. This adds the
same validation to update, rejecting invalid status values with a
helpful error message.
Co-Authored-By: Joseph Turian <turian@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- `bd update <id> --title ""` now errors instead of silently blanking
- `bd update <id> --title " "` (whitespace-only) also rejected
- `bd label add <id> ""` now errors instead of adding empty label
- Values are trimmed before storage, not just for validation
- Includes fix for pre-existing doctor file formatting
Based on PR #1994 by @turian.
Co-Authored-By: Joseph Turian <turian@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bd close and bd update now exit 1 when all attempted operations fail
(e.g., closing a blocked issue, updating a nonexistent ID). Partial
success (some closed, some failed) still exits 0.
Adds protocol tests for exit code behavior.
Co-Authored-By: Joseph Turian <turian@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bd defer --until=<past date> silently stored the past date, while
bd update --defer=<past date> already warns. Add the same past-date
warning to bd defer for consistency.
The warning matches the existing update path: prints to stderr and
suggests future-oriented alternatives (+1h, tomorrow).
Includes protocol test verifying the warning appears.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bd comments add accepted empty ("") and whitespace-only (" ") text,
silently creating blank comments. Now validates with strings.TrimSpace
before storing, consistent with the empty-title validation on update.
Includes protocol test verifying both empty and whitespace-only text
are rejected with a non-zero exit code.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bd stale --days 0 and --days -1 silently returned no results instead of
reporting an error. Add early validation (days < 1 → FatalError) to
match the existing status validation pattern in the same command.
Includes a protocol test that verifies both --days 0 and --days -1 are
rejected with a non-zero exit code.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix gofmt alignment in cmd/bd/repo.go
- Replace panic with sentinel port (port 1) in applyConfigDefaults when
BEADS_TEST_MODE=1 without BEADS_DOLT_PORT, preventing CI crashes while
still guarding against accidental production connections
- Add dolt availability skip in protocol_test.go newWorkspace
- Remove stale //go:build cgo tag from molecules_test.go
- Change Fatalf to Skipf for Dolt connection failures in molecule loader tests
- Update store_unit_test.go to match sentinel port behavior
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move BUG-4 test from protocol_test.go into
blocked_status_test.go with proper TestProtocol_ naming.
- TestProtocol_BlockedStatusIsStoredNotComputed
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The --status flag filters by the stored status column, but dependency-
blocked issues keep status "open" — they only appear via 'bd blocked'.
The old help text listed "blocked" without explaining this distinction,
leading users to expect 'bd list --status blocked' to find dependency-
blocked issues.
Updated help text for list, count, search, and query to say "stored
status" and point to 'bd blocked' for dependency-blocked issues.
Adds TestBUG4_BlockedStatusVsBlocked protocol test documenting the
distinction.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>