fix(doctor): implement Fix for misclassified-wisps check (#878)

The misclassified-wisps check could detect issues that should be wisps
but couldn't fix them because bd update lacked an --ephemeral flag.

Now that beads supports `bd update <id> --ephemeral` (steveyegge/beads#1263),
implement the actual fix to mark detected issues as ephemeral.

Closes #852

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
aleiby
2026-01-24 21:47:04 -08:00
committed by GitHub
parent 3da0d5a7c8
commit 9db9fc2af8

View File

@@ -5,6 +5,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"strings" "strings"
@@ -193,14 +194,30 @@ func (c *CheckMisclassifiedWisps) shouldBeWisp(id, title, issueType string, labe
return "" return ""
} }
// Fix marks misclassified issues as wisps using bd update. // Fix marks misclassified issues as wisps using bd update --ephemeral.
func (c *CheckMisclassifiedWisps) Fix(ctx *CheckContext) error { func (c *CheckMisclassifiedWisps) Fix(ctx *CheckContext) error {
// Note: bd doesn't have a direct flag to set wisp:true on existing issues. if len(c.misclassified) == 0 {
// The proper fix is to ensure issues are created with --ephemeral flag. return nil
// For now, we just report the issues - they'll be cleaned up by wisp-gc }
// if they become abandoned, or manually closed.
// var lastErr error
// A true fix would require bd to support: bd update <id> --ephemeral
// Until then, this check serves as a diagnostic. for _, wisp := range c.misclassified {
return nil // Determine working directory: town-level or rig-level
var workDir string
if wisp.rigName == "town" {
workDir = ctx.TownRoot
} else {
workDir = filepath.Join(ctx.TownRoot, wisp.rigName)
}
// Run bd update <id> --ephemeral
cmd := exec.Command("bd", "update", wisp.id, "--ephemeral")
cmd.Dir = workDir
if output, err := cmd.CombinedOutput(); err != nil {
lastErr = fmt.Errorf("%s/%s: %v (%s)", wisp.rigName, wisp.id, err, string(output))
}
}
return lastErr
} }