fix: Check patrol role templates per-rig instead of at town level

- PatrolRolesHavePromptsCheck now verifies templates exist in each rig's
  mayor clone at <rig>/mayor/rig/internal/templates/roles/
- Track missing templates by rig using missingByRig map
- Fix copies embedded templates to each rig's location
- Add GetAllRoleTemplates helper to templates package
- Add tests for no-rigs case and multiple-rigs scenarios
This commit is contained in:
Avyukth
2026-01-03 00:34:51 +05:30
parent ae61d98b1f
commit 3e5562222d
3 changed files with 335 additions and 16 deletions

View File

@@ -62,14 +62,14 @@ type EscalationData struct {
// HandoffData contains information for session handoff messages.
type HandoffData struct {
Role string
CurrentWork string
Status string
NextSteps []string
Notes string
PendingMail int
GitBranch string
GitDirty bool
Role string
CurrentWork string
Status string
NextSteps []string
Notes string
PendingMail int
GitBranch string
GitDirty bool
}
// New creates a new Templates instance.
@@ -126,3 +126,25 @@ func (t *Templates) RoleNames() []string {
func (t *Templates) MessageNames() []string {
return []string{"spawn", "nudge", "escalation", "handoff"}
}
// GetAllRoleTemplates returns all role templates as a map of filename to content.
func GetAllRoleTemplates() (map[string][]byte, error) {
entries, err := templateFS.ReadDir("roles")
if err != nil {
return nil, fmt.Errorf("reading roles directory: %w", err)
}
result := make(map[string][]byte)
for _, entry := range entries {
if entry.IsDir() {
continue
}
content, err := templateFS.ReadFile("roles/" + entry.Name())
if err != nil {
return nil, fmt.Errorf("reading %s: %w", entry.Name(), err)
}
result[entry.Name()] = content
}
return result, nil
}