Commit Graph

19 Commits

Author SHA1 Message Date
aleiby
f4ee7ee73b fix(routing): default to Maintainer when no git remote exists (#1185)
When no git remote is configured, DetectUserRole() now defaults to
Maintainer instead of Contributor. This fixes issue routing for:

1. New personal projects (no remote configured yet)
2. Intentionally local-only repositories

Previously, issues would silently route to ~/.beads-planning instead
of the local .beads/ directory.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:11:00 -08:00
dennis
1f59119144 fix(sync): use town-level routes for prefix validation
Follow-up to 828fc11b addressing code review feedback:

1. Added LoadTownRoutes() - exported function that walks up to find
   town-level routes.jsonl (e.g., ~/gt/.beads/routes.jsonl)

2. Updated buildAllowedPrefixSet to use LoadTownRoutes instead of
   LoadRoutes, so it finds routes even when importing from a rig's
   local beads directory

3. Added unit tests for buildAllowedPrefixSet covering:
   - Primary prefix inclusion
   - allowed_prefixes config parsing
   - Routes from routes.jsonl
   - Missing routes.jsonl handling
   - Empty beadsDir handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 09:51:46 -08:00
Bo
6b5bebfa12 fix(routing): handle symlinked .beads directories correctly (#1112)
When .beads is a symlink (e.g., ~/gt/.beads -> ~/gt/olympus/.beads),
findTownRoutes() incorrectly used filepath.Dir() on the resolved
symlink path to determine the town root.

This caused route resolution to fail because the town root would be
~/gt/olympus instead of ~/gt, making routes point to non-existent
directories.

The fix adds findTownRootFromCWD() which walks up from the current
working directory instead of the beads directory path. This finds
the correct town root regardless of symlink resolution.

Changes:
- Add findTownRootFromCWD() function
- Update findTownRoutes() to use CWD-based town root detection
- Add fallback to filepath.Dir() for non-Gas Town repos
- Add debug logging (BD_DEBUG_ROUTING=1)
- Add comprehensive test case

Test: go test ./internal/routing/...
2026-01-15 19:20:42 -08:00
Peter Chanthamynavong
31239495f1 fix(routing): complete bd init --contributor routing (bd-6x6g) (#1088)
Implements the missing contributor routing logic so bd init --contributor actually works. Contributors' issues automatically route to ~/.beads-planning/ while maintainers' issues stay local.
2026-01-14 20:50:56 -08:00
Steve Yegge
5f3cb0fdf3 refactor: remove Gas Town references from codebase
Replace Gas Town-specific terminology with generic orchestrator concepts:
- "Gas Town" → "orchestrator" or "multi-clone"
- Hardcoded ~/gt/ paths → GT_ROOT environment variable
- signalGasTownActivity → signalOrchestratorActivity
- GUPP → hook-based work assignment

Updated 21 files across CHANGELOG, cmd/bd/, internal/, docs/, scripts.

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

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

Executed-By: beads/crew/dave
Rig: beads
Role: crew
2025-12-30 14:13:32 -08:00
Jordan Hubbard
c9fa7af04c test: expand compact and ui coverage 2025-12-29 16:01:11 -08:00
Steve Yegge
d3b6855aa9 fix: resolve lint errors blocking CI
- Add explicit error checking for fmt.Fprintf/Fprintln in claude.go
- Add gosec nolint for safe exec.CommandContext calls in sync_git.go
- Remove unused error return from findTownRoutes in routes.go

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 15:58:24 -08:00
Jordan Hubbard
12b797781d test: expand routing and compact coverage 2025-12-29 14:18:33 -08:00
Steve Yegge
819208b8c1 fix: hq- prefix routing by finding town root for routes.jsonl
The routing code now walks up from the current beads directory to find
the Gas Town root (identified by mayor/town.json), then loads routes
from <townRoot>/.beads/routes.jsonl. The '.' path is correctly resolved
to the town beads directory.

Previously, routes.jsonl was only searched in the current beads dir,
which failed when working from rig subdirectories like crew/emma.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:46:10 -08:00
Steve Yegge
1611f16751 refactor: remove unused bd pin/unpin/hook commands (bd-x0zl)
Analysis found these commands are dead code:
- gt never calls `bd pin` - uses `bd update --status=pinned` instead
- Beads.Pin() wrapper exists but is never called
- bd hook functionality duplicated by gt mol status
- Code comment says "pinned field is cosmetic for bd hook visibility"

Removed:
- cmd/bd/pin.go
- cmd/bd/unpin.go
- cmd/bd/hook.go

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:02:15 -08:00
Steve Yegge
c8b912cbe6 bd sync: 2025-12-27 15:56:42 2025-12-27 15:56:42 -08:00
Steve Yegge
2e7b993a88 feat: add --prefix flag for cross-rig issue creation
Adds --prefix as a forgiving alias to --rig flag. Accepts:
- Exact prefix: bd-, gt-
- Prefix without hyphen: bd, gt
- Rig name: beads, gastown

All resolve to the correct rig via routes.jsonl lookup.
This matches agents' mental model of prefix-based routing.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 14:26:00 -08:00
Steve Yegge
21f307de89 feat: add --rig flag for cross-rig issue creation (bd-4nzq)
Adds --rig flag to bd create that allows creating issues in a different
rig without having to cd to that directory.

Example: bd create --rig beads --title='Bug report'

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 00:44:39 -08:00
Steve Yegge
05304e3ab1 Merge origin/main, fix test git init for modern git 2025-12-27 00:17:36 -08:00
Steve Yegge
a958c83422 feat: auto-resolve cross-rig IDs in bd dep add (bd-lfiu)
When `bd dep add` fails to resolve the dependency ID locally, it now
checks routes.jsonl for a matching prefix and auto-converts to an
external reference format (external:<project>:<id>).

This allows simpler syntax like:
  bd dep add gt-xyz bd-abc

Instead of the verbose:
  bd dep add gt-xyz external:beads:bd-abc

New functions in routing package:
- ExtractProjectFromPath: Gets project name from route path
- ResolveToExternalRef: Converts foreign ID to external ref using routes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 23:47:42 -08:00
Ryan Snodgrass
350a78f1ba fix: resolve all golangci-lint errors
Fixes 15 pre-existing lint issues:

errcheck (6 issues):
- mol_distill.go: Add _ = for f.Close() and os.Remove()
- routed.go: Add _ = for routedStorage.Close() (4 locations)

gosec (8 issues):
- maintenance.go, routes.go: Add nolint for G304 (file paths from known dirs)
- mol_distill.go: Add nolint for G304 (file creation in known search paths)
- formula.go: Change WriteFile permissions from 0644 to 0600 (G306)
- gate.go: Add nolint for G204 (exec.Command with trusted AwaitID fields)

misspell (1 issue):
- gate.go: Fix "cancelled" -> "canceled" in comment

unparam (2 issues):
- cook.go, controlflow.go: Add nolint for functions returning always-nil error

Also:
- Update pre-commit-hooks to v6.0.0
- Add lint step to "Landing the Plane" session-end protocol
2025-12-26 19:20:03 -05:00
Steve Yegge
1583c57374 feat: Add prefix-based routing with routes.jsonl (bd-9gvf)
Enables cross-repo issue lookups via routes.jsonl configuration.
Running `bd show gt-xyz` from ~/gt now routes to the correct beads
directory based on the issue ID prefix.

- Add internal/routing/routes.go with routing logic
- Add cmd/bd/routed.go with routed storage helpers
- Update show command to use routed resolution in direct mode
- Support redirect files for canonical database locations
- Debug output available via BD_DEBUG_ROUTING=1

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 14:36:20 -08:00
Steve Yegge
8e05847d31 Fix TestRoutingIntegration and improve DetectUserRole robustness
Amp-Thread-ID: https://ampcode.com/threads/T-fc47ce9d-88a4-4bcd-b9cb-79327d98dee7
Co-authored-by: Amp <amp@ampcode.com>
2025-11-20 19:04:42 -05:00
Steve Yegge
58e915f22b Implement auto-routing for bd create (bd-ubu2)
- Add internal/routing package with DetectUserRole and DetermineTargetRepo
- Add routing config schema (mode, default, maintainer, contributor)
- Add --repo flag to bd create for explicit override
- Integrate routing logic into create command
- Test with contributor/maintainer roles and explicit override

Part of bd-8hf (Auto-routing and maintainer detection)
2025-11-04 23:12:42 -08:00