beads/cmd/bd/admin.go
2026-03-28 13:47:20 -07:00

35 lines
1,006 B
Go

package main
import (
"fmt"
"github.com/spf13/cobra"
)
var adminCmd = &cobra.Command{
Use: "admin",
GroupID: "advanced",
Short: "Administrative commands for database maintenance",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if isEmbeddedMode() {
return fmt.Errorf("'bd admin' is not yet supported in embedded mode")
}
return nil
},
Long: `Administrative commands for beads database maintenance.
These commands are for advanced users and should be used carefully:
cleanup Delete closed issues (issue lifecycle)
compact Compact old closed issues to save space (storage optimization)
reset Remove all beads data and configuration (full reset)
For routine maintenance, prefer 'bd doctor --fix' which handles common repairs
automatically. Use these admin commands for targeted database operations.`,
}
func init() {
rootCmd.AddCommand(adminCmd)
adminCmd.AddCommand(cleanupCmd)
adminCmd.AddCommand(compactCmd)
adminCmd.AddCommand(resetCmd)
}