setup.sh: OS-aware hook bridge — Windows venv python is Scripts/python.exe (DPLAN-0234 Strand C)
- bash passes IS_WINDOWS into the hook-install heredoc; bridge string picks .venv/Scripts/python.exe vs .venv/bin/python3 - @hooks assessment: $AIPASS_HOME expansion fine (CC runs hooks via Git Bash on Windows), bridge has zero POSIX assumptions — interpreter path was the only gap - Verified both OS modes + merge-marker/custom-hook regression
This commit is contained in:
@@ -25,6 +25,18 @@ PyPI version — not the changelog header.
|
||||
17 wired hook entries pass on a cold Linux clone (real kernel/navmap/branch
|
||||
prompt bytes, git gate blocks, clean no-ops on empty state).
|
||||
|
||||
- **Windows fresh installs get a working hook bridge.** setup.sh wrote the
|
||||
Claude bridge command with `.venv/bin/python3` on every OS — but Windows
|
||||
venvs put the interpreter at `.venv/Scripts/python.exe` and have no `bin/`,
|
||||
so hooks on a fresh Windows install pointed at a nonexistent python and
|
||||
would never fire. The bridge string is now OS-aware (bash passes
|
||||
`IS_WINDOWS` into the hook-install step). @hooks assessed the rest of the
|
||||
chain: `$AIPASS_HOME` expansion works on Windows because Claude Code runs
|
||||
hooks via Git Bash (which must exist for setup.sh to have run), and the
|
||||
bridge itself has zero POSIX assumptions — the interpreter path was the
|
||||
only gap. Verified: both OS modes produce the right bridge string, merge
|
||||
marker unchanged, custom-hook preservation intact. (assessed by @hooks)
|
||||
|
||||
### Added
|
||||
|
||||
- **`./aipass` — repo-root cold-clone launcher (DPLAN-0234 Strand B).** The
|
||||
|
||||
@@ -633,7 +633,7 @@ if [ -f "$SCRIPT_DIR/src/aipass/hooks/apps/handlers/bridges/claude.py" ]; then
|
||||
echo "Installing Claude Code hooks ..."
|
||||
mkdir -p "$HOME/.claude"
|
||||
|
||||
"$PYTHON" - "$SCRIPT_DIR" "$CLAUDE_SETTINGS" << 'PYEOF'
|
||||
"$PYTHON" - "$SCRIPT_DIR" "$CLAUDE_SETTINGS" "$IS_WINDOWS" << 'PYEOF'
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
@@ -641,11 +641,16 @@ from pathlib import Path
|
||||
|
||||
repo_root = sys.argv[1]
|
||||
settings_path = Path(sys.argv[2])
|
||||
is_windows = len(sys.argv) > 3 and sys.argv[3] == "1"
|
||||
|
||||
# Bridge entry point — all hooks route through the engine via this bridge.
|
||||
# Uses $AIPASS_HOME env var (injected into settings.env below) so the
|
||||
# settings file stays relocatable.
|
||||
bridge = "$AIPASS_HOME/.venv/bin/python3 $AIPASS_HOME/src/aipass/hooks/apps/handlers/bridges/claude.py"
|
||||
# settings file stays relocatable. CC on Windows runs hooks via Git Bash
|
||||
# (which must exist for setup.sh to have run), so $VAR expansion works —
|
||||
# but the venv interpreter lives at Scripts/python.exe there, not bin/python3
|
||||
# (@hooks assessment, DPLAN-0234 Strand C).
|
||||
venv_python = ".venv/Scripts/python.exe" if is_windows else ".venv/bin/python3"
|
||||
bridge = f"$AIPASS_HOME/{venv_python} $AIPASS_HOME/src/aipass/hooks/apps/handlers/bridges/claude.py"
|
||||
|
||||
# Load existing settings or start fresh
|
||||
if settings_path.exists():
|
||||
|
||||
Reference in New Issue
Block a user