Files
beads/cmd
Roland Tritsch c1ac69da3e feat(mol): add 'bd mol seed --patrol' command (#1149)
* Fix doctor DB-JSONL sync check to exclude ephemeral wisps

The DB-JSONL Sync check was showing a false positive warning when wisps
(ephemeral issues) existed in the database. Wisps are intentionally
excluded from JSONL exports, so they shouldn't be counted when comparing
database and JSONL issue counts.

Changes:
- Updated CheckDatabaseJSONLSync to exclude ephemeral issues from count
  using 'WHERE ephemeral = 0 OR ephemeral IS NULL'
- Added 'ephemeral' column to test database schema
- Added test case to verify ephemeral issues are excluded from count
- Updated TestCheckDatabaseJSONLSync_MoleculePrefix to include ephemeral column

This prevents false warnings like 'database has 92 issues, JSONL has 30'
when the difference is entirely due to wisps that should not be exported.

* feat(mol): add 'bd mol seed --patrol' command

Adds `bd mol seed` command to verify formula accessibility before
patrols attempt to spawn work.

## Problem

Gas Town's `gt rig add` calls `bd mol seed --patrol` but this command
didn't exist in beads, causing the call to always fail and fall back
to creating non-functional placeholder beads.

## Solution

Implemented `bd mol seed` with two modes:

1. **With --patrol flag**: Verifies all three patrol formulas are accessible
   - mol-deacon-patrol
   - mol-witness-patrol
   - mol-refinery-patrol

2. **Without --patrol**: Verifies a specific formula is accessible

## Implementation

The command uses `resolveAndCookFormulaWithVars` to verify formulas:
- Checks formula search paths (.beads/formulas/, ~/.beads/formulas/, $GT_ROOT/.beads/formulas/)
- Validates formula syntax and resolution
- Confirms formula can be cooked to subgraph

## Usage

```bash
bd mol seed --patrol                    # Verify all patrol formulas
bd mol seed mol-feature                 # Verify specific formula
bd mol seed mol-review --var name=test  # With variable substitution
```

## Testing

-  Command compiles without errors
-  Help text displays correctly
-  `--patrol` succeeds when formulas accessible (town level)
-  `--patrol` fails with clear error when formulas missing (rig level)
-  Follows existing beads command patterns (cobra, flags, error handling)

## Impact

- Enables Gas Town's intended patrol formula verification flow
- Eliminates creation of unnecessary placeholder beads
- Provides health check command for formula accessibility
- Foundation for future seed commands (data initialization, etc.)

Fixes the missing command referenced in steveyegge/gastown#715

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

---------

Co-authored-by: Roland Tritsch <roland@ailtir.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-20 14:06:57 -08:00
..