Add Claude settings location verification to rig add test

Verify that rig add creates settings.json in correct locations:
- witness/.claude/settings.json (outside git repo)
- refinery/.claude/settings.json (outside git repo)
- crew/.claude/settings.json (shared, outside git repos)
- polecats/.claude/settings.json (shared, outside git repos)

Also verify settings are NOT created inside source repos
(witness/rig/.claude, refinery/rig/.claude) which would
pollute the source repos.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
julianknutsen
2026-01-06 22:50:21 -08:00
parent feeee3912a
commit ab0d56dec9

View File

@@ -254,6 +254,40 @@ func TestRigAddCreatesCorrectStructure(t *testing.T) {
} else if info.IsDir() {
t.Errorf("refinery/rig/.git should be a file (worktree), not a directory")
}
// Verify Claude settings are created in correct locations (outside git repos).
// Settings in parent directories are inherited by agents via directory traversal,
// without polluting the source repos.
expectedSettings := []struct {
path string
desc string
}{
{filepath.Join(rigPath, "witness", ".claude", "settings.json"), "witness/.claude/settings.json"},
{filepath.Join(rigPath, "refinery", ".claude", "settings.json"), "refinery/.claude/settings.json"},
{filepath.Join(rigPath, "crew", ".claude", "settings.json"), "crew/.claude/settings.json"},
{filepath.Join(rigPath, "polecats", ".claude", "settings.json"), "polecats/.claude/settings.json"},
}
for _, s := range expectedSettings {
if _, err := os.Stat(s.path); err != nil {
t.Errorf("%s not found: %v", s.desc, err)
}
}
// Verify settings are NOT created inside source repos (these would be wrong)
wrongLocations := []struct {
path string
desc string
}{
{filepath.Join(rigPath, "witness", "rig", ".claude", "settings.json"), "witness/rig/.claude (inside source repo)"},
{filepath.Join(rigPath, "refinery", "rig", ".claude", "settings.json"), "refinery/rig/.claude (inside source repo)"},
}
for _, w := range wrongLocations {
if _, err := os.Stat(w.path); err == nil {
t.Errorf("%s should NOT exist (settings would pollute source repo)", w.desc)
}
}
}
// TestRigAddInitializesBeads verifies that beads is initialized with