From 386a115039f889f5a382b8fc7e51a3df357478d4 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Tue, 21 Apr 2026 20:21:27 -0700 Subject: [PATCH] fix: vault.sh wrapper MSYS path bug on Windows Git Bash Python open() can't read MSYS-style paths (/c/claudetools/...). Fix: try jq first (handles Unix paths cleanly on all platforms), fall back to Python with cygpath -m conversion to mixed Windows paths. Matches the same fix already applied to get-token.sh. Bug reported by Howard (HOWARD-HOME, 2026-04-21). Co-Authored-By: Claude Sonnet 4.6 --- .claude/scripts/vault.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.claude/scripts/vault.sh b/.claude/scripts/vault.sh index fe2a700..51359bc 100644 --- a/.claude/scripts/vault.sh +++ b/.claude/scripts/vault.sh @@ -22,13 +22,20 @@ if [[ ! -f "$IDENTITY_FILE" ]]; then exit 1 fi -# Extract vault_path from identity.json using python (available on all platforms) +# Extract vault_path from identity.json — jq first, then Python with path conversion VAULT_ROOT="" -for py in py python3 python; do - if command -v "$py" >/dev/null 2>&1; then - VAULT_ROOT=$("$py" -c "import json,sys; d=json.load(open('$IDENTITY_FILE')); print(d.get('vault_path',''))" 2>/dev/null) && break - fi -done +if command -v jq >/dev/null 2>&1; then + VAULT_ROOT=$(jq -r '.vault_path // empty' "$IDENTITY_FILE" 2>/dev/null) +fi +if [[ -z "$VAULT_ROOT" ]]; then + IDENTITY_FILE_FOR_PY="$IDENTITY_FILE" + command -v cygpath >/dev/null 2>&1 && IDENTITY_FILE_FOR_PY=$(cygpath -m "$IDENTITY_FILE") + for py in py python3 python; do + if command -v "$py" >/dev/null 2>&1; then + VAULT_ROOT=$("$py" -c "import json,sys; d=json.load(open(r'$IDENTITY_FILE_FOR_PY')); print(d.get('vault_path',''))" 2>/dev/null) && break + fi + done +fi if [[ -z "$VAULT_ROOT" ]]; then echo "[ERROR] vault_path not set in $IDENTITY_FILE" >&2