fix: create daemon.json on install, make templates check informational
- Add daemon.json creation to install.go (avoids patrol-hooks-wired warning) - Change patrol-roles-have-prompts to StatusOK (templates are embedded in binary)
This commit is contained in:
@@ -228,6 +228,14 @@ func runInstall(cmd *cobra.Command, args []string) error {
|
|||||||
fmt.Printf(" %s Could not create boot directory: %v\n", style.Dim.Render("⚠"), err)
|
fmt.Printf(" %s Could not create boot directory: %v\n", style.Dim.Render("⚠"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create daemon.json patrol config.
|
||||||
|
// This avoids gt doctor warning on fresh install.
|
||||||
|
if err := config.EnsureDaemonPatrolConfig(absPath); err != nil {
|
||||||
|
fmt.Printf(" %s Could not create daemon.json: %v\n", style.Dim.Render("⚠"), err)
|
||||||
|
} else {
|
||||||
|
fmt.Printf(" ✓ Created mayor/daemon.json\n")
|
||||||
|
}
|
||||||
|
|
||||||
// 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 != "" {
|
||||||
|
|||||||
@@ -458,11 +458,20 @@ func (c *PatrolRolesHavePromptsCheck) Run(ctx *CheckContext) *CheckResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var missingPrompts []string
|
var missingPrompts []string
|
||||||
|
rigsChecked := 0
|
||||||
for _, rigName := range rigs {
|
for _, rigName := range rigs {
|
||||||
// Check in mayor's clone (canonical for the rig)
|
// Check in mayor's clone (canonical for the rig)
|
||||||
mayorRig := filepath.Join(ctx.TownRoot, rigName, "mayor", "rig")
|
mayorRig := filepath.Join(ctx.TownRoot, rigName, "mayor", "rig")
|
||||||
templatesDir := filepath.Join(mayorRig, "internal", "templates", "roles")
|
templatesDir := filepath.Join(mayorRig, "internal", "templates", "roles")
|
||||||
|
|
||||||
|
// Skip rigs that don't have internal/templates structure.
|
||||||
|
// Most repos won't have this - templates are embedded in gastown binary.
|
||||||
|
// Only check rigs that explicitly have their own template overrides.
|
||||||
|
if _, err := os.Stat(filepath.Join(mayorRig, "internal", "templates")); os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
rigsChecked++
|
||||||
|
|
||||||
var rigMissing []string
|
var rigMissing []string
|
||||||
for _, roleFile := range requiredRolePrompts {
|
for _, roleFile := range requiredRolePrompts {
|
||||||
promptPath := filepath.Join(templatesDir, roleFile)
|
promptPath := filepath.Join(templatesDir, roleFile)
|
||||||
@@ -476,13 +485,21 @@ func (c *PatrolRolesHavePromptsCheck) Run(ctx *CheckContext) *CheckResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Templates are embedded in gastown binary - missing files in rig repos is normal.
|
||||||
|
// Only report as informational, not a warning.
|
||||||
|
if rigsChecked == 0 {
|
||||||
|
return &CheckResult{
|
||||||
|
Name: c.Name(),
|
||||||
|
Status: StatusOK,
|
||||||
|
Message: "Using embedded role templates (no custom overrides)",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(missingPrompts) > 0 {
|
if len(missingPrompts) > 0 {
|
||||||
return &CheckResult{
|
return &CheckResult{
|
||||||
Name: c.Name(),
|
Name: c.Name(),
|
||||||
Status: StatusWarning,
|
Status: StatusOK,
|
||||||
Message: fmt.Sprintf("%d role prompt template(s) missing", len(missingPrompts)),
|
Message: fmt.Sprintf("%d rig(s) using embedded templates for some roles", len(c.missingByRig)),
|
||||||
Details: missingPrompts,
|
|
||||||
FixHint: "Run 'gt doctor --fix' to copy embedded templates to rig repos",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user