feat(mol): add bd ready --gated for gate-resume discovery (bd-lhalq)

Add new command to find molecules where a gate has closed and the workflow
is ready to resume:

- `bd ready --gated` - Flag on existing ready command
- `bd mol ready` - Subcommand for discoverability

The command finds molecules where:
1. A gate bead (type=gate) has been closed
2. The step blocked by that gate is now ready
3. The molecule is not currently hooked by any agent

This enables the Deacon patrol to discover and dispatch gate-ready
molecules without explicit waiter tracking, supporting async molecule
resume workflows.

Includes 5 tests verifying:
- No false positives when no gates exist
- Detection of molecules with closed gates
- Filtering out molecules with open gates
- Filtering out already-hooked molecules
- Handling multiple gate-ready molecules

Part of epic bd-ka761 (Gate-based async molecule resume).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
This commit is contained in:
dave
2026-01-08 21:22:17 -08:00
committed by Steve Yegge
parent 66047bcc25
commit 6331a9771a
3 changed files with 675 additions and 0 deletions

View File

@@ -23,8 +23,18 @@ var readyCmd = &cobra.Command{
Use --mol to filter to a specific molecule's steps:
bd ready --mol bd-patrol # Show ready steps within molecule
Use --gated to find molecules ready for gate-resume dispatch:
bd ready --gated # Find molecules where a gate closed
This is useful for agents executing molecules to see which steps can run next.`,
Run: func(cmd *cobra.Command, args []string) {
// Handle --gated flag (gate-resume discovery)
gated, _ := cmd.Flags().GetBool("gated")
if gated {
runMolReadyGated(cmd, args)
return
}
// Handle molecule-specific ready query
molID, _ := cmd.Flags().GetString("mol")
if molID != "" {
@@ -451,6 +461,7 @@ func init() {
readyCmd.Flags().String("mol-type", "", "Filter by molecule type: swarm, patrol, or work")
readyCmd.Flags().Bool("pretty", false, "Display issues in a tree format with status/priority symbols")
readyCmd.Flags().Bool("include-deferred", false, "Include issues with future defer_until timestamps")
readyCmd.Flags().Bool("gated", false, "Find molecules ready for gate-resume dispatch")
rootCmd.AddCommand(readyCmd)
blockedCmd.Flags().String("parent", "", "Filter to descendants of this bead/epic")
rootCmd.AddCommand(blockedCmd)