Commit graph

16 commits

Author SHA1 Message Date
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
Okano, Osamu
138a2b36fc
refactor: remove redirect file creation from bd worktree create (#3051)
findDatabaseInTree already discovers the main repo's .beads via
GetWorktreeFallbackBeadsDir (git common dir), making the redirect
file created by worktree create redundant.

Closes beads-9f74-67m
2026-04-06 20:19:59 -07:00
coffeegoddd☕️✨
18d47e29f1 /cmd/bd: fix format string 2026-03-26 11:25:54 -07:00
coffeegoddd☕️✨
f4b04e2ecd /cmd/bd: remove docker tip in embeddeddolt mode 2026-03-26 11:13:02 -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
Jordan Chase
656a3e5241 fix(worktree): skip gitignore append when parent dir pattern already covers entry
If .gitignore already contains a parent directory pattern (e.g. '.worktrees'),
bd worktree create would still append a per-worktree entry like '.worktrees/my-branch/'
because the string match only checked for an exact line match.

The git check-ignore path handles this correctly but can fail silently on some
systems or git versions; when it does, the fallback string check had no parent-
pattern awareness.

Fix: strip the trailing slash from each gitignore line and check whether the
new entry falls under that prefix, so patterns like '.worktrees', '.worktrees/',
or 'worktrees' correctly suppress the append for any child path.
2026-03-06 12:49:58 -05:00
mrmaxsteel
0e459ab837 fix: avoid redundant worktree gitignore entries 2026-02-27 21:53:35 +00:00
Steven Syrek
abfcdd30a2 fix: resolve worktree redirect paths from worktree root, not .beads/ dir (#1266)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:34:01 +01: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
Wilhelm Uschtrin
f7134954b9
fix(worktree): correct redirect path computation in bd worktree create (#1217)
Computes the relative path from the worktree root instead of the .beads directory. This ensures that FollowRedirect resolves paths correctly relative to the parent of .beads.
2026-01-20 14:04:51 -08:00
Peter Chanthamynavong
0a48519561
feat(context): centralize RepoContext API for git operations (#1102)
Centralizes repository context resolution via RepoContext API, fixing bugs where git commands run in the wrong repo when BEADS_DIR points elsewhere or in worktree scenarios.
2026-01-15 07:55:08 -08:00
aaron-sangster
cca2016376
fix(worktree): resolve worktrees by name from git registry (#921) 2026-01-06 18:45:27 -08:00
Steve Yegge
71e2f22849 fix: Add nolint comments for gosec/errcheck/unparam warnings
Fixes CI lint failures by adding appropriate nolint directives for:
- G204 (subprocess with variable) - git commands with trusted inputs
- G304 (file inclusion via variable) - paths from internal helpers
- G302/G306 (file permissions) - .gitignore needs 0644
- errcheck (unchecked return values) - fmt.Fprint* to stdout/stderr
- unparam (unused parameters) - reserved for future use
2025-12-29 14:39:43 -08:00
Steve Yegge
7ff5481966 fix: resolve golangci-lint errors (errcheck, gosec, unparam)
- orphans.go: check fmt.Scanln return value
- edit.go: #nosec G204 for trusted $EDITOR execution
- sync_git.go: #nosec G204 for git commands with internal branch names
- worktree_cmd.go: #nosec G304/G306 for .gitignore file operations
- migrations: handle rows.Close() error
- doctor_pollution.go: mark unused path parameter

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 20:50:54 -08:00
Steve Yegge
b5ab4f2a3b fix: address code review issues in bd worktree command
- Add CheckReadonly calls to create/remove commands
- Add cleanup on partial failure (remove worktree if beads setup fails)
- Prevent removing main repository as worktree
- Fix gitignore entry to use relative path from repo root
- Remove misleading stash check (stashes are repo-wide, not per-worktree)
- Populate Name field in WorktreeInfo struct
- Add #nosec comments for exec.Command and file reads

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:07:38 -08:00
Steve Yegge
f631299a87 feat: add bd worktree command for parallel development
Adds user-facing worktree management commands:
- bd worktree create <name> - creates worktree with beads redirect
- bd worktree list - shows all worktrees and their beads state
- bd worktree remove <name> - removes worktree with safety checks
- bd worktree info - shows current worktree info

The create command automatically sets up .beads/redirect to point to
the main repos .beads directory, ensuring all worktrees share
the same issue database. This enables parallel development with
multiple agents or features.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 01:01:52 -08:00