fix(kyberforge): stop dotfiles-repo $HOME from shadowing user scope in validate.sh
detect_scope() had the same bug class fixed in new-agent.sh (099bdec): it checked for a .git directory before checking whether it had reached $HOME, so a dotfiles-managed home directory (yadm, chezmoi bare-repo, etc.) made validate.sh misresolve to project scope, deriving the counterpart as ~/.github/agents/<name>.agent.md instead of the correct ~/.copilot/agents/<name>.agent.md and failing with a false "counterpart file not found". Check the $HOME boundary before the .git check, same fix shape as099bdec. Found via post-implementation review of issue #89.
This commit is contained in:
@@ -68,6 +68,30 @@ EOF
|
||||
refute_output --partial "FAIL"
|
||||
}
|
||||
|
||||
@test "user scope: \$HOME being a dotfiles .git repo does not shadow user scope" {
|
||||
local fake_home="$TMPDIR/fakehome"
|
||||
mkdir -p "$fake_home/.git" "$fake_home/.claude/agents" "$fake_home/.copilot/agents"
|
||||
cat > "$fake_home/.claude/agents/my-agent.md" <<EOF
|
||||
---
|
||||
name: my-agent
|
||||
description: A valid agent description.
|
||||
---
|
||||
|
||||
You are a test agent. When invoked, do the thing.
|
||||
EOF
|
||||
cat > "$fake_home/.copilot/agents/my-agent.agent.md" <<EOF
|
||||
---
|
||||
name: my-agent
|
||||
description: A valid agent description.
|
||||
---
|
||||
|
||||
You are a test agent. When invoked, do the thing.
|
||||
EOF
|
||||
run env HOME="$fake_home" bash "$SCRIPT" "$fake_home/.claude/agents/my-agent.md"
|
||||
assert_success
|
||||
refute_output --partial "FAIL"
|
||||
}
|
||||
|
||||
@test "--help exits 0 and shows Usage:" {
|
||||
run bash "$SCRIPT" --help
|
||||
assert_success
|
||||
|
||||
Reference in New Issue
Block a user