Files
claude/lib/tests/toggle-external-repo-resolution.test.sh
T
bastien f83f8f755b feat(profiles): prune the gstack catalog, add max, honor a removed denylist
Nine gstack skills leave every profile (ship is trunk-based on Gitea,
land-and-deploy auto-merges and deploys, setup-deploy, autoplan reads
paths that do not exist here, context-save has no restore, learn is an
unused parallel store, careful and guard hooks never fired, design-shotgun
needs an absent OpenAI key). lib/gstack-removed.sh is the single denylist;
profile.sh gstack on and toggle-external.sh enable gstack skip it.

full now carries everything every other profile carries (user rule), minus
the parked make-pdf, diagram and 21st-ai/ui-explore/ui-review, which live
in the new max profile together with pr-review-toolkit. The 21st trio also
leaves web, web-full and design (redundant with impeccable + ui-ux-pro-max).

lib/tests/profile-census.test.sh asserts the invariants live and on a
baseline fixture plus one mutant per invariant; gstack-removed.test.sh
covers both restore paths.
2026-09-28 11:48:44 +02:00

37 lines
1.9 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"
cp "$(dirname "$HELPER_SRC")/gstack-removed.sh" "$SANDBOX/repo/lib/"
# 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 ]