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 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 20:21:27 -07:00
parent 54fa7a3f4f
commit 386a115039

View File

@@ -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