fix: create boot directory on install and make fixable
- Add boot directory creation to install.go (avoids warning on fresh install) - Make boot-health check fixable via 'gt doctor --fix' - Update FixHint to reference the fix command
This commit is contained in:
@@ -221,6 +221,13 @@ func runInstall(cmd *cobra.Command, args []string) error {
|
|||||||
fmt.Printf(" ✓ Created deacon/.claude/settings.json\n")
|
fmt.Printf(" ✓ Created deacon/.claude/settings.json\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create boot directory (deacon/dogs/boot/) for Boot watchdog.
|
||||||
|
// This avoids gt doctor warning on fresh install.
|
||||||
|
bootDir := filepath.Join(deaconDir, "dogs", "boot")
|
||||||
|
if err := os.MkdirAll(bootDir, 0755); err != nil {
|
||||||
|
fmt.Printf(" %s Could not create boot directory: %v\n", style.Dim.Render("⚠"), err)
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize git BEFORE beads so that bd can compute repository fingerprint.
|
// Initialize git BEFORE beads so that bd can compute repository fingerprint.
|
||||||
// The fingerprint is required for the daemon to start properly.
|
// The fingerprint is required for the daemon to start properly.
|
||||||
if installGit || installGitHub != "" {
|
if installGit || installGitHub != "" {
|
||||||
|
|||||||
@@ -11,20 +11,37 @@ import (
|
|||||||
// BootHealthCheck verifies Boot watchdog health.
|
// BootHealthCheck verifies Boot watchdog health.
|
||||||
// "The vet checks on the dog."
|
// "The vet checks on the dog."
|
||||||
type BootHealthCheck struct {
|
type BootHealthCheck struct {
|
||||||
BaseCheck
|
FixableCheck
|
||||||
|
missingDir bool // track if directory is missing for Fix()
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBootHealthCheck creates a new Boot health check.
|
// NewBootHealthCheck creates a new Boot health check.
|
||||||
func NewBootHealthCheck() *BootHealthCheck {
|
func NewBootHealthCheck() *BootHealthCheck {
|
||||||
return &BootHealthCheck{
|
return &BootHealthCheck{
|
||||||
BaseCheck: BaseCheck{
|
FixableCheck: FixableCheck{
|
||||||
CheckName: "boot-health",
|
BaseCheck: BaseCheck{
|
||||||
CheckDescription: "Check Boot watchdog health (the vet checks on the dog)",
|
CheckName: "boot-health",
|
||||||
CheckCategory: CategoryInfrastructure,
|
CheckDescription: "Check Boot watchdog health (the vet checks on the dog)",
|
||||||
|
CheckCategory: CategoryInfrastructure,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CanFix returns true only if the directory is missing (we can create it).
|
||||||
|
func (c *BootHealthCheck) CanFix() bool {
|
||||||
|
return c.missingDir
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix creates the missing boot directory.
|
||||||
|
func (c *BootHealthCheck) Fix(ctx *CheckContext) error {
|
||||||
|
if !c.missingDir {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
b := boot.New(ctx.TownRoot)
|
||||||
|
return b.EnsureDir()
|
||||||
|
}
|
||||||
|
|
||||||
// Run checks Boot health: directory, session, status, and marker freshness.
|
// Run checks Boot health: directory, session, status, and marker freshness.
|
||||||
func (c *BootHealthCheck) Run(ctx *CheckContext) *CheckResult {
|
func (c *BootHealthCheck) Run(ctx *CheckContext) *CheckResult {
|
||||||
b := boot.New(ctx.TownRoot)
|
b := boot.New(ctx.TownRoot)
|
||||||
@@ -33,12 +50,13 @@ func (c *BootHealthCheck) Run(ctx *CheckContext) *CheckResult {
|
|||||||
// Check 1: Boot directory exists
|
// Check 1: Boot directory exists
|
||||||
bootDir := b.Dir()
|
bootDir := b.Dir()
|
||||||
if _, err := os.Stat(bootDir); os.IsNotExist(err) {
|
if _, err := os.Stat(bootDir); os.IsNotExist(err) {
|
||||||
|
c.missingDir = true
|
||||||
return &CheckResult{
|
return &CheckResult{
|
||||||
Name: c.Name(),
|
Name: c.Name(),
|
||||||
Status: StatusWarning,
|
Status: StatusWarning,
|
||||||
Message: "Boot directory not present",
|
Message: "Boot directory not present",
|
||||||
Details: []string{fmt.Sprintf("Expected: %s", bootDir)},
|
Details: []string{fmt.Sprintf("Expected: %s", bootDir)},
|
||||||
FixHint: "Boot directory is created on first daemon run",
|
FixHint: "Run 'gt doctor --fix' to create it",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user