refactor(doctor): consolidate maintenance commands + improve daemon startup
Consolidate clean, repair-deps, validate into bd doctor: - Add validation checks to doctor (merge artifacts, orphaned deps, duplicates, test pollution, git conflicts) - Add auto-fix for merge artifacts and orphaned dependencies - Delete obsolete command files: clean.go, repair_deps.go, validate.go - Delete orphaned test files: clean_security_test.go, validate_test.go Improve daemon startup performance: - Add fast-fail detection when daemon crashed (check lock before retrying) - Reduce graceful shutdown timeout from 5s to 1s - Skip daemon connection for root command (just shows help) - Extract shutdown timeout as constants (daemonShutdownTimeout, daemonShutdownPollInterval) Other changes: - Move rename-prefix command to Maintenance group in help - Fix Makefile to inject git commit hash via ldflags New files: - cmd/bd/doctor/validation.go (5 check functions) - cmd/bd/doctor/fix/validation.go (2 fix functions)
This commit is contained in:
committed by
Steve Yegge
parent
e60dfaf1f1
commit
cafc0b9dfb
@@ -118,12 +118,24 @@ var (
|
||||
quietFlag bool // Suppress non-essential output
|
||||
)
|
||||
|
||||
// Command group IDs for help organization
|
||||
const (
|
||||
GroupMaintenance = "maintenance"
|
||||
GroupIntegrations = "integrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Initialize viper configuration
|
||||
if err := config.Initialize(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to initialize config: %v\n", err)
|
||||
}
|
||||
|
||||
// Add command groups for organized help output
|
||||
rootCmd.AddGroup(
|
||||
&cobra.Group{ID: GroupMaintenance, Title: "Maintenance:"},
|
||||
&cobra.Group{ID: GroupIntegrations, Title: "Integrations & Advanced:"},
|
||||
)
|
||||
|
||||
// Register persistent flags
|
||||
rootCmd.PersistentFlags().StringVar(&dbPath, "db", "", "Database path (default: auto-discover .beads/*.db)")
|
||||
rootCmd.PersistentFlags().StringVar(&actor, "actor", "", "Actor name for audit trail (default: $BD_ACTOR or $USER)")
|
||||
@@ -391,6 +403,11 @@ var rootCmd = &cobra.Command{
|
||||
return
|
||||
}
|
||||
|
||||
// Skip for root command with no subcommand (just shows help)
|
||||
if cmd.Parent() == nil && cmdName == "bd" {
|
||||
return
|
||||
}
|
||||
|
||||
// Also skip for --version flag on root command (cmdName would be "bd")
|
||||
if v, _ := cmd.Flags().GetBool("version"); v {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user