From ab0d56dec9320aab9a11113cd8a38353ca4fa64a Mon Sep 17 00:00:00 2001 From: julianknutsen Date: Tue, 6 Jan 2026 22:50:21 -0800 Subject: [PATCH] Add Claude settings location verification to rig add test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- internal/cmd/rig_integration_test.go | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/internal/cmd/rig_integration_test.go b/internal/cmd/rig_integration_test.go index 4924709a..fe10dd70 100644 --- a/internal/cmd/rig_integration_test.go +++ b/internal/cmd/rig_integration_test.go @@ -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