feat(identity): sync.sh and syncro.md read from identity.json
Phase 2 migration complete: sync.sh: - Read Python command from identity.json first (.python.command) - Fall back to auto-detection for legacy machines - Eliminates per-session detection overhead syncro.md: - Read Ollama endpoint from identity.json (.ollama.endpoint // .ollama.fallback) - Read Python command from identity.json (.python.command) - Both sections have legacy fallbacks with detection - Eliminates 2-second curl probe on every write operation - Updated day-of-week verification code example - Updated Ollama draft call section Impact: All scripts now read machine-specific config from identity.json (populated by migrate-identity.sh). Faster, explicit, offline-safe.
This commit is contained in:
@@ -116,18 +116,26 @@ cd "$REPO_ROOT"
|
||||
|
||||
echo -e "${GREEN}[OK]${NC} Working directory: $(pwd)"
|
||||
|
||||
# Detect Python interpreter — verify it actually runs (Windows Store stub passes command -v but fails to execute)
|
||||
# Detect Python interpreter — read from identity.json first, fall back to detection
|
||||
PYTHON=""
|
||||
for candidate in py python3 python; do
|
||||
if command -v "$candidate" >/dev/null 2>&1; then
|
||||
if "$candidate" -c "import sys; sys.exit(0)" >/dev/null 2>&1; then
|
||||
PYTHON="$candidate"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -f ".claude/identity.json" ] && command -v jq >/dev/null 2>&1; then
|
||||
PYTHON=$(jq -r '.python.command // empty' ".claude/identity.json" 2>/dev/null)
|
||||
fi
|
||||
|
||||
# Fallback: auto-detect if not in identity.json
|
||||
if [ -z "$PYTHON" ]; then
|
||||
echo -e "${RED}[ERROR]${NC} No Python interpreter found (tried: py, python3, python)"
|
||||
for candidate in py python3 python; do
|
||||
if command -v "$candidate" >/dev/null 2>&1; then
|
||||
if "$candidate" -c "import sys; sys.exit(0)" >/dev/null 2>&1; then
|
||||
PYTHON="$candidate"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$PYTHON" ]; then
|
||||
echo -e "${RED}[ERROR]${NC} No Python interpreter found. Run .claude/scripts/migrate-identity.sh to populate identity.json."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user