From 5511c51a8efc85b5b31b650e4824d7c7e712087a Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Mon, 6 Jul 2026 21:46:19 +0200 Subject: [PATCH] job4: seam design-tool-gate.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Env-var-only seams (§3.2), zero logic change (diff is only the seam lines): PROFILE_SH gains DESIGN_GATE_PROFILE_SH override; CLAUDE_BIN replaces the 5 bare `claude` invocation sites (ensure_claude_on_path's reachability check + the plugin/mcp branches of tool_active — 2x `command -v claude` + `claude plugin list` + `claude mcp list`). The `echo "... claude mcp list claude plugin list"` hint in the READY-BUT-UNVERIFIED message stays literal (advisory text for a human, not an invocation). Unlocks (BACKLOG, not built here): a hermetic gate suite via DESIGN_GATE_PROFILE_SH + CLAUDE_BIN injection, promoting J4-21. Verified: bash -n clean, shellcheck clean, `design-tool-gate.sh design` against the real repo unchanged ("READY"), full `make test` exit 0. --- lib/design-tool-gate.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/design-tool-gate.sh b/lib/design-tool-gate.sh index b72f20b..6ecebbc 100755 --- a/lib/design-tool-gate.sh +++ b/lib/design-tool-gate.sh @@ -42,7 +42,8 @@ set -euo pipefail REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -PROFILE_SH="$REPO/lib/profile.sh" +PROFILE_SH="${DESIGN_GATE_PROFILE_SH:-$REPO/lib/profile.sh}" +CLAUDE_BIN="${CLAUDE_BIN:-claude}" PROFILES_DIR="$REPO/lib/profiles" SKILLS_DIR="$REPO/skills" PROFILE="${1:-design}" @@ -59,7 +60,7 @@ PROFILE_FILE="$PROFILES_DIR/$PROFILE.profile" # dirs and prepend. nvm keeps old node versions after an upgrade, so pick the # newest that actually ships claude (sort -V), not the first glob match. ensure_claude_on_path() { - command -v claude >/dev/null 2>&1 && return + command -v "$CLAUDE_BIN" >/dev/null 2>&1 && return local cand for cand in \ "$HOME/.claude/local/claude" \ @@ -98,15 +99,15 @@ tool_active() { if [ -e "$SKILLS_DIR/$name" ]; then echo active; else echo inactive; fi ;; plugin) - if ! command -v claude >/dev/null 2>&1; then echo unknown; return; fi - if claude plugin list 2>/dev/null \ + if ! command -v "$CLAUDE_BIN" >/dev/null 2>&1; then echo unknown; return; fi + if "$CLAUDE_BIN" plugin list 2>/dev/null \ | awk -v p="^[[:space:]]*❯ ${name}@" '$0 ~ p {f=1; next} f && /Status:/ {print; exit}' \ | grep -q "✔ enabled" then echo active; else echo inactive; fi ;; mcp) - if ! command -v claude >/dev/null 2>&1; then echo unknown; return; fi - if claude mcp list 2>/dev/null | grep -q "^${name}"; then echo active; else echo inactive; fi + if ! command -v "$CLAUDE_BIN" >/dev/null 2>&1; then echo unknown; return; fi + if "$CLAUDE_BIN" mcp list 2>/dev/null | grep -q "^${name}"; then echo active; else echo inactive; fi ;; cli) if command -v "$name" >/dev/null 2>&1; then echo active; else echo inactive; fi