Commit Graph

3602 Commits

Author SHA1 Message Date
Steve Yegge
fd8b987189 Merge branch 'pr-678' 2025-12-21 12:42:29 -08:00
Steve Yegge
f1e4c4f4a5 Merge branch 'pr-677' 2025-12-21 12:42:11 -08:00
Steve Yegge
9a10753cff docs: remove obsolete bd ready/list from beads agent instructions
- Add mail cwd clarification (run from YOUR directory, not ~/gt)
- Remove bd ready/list from workflow - overseer directs work
- Update Pro Tips and Important Rules sections
- Simplify CLI Quick Reference and Workflow sections

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 11:53:36 -08:00
Steve Yegge
ddfabbca58 refactor(mol): split 1218-line mol.go into subcommand files
Split monolithic mol.go into 7 focused files:
- mol.go (76 lines): root command, shared constants
- mol_catalog.go (83): bd mol catalog
- mol_show.go (76): bd mol show
- mol_spawn.go (238): bd mol spawn
- mol_run.go (137): bd mol run
- mol_bond.go (382): bd mol bond + helpers
- mol_distill.go (307): bd mol distill + helpers

Closes bd-cnwx

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 11:43:43 -08:00
Steve Yegge
2602a768ad bd sync: 2025-12-21 11:43:33 2025-12-21 11:43:33 -08:00
Steve Yegge
091cba87a5 bd sync: 2025-12-21 11:31:46 2025-12-21 11:31:54 -08:00
Steve Yegge
982a3e10e8 bd sync: 2025-12-21 11:31:09 2025-12-21 11:31:54 -08:00
Steve Yegge
98b5bb5388 bd sync: 2025-12-21 11:30:36 2025-12-21 11:31:54 -08:00
Steve Yegge
0ebc06b0e0 bd sync: 2025-12-21 11:18:33 2025-12-21 11:31:54 -08:00
Steve Yegge
acba84ef7f fix(memory): exclude pinned issues from GetReadyWork
SQLite storage already excluded pinned issues from ready work
(bd-92u), but memory storage was missing this check. Pinned
issues are context markers, not actionable work items.

Closes bd-o9o.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 11:30:58 -08:00
Steve Yegge
213a61c2be fix(mol): persist template label in bondProtoProto + add comprehensive tests
Code review found that bondProtoProto was setting Labels on the compound
issue, but CreateIssue doesn't persist labels (they're stored separately.
Fixed by calling AddLabel after creating the compound.

Also added comprehensive tests for:
- isProto() - template label detection
- operandType() - proto vs molecule string
- minPriority() - priority comparison
- bondProtoProto() - compound proto creation with deps and labels
- bondProtoMol() - spawn proto and attach to molecule
- bondMolMol() - join two molecules with sequential/parallel bonds

Tests verify dependency types (blocks vs parent-child) based on bond type.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
EOF
)
2025-12-21 11:18:27 -08:00
matt wilkie
12e3809aef fix: correct misspelling 'cancelled' to 'canceled' 2025-12-21 12:15:14 -07:00
matt wilkie
5a2976b500 fix: remove unused channels in timeout message helpers
The timerChan and timeoutChan variables were created but never read from,
causing lint errors. Removed them since we don't need channel synchronization -
we only want the timeout to trigger a message, not block anything.
2025-12-21 12:13:39 -07:00
Steve Yegge
6580178226 feat(mol): smart --var detection for distill accepts both syntaxes
Agents naturally use spawn-style (variable=value) for both spawn and
distill commands. Now distill accepts both:
- --var branch=feature-auth (spawn-style)
- --var feature-auth=branch (substitution-style)

Smart detection checks which side appears in the epic text:
- Right side found → spawn-style (left is varname)
- Left side found → substitution-style (left is value)
- Both found → prefers spawn-style (more common guess)

Embodies the Beads philosophy: watch what agents do, make their guess correct.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 11:10:04 -08:00
Steve Yegge
feb1275469 bd sync: 2025-12-21 11:09:54 2025-12-21 11:09:54 -08:00
matt wilkie
03118e7226 feat(sync): add timeout message for long-running git operations (fixes #647)
When git push or other git operations hang waiting for credential/browser
auth, show a helpful message to the user after 5 seconds of inactivity
instead of appearing frozen.

Added:
- runCmdWithTimeoutMessage() in internal/syncbranch/worktree.go
- runGitCmdWithTimeoutMsg() in cmd/bd/sync.go
- Both functions print a message after timeout delay with advice
  to check for browser auth prompts

Fixes issue #647 (bd sync frozen waiting for browser auth)
2025-12-21 12:05:13 -07:00
Steve Yegge
16518223a4 feat(mol): add --attach flag for spawn-time bonding
Adds --attach (repeatable) and --attach-type flags to bd mol spawn
for on-the-fly composition of molecules.

Usage:
  bd mol spawn mol-feature --attach mol-testing --attach mol-docs

Each attached proto is spawned and bonded to the primary molecule
using the specified bond type (default: sequential).

Also fixes a pre-existing bug where bondProtoMol and bondMolMol tried
to add both parent-child AND blocks dependencies between the same
issues, violating the UNIQUE constraint on (issue_id, depends_on_id).
Now sequential bonds use blocks type, parallel/conditional use
parent-child.

Closes bd-obep

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 10:43:27 -08:00
Steve Yegge
132d6c396d bd sync: 2025-12-21 10:42:50 2025-12-21 10:42:50 -08:00
Steve Yegge
7e89aa536f bd sync: 2025-12-21 10:32:29 2025-12-21 10:36:56 -08:00
Steve Yegge
50167d0c96 bd sync: 2025-12-21 10:23:33 2025-12-21 10:36:56 -08:00
Steve Yegge
0992f22767 bd sync: 2025-12-21 10:13:15 2025-12-21 10:36:56 -08:00
Steve Yegge
5bf3515e8e feat(mol): add distill command to extract protos from epics
Implements bd mol distill to reverse the spawn operation:
- molecule → proto (spawn is proto → molecule)

Features:
- --as flag for custom proto title
- --var value=variable to replace concrete values with placeholders
- --dry-run to preview the distilled structure
- Preserves full subgraph structure and dependencies
- Adds template label to all cloned issues

Also updates AGENTS.md with landing checklist.

Closes: bd-iq19

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 10:32:23 -08:00
matt wilkie
9db8efaa5c docs: update docs.md for bidirectional DBJSONLSync fix (bd-68e4) 2025-12-21 11:25:57 -07:00
matt wilkie
2de4d0facd fix(bd-68e4): make DBJSONLSync bidirectional - export DB when it has more issues
- Modified fix.DBJSONLSync() to detect which direction to sync:
  - If DB > JSONL: run 'bd export' to sync JSONL (DB has newer data)
  - If JSONL > DB: run 'bd sync --import-only' to import (JSONL is source of truth)
  - If equal but different timestamps: use file mtime to decide direction

- Updated CheckDatabaseJSONLSync() error messages to recommend correct fix direction:
  - Shows different guidance based on whether DB or JSONL has more issues

- Added helper functions:
  - countDatabaseIssues() to count issues in SQLite
  - countJSONLIssues() to count issues in JSONL (local, avoids circular import)

- Added tests for countJSONLIssues() with edge cases

Fixes issue where 'bd doctor --fix' would recommend 'bd sync --import-only'
when DB > JSONL, which would be a no-op since JSONL hasn't changed.
2025-12-21 11:22:37 -07:00
Steve Yegge
386b513ed0 feat(mol): add polymorphic bond command
Implement bd mol bond for composing protos and molecules:
- proto + proto → compound proto (reusable template)
- proto + mol → spawn proto, attach to molecule
- mol + proto → spawn proto, attach to molecule
- mol + mol → join into compound molecule

Supports --type (sequential/parallel/conditional) and --dry-run flags.
Closes bd-o91r.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 10:10:43 -08:00
Steve Yegge
1c58aabaa3 bd sync: 2025-12-21 10:10:26 2025-12-21 10:10:26 -08:00
Steve Yegge
fa90c95475 bd sync: 2025-12-21 01:33:20 2025-12-21 01:33:20 -08:00
Steve Yegge
0618bebe01 bd sync: 2025-12-21 01:30:32 2025-12-21 01:30:40 -08:00
Steve Yegge
b2fcfecda3 chore: ignore .beads/redirect (local external repo pointer)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 01:22:31 -08:00
Steve Yegge
466c606eb9 feat(mol): rename bond→spawn, add BondRef data model
Molecule evolution:
- Rename `bd mol bond` to `bd mol spawn` for instantiation
- Add BondRef type for tracking compound lineage
- Add `bonded_from` field to Issue for compound molecules
- Add BondType constants (sequential, parallel, conditional, root)
- Add IsCompound() and GetConstituents() helpers
- Add 'protomolecule' easter egg alias

Closes: bd-mh4w, bd-rnnr
Part of: bd-o5xe (Molecule bonding epic)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 01:20:25 -08:00
Steve Yegge
9336d2dd1a bd sync: 2025-12-21 01:20:06 2025-12-21 01:20:06 -08:00
Steve Yegge
88c1ad9fee bd sync: 2025-12-21 01:10:57 2025-12-21 01:10:57 -08:00
Steve Yegge
3ba3e945f2 feat(mail): add bd mail delegate command for agent UX
Agents naturally type 'bd mail' when working with beads, but mail
functionality is provided by orchestrators like Gas Town. This command
bridges that gap by delegating to a configured mail provider.

Configuration options (checked in order):
  1. BEADS_MAIL_DELEGATE or BD_MAIL_DELEGATE env var
  2. mail.delegate config setting

Example usage:
  export BEADS_MAIL_DELEGATE="gt mail"
  bd mail inbox           # Runs: gt mail inbox
  bd mail send mayor/...  # Runs: gt mail send mayor/...

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:34:49 -08:00
Steve Yegge
e94cea1c37 docs: fix bd mail → gt mail in CLAUDE.md
gt mail is the correct command for Gas Town mail routing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:20:44 -08:00
Steve Yegge
8e17dcff6d feat(mol): add bd mol run command for durable execution
bd mol run = bond + assign + pin:
- Bonds the molecule (creates issues from template)
- Assigns root to the caller
- Sets root status to in_progress
- Pins root issue for session recovery

After a crash or session reset, the pinned root ensures the agent
can resume from where it left off by checking 'bd ready'.

This is the Gas Town integration point that makes molecules immortal.

Closes: bd-icnf

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:07:19 -08:00
Steve Yegge
b950604e0a refactor(mol): remove molecule.go (superseded by mol.go)
The simple single-issue instantiation in molecule.go is superseded by
the full DAG-based mol commands. Use 'bd mol bond' for all molecule
instantiation - it handles both single-issue and multi-issue molecules.

Closes: bd-8b0x

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:04:25 -08:00
Steve Yegge
ca678ca5ba feat(mol): add bd mol commands, deprecate bd template
Adds the mol command group for molecule workflows:
- bd mol catalog - list available molecules
- bd mol show <id> - show molecule structure and variables
- bd mol bond <id> --var k=v - instantiate a molecule

Molecules are templates with workflow semantics - they are the
orchestration primitive for Gas Town. This unifies the template
system under the mol command.

The template commands are deprecated but still work:
- bd template list -> use bd mol catalog
- bd template show -> use bd mol show
- bd template instantiate -> use bd mol bond

Closes: bd-ffjt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:01:53 -08:00
Steve Yegge
dce2d503b7 Merge pull request #659 from rsnodgrass/subtle-ux-improvements
Subtle ux improvements
2025-12-20 23:26:46 -08:00
Steve Yegge
c195dc1874 Merge branch 'main' into subtle-ux-improvements
Resolved modify/delete conflict: cmd/bd/mail.go was deleted on main
(mail functionality moved to Gas Town), accepting deletion.
2025-12-20 23:26:35 -08:00
Steve Yegge
ee255c215a bd sync: 2025-12-20 23:22:54 2025-12-20 23:22:54 -08:00
Steve Yegge
22f4e0d6fa bd sync: 2025-12-20 22:35:59 2025-12-20 22:35:59 -08:00
Steve Yegge
d2956739c8 bd sync: 2025-12-20 22:35:19 2025-12-20 22:35:26 -08:00
Steve Yegge
cecf63d1b9 docs(scripts): add Gas Town guidance to bump-version.sh
Learned during v0.32.1 release: running version bumps from crew clones
causes git conflicts with bd sync, which commits from mayor/rig.

Added note to always run releases from the rig root where beads lives.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 22:02:10 -08:00
Steve Yegge
ecea63da75 bd sync: 2025-12-20 21:59:07 2025-12-20 21:59:07 -08:00
Steve Yegge
9768317eea bd sync: 2025-12-20 21:57:50 2025-12-20 21:58:59 -08:00
Steve Yegge
cad4f49f64 bd sync: 2025-12-20 21:56:38 2025-12-20 21:58:59 -08:00
Steve Yegge
27ddbd6ca0 chore: bump version to 0.32.1
Changes in 0.32.1:
- feat(mcp): Add output control params (PR#667) - brief, brief_deps, fields, max_description_length
- feat(mcp): Add filtering params - labels, labels_any, query, unassigned, sort_policy
- fix(pin): Add pinned to allowed update fields (gt-zr0a)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 21:56:28 -08:00
Aarya Reddy
e58d60b802 feat(mcp): add output control parameters for token efficiency (#667)
Add granular control over MCP tool response sizes to minimize context
window usage while maintaining full functionality when needed.

## Output Control Parameters

### Read Operations (ready, list, show, blocked)
- `brief`: Return BriefIssue {id, title, status, priority} (~97% smaller)
- `fields`: Custom field projection with validation - invalid fields raise ValueError
- `max_description_length`: Truncate descriptions to N chars with "..."
- `brief_deps`: Full issue but dependencies as BriefDep (~48% smaller)

### Write Operations (create, update, close, reopen)
- `brief`: Return OperationResult {id, action, message} (~97% smaller)
- Default is brief=True for minimal confirmations

## Token Savings

| Operation | Before | After (brief) | Reduction |
|-----------|--------|---------------|-----------|
| ready(limit=10) | ~20KB | ~600B | 97% |
| list(limit=20) | ~40KB | ~800B | 98% |
| show() | ~2KB | ~60B | 97% |
| show() with 5 deps | ~4.5KB | ~2.3KB | 48% |
| blocked() | ~10KB | ~240B | 98% |
| create() response | ~2KB | ~50B | 97% |

## New Models

- BriefIssue: Ultra-minimal issue (4 fields, ~60B)
- BriefDep: Compact dependency (5 fields, ~70B)
- OperationResult: Write confirmation (3 fields, ~50B)
- OperationAction: Literal["created", "updated", "closed", "reopened"]

## Best Practices

- Unified `brief` parameter naming across all operations
- `brief=True` always means "give me less data"
- Field validation with clear error messages listing valid fields
- All parameters optional with backwards-compatible defaults
- Progressive disclosure: scan cheap, detail on demand

---

## Filtering Parameters (aligns MCP with CLI)

Add missing filter parameters to `list` and `ready` tools that were
documented in MCP instructions but not implemented.

### ReadyWorkParams - New Fields
- `labels: list[str]` - AND filter: must have ALL specified labels
- `labels_any: list[str]` - OR filter: must have at least one
- `unassigned: bool` - Filter to only unassigned issues
- `sort_policy: str` - Sort by: hybrid (default), priority, oldest

### ListIssuesParams - New Fields
- `labels: list[str]` - AND filter: must have ALL specified labels
- `labels_any: list[str]` - OR filter: must have at least one
- `query: str` - Search in title (case-insensitive substring)
- `unassigned: bool` - Filter to only unassigned issues

### CLI Flag Mappings

| MCP Parameter | ready CLI Flag | list CLI Flag |
|---------------|----------------|---------------|
| labels | --label (repeated) | --label (repeated) |
| labels_any | --label-any (repeated) | --label-any (repeated) |
| query | N/A | --title |
| unassigned | --unassigned | --no-assignee |
| sort_policy | --sort | N/A |

---

## Documentation & Testing

### get_tool_info() Updates
- Added `brief`, `brief_deps`, `fields`, `max_description_length` to show tool
- Added `brief` parameter docs for create, update, close, reopen
- Added `brief`, `brief_deps` parameter docs for blocked

### Test Coverage (16 new tests)
- `test_create_brief_default` / `test_create_brief_false`
- `test_update_brief_default` / `test_update_brief_false`
- `test_close_brief_default` / `test_close_brief_false`
- `test_reopen_brief_default`
- `test_show_brief` / `test_show_fields_projection` / `test_show_fields_invalid`
- `test_show_max_description_length` / `test_show_brief_deps`
- `test_list_brief` / `test_ready_brief` / `test_blocked_brief`

---

## Backward Compatibility

All new parameters are optional with sensible defaults:
- `brief`: False for reads, True for writes
- `fields`, `max_description_length`: None (no filtering/truncation)
- `labels`, `labels_any`, `query`: None (no filtering)
- `unassigned`: False (include all)
- `sort_policy`: None (use default hybrid sort)

Existing MCP tool calls continue to work unchanged.
2025-12-20 21:33:38 -08:00
Steve Yegge
3743e9ed70 chore: remove obsolete BD_GUIDE.md references
BD_GUIDE.md generation was removed in 125e36d5 when bd onboard was
simplified to output a minimal snippet pointing to bd prime.

This commit:
- Removes stale BD_GUIDE.md references from CLAUDE.md
- Removes dead checkAndSuggestBDGuideUpdate() code from version_tracking.go
- Removes BD_GUIDE.md from UNINSTALLING.md file list

Closes #660 (already fixed in v0.30.7 via f1380e8b)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 20:50:33 -08:00
Steve Yegge
5d2daf2e1e fix(pin): add 'pinned' field to allowed update fields (gt-zr0a)
The 'bd pin' command was failing with "invalid field for update: pinned"
because the pinned field was missing from allowedUpdateFields.

Fixes:
- Add 'pinned' to allowedUpdateFields in queries.go
- Update importer to include pinned field in updates during import
- Add equalBool comparator for IssueDataChanged to detect pinned changes
- Fix stats query to count pinned=1 instead of status='pinned'
- Fix pinIndicator in list.go to check issue.Pinned instead of status

This unblocks gt mail --pinned functionality.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 19:57:16 -08:00