fix: use lightweight molecule discovery in bd mol progress
Replace findInProgressMolecules (which loads full subgraphs) with findInProgressMoleculeIDs (which only returns IDs). This ensures auto-discovery is efficient for mega-molecules. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
21de43538d
commit
f3224278a8
@@ -1,10 +1,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/steveyegge/beads/internal/storage"
|
||||||
"github.com/steveyegge/beads/internal/types"
|
"github.com/steveyegge/beads/internal/types"
|
||||||
"github.com/steveyegge/beads/internal/ui"
|
"github.com/steveyegge/beads/internal/ui"
|
||||||
"github.com/steveyegge/beads/internal/utils"
|
"github.com/steveyegge/beads/internal/utils"
|
||||||
@@ -53,9 +55,9 @@ Example:
|
|||||||
}
|
}
|
||||||
moleculeID = resolved
|
moleculeID = resolved
|
||||||
} else {
|
} else {
|
||||||
// Infer from in_progress work
|
// Infer from in_progress work - use lightweight discovery
|
||||||
molecules := findInProgressMolecules(ctx, store, actor)
|
moleculeIDs := findInProgressMoleculeIDs(ctx, store, actor)
|
||||||
if len(molecules) == 0 {
|
if len(moleculeIDs) == 0 {
|
||||||
if jsonOutput {
|
if jsonOutput {
|
||||||
outputJSON([]interface{}{})
|
outputJSON([]interface{}{})
|
||||||
return
|
return
|
||||||
@@ -65,7 +67,7 @@ Example:
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Show progress for first molecule
|
// Show progress for first molecule
|
||||||
moleculeID = molecules[0].MoleculeID
|
moleculeID = moleculeIDs[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
stats, err := store.GetMoleculeProgress(ctx, moleculeID)
|
stats, err := store.GetMoleculeProgress(ctx, moleculeID)
|
||||||
@@ -108,6 +110,34 @@ Example:
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// findInProgressMoleculeIDs finds molecule IDs with in_progress steps for an agent.
|
||||||
|
// This is a lightweight version that only returns IDs without loading subgraphs.
|
||||||
|
func findInProgressMoleculeIDs(ctx context.Context, s storage.Storage, agent string) []string {
|
||||||
|
// Query for in_progress issues
|
||||||
|
status := types.StatusInProgress
|
||||||
|
filter := types.IssueFilter{Status: &status}
|
||||||
|
if agent != "" {
|
||||||
|
filter.Assignee = &agent
|
||||||
|
}
|
||||||
|
inProgressIssues, err := s.SearchIssues(ctx, "", filter)
|
||||||
|
if err != nil || len(inProgressIssues) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// For each in_progress issue, find its parent molecule
|
||||||
|
seen := make(map[string]bool)
|
||||||
|
var moleculeIDs []string
|
||||||
|
for _, issue := range inProgressIssues {
|
||||||
|
moleculeID := findParentMolecule(ctx, s, issue.ID)
|
||||||
|
if moleculeID != "" && !seen[moleculeID] {
|
||||||
|
seen[moleculeID] = true
|
||||||
|
moleculeIDs = append(moleculeIDs, moleculeID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return moleculeIDs
|
||||||
|
}
|
||||||
|
|
||||||
// printMoleculeProgressStats prints molecule progress in human-readable format
|
// printMoleculeProgressStats prints molecule progress in human-readable format
|
||||||
func printMoleculeProgressStats(stats *types.MoleculeProgressStats) {
|
func printMoleculeProgressStats(stats *types.MoleculeProgressStats) {
|
||||||
fmt.Printf("Molecule: %s (%s)\n", ui.RenderAccent(stats.MoleculeID), stats.MoleculeTitle)
|
fmt.Printf("Molecule: %s (%s)\n", ui.RenderAccent(stats.MoleculeID), stats.MoleculeTitle)
|
||||||
|
|||||||
Reference in New Issue
Block a user