observability-and-instrumentation, deprecation-and-migration, ci-cd-and-automation from addyosmani/agent-skills 2686b620, curl'd into skills-external/<name>/ by install-plugins.sh Step 8e (tmp+mv), refreshed by update-all.sh 7.3, symlinked by link.sh, registered in toggle-external, profile.sh and the full/backend/dev profiles. Pin read from the lock via argv, never hardcoded. Case 2 of the 6-repo review, BDR-102.
36 lines
1.8 KiB
Bash
36 lines
1.8 KiB
Bash
#!/usr/bin/env bash
|
|
# lib/tests/toggle-external-repo-resolution.test.sh
|
|
#
|
|
# Regression test for J4-20 (BLK-006 class): toggle-external.sh:34 resolved
|
|
# REPO with a LOGICAL `cd` (no -P). Direct invocation via a symlinked path —
|
|
# exactly the real ~/.claude/lib -> <repo>/lib layout — resolves REPO to the
|
|
# SYMLINK's logical parent instead of the physical repo root, so every path
|
|
# derived from it (SKILLS_DIR, DISABLED_DIR) points at the wrong tree.
|
|
set -u
|
|
HELPER_SRC="$(cd "$(dirname "$0")/../.." && pwd)/lib/toggle-external.sh"
|
|
pass=0; fail=0
|
|
check() { if [ "$2" = "$3" ]; then pass=$((pass+1)); else fail=$((fail+1));
|
|
printf 'FAIL %s: got[%s] want[%s]\n' "$1" "$2" "$3"; fi; }
|
|
|
|
SANDBOX="$(mktemp -d)"
|
|
mkdir -p "$SANDBOX/repo/lib" "$SANDBOX/repo/skills-external/emil-design-eng" \
|
|
"$SANDBOX/repo/skills-external/observability-and-instrumentation" \
|
|
"$SANDBOX/repo/skills" "$SANDBOX/home/.claude"
|
|
cp "$HELPER_SRC" "$SANDBOX/repo/lib/toggle-external.sh"
|
|
# mark emil-design-eng ENABLED in the real (physical) repo tree
|
|
ln -s "$SANDBOX/repo/skills-external/emil-design-eng" "$SANDBOX/repo/skills/emil-design-eng"
|
|
# replicate the real ~/.claude/lib -> <repo>/lib symlink
|
|
ln -s "$SANDBOX/repo/lib" "$SANDBOX/home/.claude/lib"
|
|
|
|
out="$(bash "$SANDBOX/home/.claude/lib/toggle-external.sh" status emil-design-eng)"
|
|
check T1-repo-resolves-through-symlink "$out" enabled
|
|
|
|
# Same case arm, generalized to $tool for the agent-skills trio (this PR) —
|
|
# left unlinked, so it must resolve through the symlink as "disabled", not
|
|
# "missing" (which would mean REPO fell back to the wrong tree again).
|
|
out="$(bash "$SANDBOX/home/.claude/lib/toggle-external.sh" status observability-and-instrumentation)"
|
|
check T2-generalized-tool-resolves-through-symlink "$out" disabled
|
|
|
|
rm -rf "$SANDBOX"
|
|
printf 'PASS=%s FAIL=%s\n' "$pass" "$fail"; [ "$fail" -eq 0 ]
|