Skip to content

Conversation

@thoreinstein
Copy link
Owner

No description provided.

Implement foundation for beads issue tracking integration:

- Create pkg/beads/ package with BeadsClient interface
- Add CLIClient implementation wrapping bd CLI
- Add IsBeadsProject() and FindBeadsRoot() detection functions
- Add BeadsConfig to pkg/config with enabled and cli_command fields
- Add BeadsError type to pkg/errors following JiraError pattern
- Add comprehensive unit tests for all new code

This enables rig to detect beads-enabled projects and interact with
the bd CLI for issue tracking operations.

Part of epic rig-k6n: Integrate beads workflow tracking
Add TicketRouter to determine which ticket system owns an ID based on:
- Ticket format (alphanumeric suffix = beads, numeric = JIRA)
- Project context (.beads/ directory presence)
- Config enablement flags

Routing rules:
1. Beads takes precedence for alphanumeric IDs in beads projects
2. JIRA handles numeric-suffix IDs when enabled
3. Falls back to unknown when source cannot be determined

Includes comprehensive table-driven tests for all routing scenarios.

Part of epic rig-k6n: Integrate beads workflow tracking
Wire beads integration into the work command workflow:
- Use TicketRouter to detect beads vs JIRA tickets
- Fetch beads issue details for note integration
- Auto-update beads status to in_progress on work start
- Prefer beads info over JIRA when both available for notes
- Follow same graceful degradation pattern as JIRA

When rig work is run with a beads-style ticket in a beads project,
it will now automatically transition the issue to in_progress.

Part of epic rig-k6n: Integrate beads workflow tracking
Add pkg/errors/types_test.go with table-driven tests covering:
- Error message formatting with/without IssueID
- Error unwrapping and chain traversal
- All BeadsError constructors
- IsBeadsError type checking through wrapped errors
- IsRetryable detection for BeadsError

Tests follow existing patterns and ensure BeadsError integrates
properly with cockroachdb/errors.As and errors.Is.

Part of epic rig-k6n: Integrate beads workflow tracking
Copilot AI review requested due to automatic review settings January 15, 2026 16:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates beads ticket tracking system into the rig workflow tool. Beads is a lightweight, file-based issue tracker that stores issues in .beads/beads.jsonl files. The integration adds detection, routing, and CLI interaction capabilities to distinguish between beads and JIRA tickets.

Changes:

  • Added beads package with client, detection, and types modules for interacting with the bd CLI tool
  • Implemented ticket routing logic to differentiate between beads and JIRA ticket formats
  • Updated work command to support beads issue status updates and note integration

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/beads/types.go Defines beads issue data structures and validation helpers
pkg/beads/types_test.go Unit tests for beads type validation
pkg/beads/detection.go Project detection logic for finding beads root directories
pkg/beads/detection_test.go Tests for beads project detection and root finding
pkg/beads/client.go Interface definition for beads client operations
pkg/beads/cli_client.go CLI-based implementation wrapping the bd command
pkg/beads/cli_client_test.go Tests for CLI client validation and command execution
pkg/workflow/router.go Ticket routing logic to distinguish beads from JIRA tickets
pkg/workflow/router_test.go Comprehensive tests for ticket routing behavior
pkg/errors/types.go Added BeadsError type and helper functions
pkg/errors/types_test.go Tests for BeadsError creation and error chain handling
pkg/config/config.go Added BeadsConfig structure and defaults
cmd/work.go Integrated beads status updates into the work command

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// Beads tickets have an alphanumeric suffix that contains at least one letter.
// Examples: rig-k6n, rig-abc123, proj-7xy
func IsBeadsTicket(ticketID string) bool {
if !looksLikeTicket(ticketID) {
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function looksLikeTicket is not defined in this file. It exists in pkg/workflow/merge.go but is a private (lowercase) function. This will cause a compilation error. Either move the helper functions (looksLikeTicket, isLetter, isDigit) to a shared location in the workflow package or duplicate them in this file.

Copilot uses AI. Check for mistakes.

// Beads tickets have at least one letter in the suffix
for i := range len(suffix) {
if isLetter(suffix[i]) {
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function isLetter is not defined in this file. It exists in pkg/workflow/merge.go but is a private (lowercase) function. This will cause a compilation error.

Copilot uses AI. Check for mistakes.
// JIRA tickets have a numeric-only suffix.
// Examples: PROJ-123, FRAAS-456, ABC-1
func IsJiraTicket(ticketID string) bool {
if !looksLikeTicket(ticketID) {
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function looksLikeTicket is called here but not defined in this file, causing a compilation error.

Copilot uses AI. Check for mistakes.

// JIRA tickets have only digits in the suffix
for i := range len(suffix) {
if !isDigit(suffix[i]) {
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function isDigit is not defined in this file. It exists in pkg/workflow/merge.go but is a private (lowercase) function. This will cause a compilation error.

Copilot uses AI. Check for mistakes.
@thoreinstein thoreinstein merged commit 2a79819 into main Jan 15, 2026
11 checks passed
@thoreinstein thoreinstein deleted the rig-k6n branch January 15, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants