Skip to content

feat: add gt bead create/update/dep/list/search with prefix routing#3525

Draft
mk-imagine wants to merge 3 commits intogastownhall:mainfrom
mk-imagine:feat/gt-bead-routing
Draft

feat: add gt bead create/update/dep/list/search with prefix routing#3525
mk-imagine wants to merge 3 commits intogastownhall:mainfrom
mk-imagine:feat/gt-bead-routing

Conversation

@mk-imagine
Copy link
Copy Markdown
Contributor

@mk-imagine mk-imagine commented Apr 5, 2026

Summary

Add 5 new subcommands under gt bead that wrap bd commands with prefix-based routing via routes.jsonl:

  • gt bead create — routes by --prefix flag, captures stdout for bead ID relay
  • gt bead update <id> — routes by bead ID prefix
  • gt bead dep <subcmd> <id> — routes by bead ID, skips subcommand token
  • gt bead list — no routing (CWD context), pass-through
  • gt bead search — no routing (CWD context), pass-through

Why: bd doesn't support Gas Town's routes.jsonl prefix routing. Agents calling bd create from the wrong CWD write beads to an invisible local database. gt bead create resolves the prefix to the correct rig database before executing bd. This makes bead operations deterministic regardless of the agent's CWD.

Pattern: Follows existing gt show and gt close routing pattern — resolveBeadDir() + chdir + strip BEADS_DIR + exec bd.

Implementation Steps

6 steps, single phase:

Step Command Routing? Pattern
1 list No syscall.Exec pass-through
2 search No syscall.Exec pass-through
3 update Yes (bead ID) syscall.Exec + routing
4 dep Yes (bead ID after subcmd) syscall.Exec + routing
5 create Yes (--prefix) exec.Command (captures stdout)
6 Help text N/A Update beadCmd.Long

Steps 1+2 and 3+4 can be implemented in parallel.

Key Files

  • internal/cmd/bead.go — register new subcommands
  • internal/cmd/bead_{list,search,update,dep}_unix.go — new, platform-specific exec
  • internal/cmd/bead_routing_test.go — new, unit tests for routing logic

Test plan

  • go build ./... passes
  • go test ./internal/cmd/... -run TestBead passes
  • golangci-lint run clean
  • Manual: gt bead create --prefix <pfx> --title "test" from town root creates bead in correct rig database
  • Manual: gt bead update <pfx>-xxx --notes "test" from town root updates bead in correct rig database

…WIP)

Placeholder for draft PR. Adds 5 routed bd command wrappers under gt bead.
@github-actions github-actions bot added the status/needs-triage Inbox — we haven't looked at it yet label Apr 5, 2026
namuroh and others added 2 commits April 5, 2026 04:05
…x6o)

Replace repeated Dir(resolveBeadDir(id)).StripBeadsDir() pattern with
a single RouteForBead(id) builder method on bdCmd. This prepares for
adding 5 new gt bead subcommands that reuse the same routing logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…hq-x6o)

Add 5 new gt bead subcommands that proxy bd commands with automatic
prefix-based routing to the correct rig database:

- create: routes by --rig flag to target rig
- update: routes by bead ID prefix
- dep: routes by first bead ID prefix
- list: routes by --rig flag to target rig
- search: routes by --rig flag to target rig

Also adds RouteForPrefix() builder method on bdCmd for commands
that accept a prefix rather than a bead ID. Fixes variable shadowing
in cat.go and close.go from the RouteForBead refactoring, and adds
missing io import to convoy_stage.go.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/needs-triage Inbox — we haven't looked at it yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants