feat: implement Engineer main loop for merge queue processing

Adds the Engineer component that polls for ready merge-requests and
processes them according to the merge queue design.

Features:
- Main loop that queries `bd ready` for merge-request type issues
- Configurable poll_interval and max_concurrent from rig config.json
- Graceful shutdown via context cancellation or Stop() method
- Claims MRs via `bd update --status=in_progress` before processing
- Handles success/failure with appropriate status updates

Configuration (in rig config.json merge_queue section):
- poll_interval: duration string (default "30s")
- max_concurrent: number (default 1)
- enabled, target_branch, run_tests, test_command, etc.

Also adds ReadyWithType() to beads package for type-filtered queries.

Note: ProcessMR() and handleFailure() are placeholders - full
implementation in gt-3x1.2 and gt-3x1.4.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-18 20:14:10 -08:00
parent ae0c532723
commit 7c2780fcd1
3 changed files with 550 additions and 0 deletions

View File

@@ -190,6 +190,26 @@ func (b *Beads) Ready() ([]*Issue, error) {
return issues, nil
}
// ReadyWithType returns ready issues filtered by type.
// This fetches all ready issues and filters client-side by type.
// Issues are returned sorted by priority (lowest first) then by creation time (oldest first).
func (b *Beads) ReadyWithType(issueType string) ([]*Issue, error) {
issues, err := b.Ready()
if err != nil {
return nil, err
}
// Filter by type
var filtered []*Issue
for _, issue := range issues {
if issue.Type == issueType {
filtered = append(filtered, issue)
}
}
return filtered, nil
}
// Show returns detailed information about an issue.
func (b *Beads) Show(id string) (*Issue, error) {
out, err := b.run("show", id, "--json")