feat(plugin): add run and history commands for plugin management

- gt plugin run: Manual plugin execution with gate check
  - --force to bypass cooldown gate
  - --dry-run to preview without executing
  - Records successful runs as ephemeral beads
- gt plugin history: Show execution history from ephemeral beads
  - --json for machine-readable output
  - --limit to control number of results
- Fix recording.go to use valid bd list flags (--created-after instead of --since)

Closes: gt-n08ix.4

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
george
2026-01-12 16:42:33 -08:00
committed by Steve Yegge
parent 069fe0f285
commit 5a7c328f1f
2 changed files with 192 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"os"
"os/exec"
"strings"
"time"
)
@@ -119,8 +120,8 @@ func (r *Recorder) GetRunsSince(pluginName string, since string) ([]*PluginRunBe
func (r *Recorder) queryRuns(pluginName string, limit int, since string) ([]*PluginRunBead, error) {
args := []string{
"list",
"--ephemeral",
"--json",
"--all", // Include closed beads too
"-l", "type:plugin-run",
"-l", fmt.Sprintf("plugin:%s", pluginName),
}
@@ -128,7 +129,13 @@ func (r *Recorder) queryRuns(pluginName string, limit int, since string) ([]*Plu
args = append(args, fmt.Sprintf("--limit=%d", limit))
}
if since != "" {
args = append(args, "--since="+since)
// Convert duration like "1h" to created-after format
// bd supports relative dates with - prefix (e.g., -1h, -24h)
sinceArg := since
if !strings.HasPrefix(since, "-") {
sinceArg = "-" + since
}
args = append(args, "--created-after="+sinceArg)
}
cmd := exec.Command("bd", args...) //nolint:gosec // G204: bd is a trusted internal tool