fix(hooks): discover crew-level and polecats-level settings

The `gt hooks` command was not discovering settings at:
- <rig>/crew/.claude/settings.json (crew-level, inherited by all members)
- <rig>/polecats/.claude/settings.json (polecats-level)

This caused confusion when debugging hooks since Claude Code inherits
from parent directories, so hooks were executing but not shown by
`gt hooks`.

Also fixed: skip .claude directories when iterating crew members.

Fixes: gh-735

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
dementus
2026-01-22 21:37:41 -08:00
committed by beads/crew/emma
parent 232fc79cd5
commit 493507ad4e
2 changed files with 94 additions and 3 deletions

View File

@@ -135,8 +135,14 @@ func discoverHooks(townRoot string) ([]HookInfo, error) {
agent string
}{filepath.Join(rigPath, ".claude", "settings.json"), fmt.Sprintf("%s/rig", rigName)})
// Polecats
// Polecats-level hooks (inherited by all polecats)
polecatsDir := filepath.Join(rigPath, "polecats")
locations = append(locations, struct {
path string
agent string
}{filepath.Join(polecatsDir, ".claude", "settings.json"), fmt.Sprintf("%s/polecats", rigName)})
// Individual polecat hooks
if polecats, err := os.ReadDir(polecatsDir); err == nil {
for _, p := range polecats {
if p.IsDir() && !strings.HasPrefix(p.Name(), ".") {
@@ -148,11 +154,17 @@ func discoverHooks(townRoot string) ([]HookInfo, error) {
}
}
// Crew members
// Crew-level hooks (inherited by all crew members)
crewDir := filepath.Join(rigPath, "crew")
locations = append(locations, struct {
path string
agent string
}{filepath.Join(crewDir, ".claude", "settings.json"), fmt.Sprintf("%s/crew", rigName)})
// Individual crew member hooks
if crew, err := os.ReadDir(crewDir); err == nil {
for _, c := range crew {
if c.IsDir() {
if c.IsDir() && !strings.HasPrefix(c.Name(), ".") {
locations = append(locations, struct {
path string
agent string