From 251bb3546b9f3af6626c20cf45a55f44e850919f Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Tue, 26 May 2026 20:07:46 -0700 Subject: [PATCH] fix(migrate-identity): Windows compatibility (two bugs) The script auto-detected PYTHON_CMD but then hardcoded `python3` for the JSON write (exit 127 on Windows where only `py` exists), and passed a Git Bash POSIX path (/d/...) to native Python (FileNotFoundError). Fixes: - use "$PYTHON_CMD" instead of hardcoded python3 - convert IDENTITY_PATH via `cygpath -m` for the interpreter (no-op elsewhere) Verified on GURU-5070: identity.json migrated correctly (py, windows/amd64, localhost Ollama, qwen3:8b). Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/scripts/migrate-identity.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.claude/scripts/migrate-identity.sh b/.claude/scripts/migrate-identity.sh index 872d5ed..f14ebc6 100755 --- a/.claude/scripts/migrate-identity.sh +++ b/.claude/scripts/migrate-identity.sh @@ -74,10 +74,13 @@ fi echo "" echo "[INFO] Updating identity.json..." -# Read existing, add new fields, write back -python3 -c " +# Read existing, add new fields, write back. +# On Windows, native Python can't open Git Bash POSIX paths (/d/...); convert to a +# drive-letter/forward-slash path for the interpreter. No-op (falls back) elsewhere. +IDENTITY_PATH_PY=$(cygpath -m "$IDENTITY_PATH" 2>/dev/null || echo "$IDENTITY_PATH") +"$PYTHON_CMD" -c " import json, sys -with open('$IDENTITY_PATH', 'r') as f: +with open('$IDENTITY_PATH_PY', 'r') as f: data = json.load(f) # Add new fields if not present @@ -98,7 +101,7 @@ if 'architecture' not in data: data['last_updated'] = '$(date -u +"%Y-%m-%dT%H:%M:%SZ")' -with open('$IDENTITY_PATH', 'w') as f: +with open('$IDENTITY_PATH_PY', 'w') as f: json.dump(data, f, indent=2) f.write('\n')