From bf1f37bf4119f15814bb11499336f1dca609f86c Mon Sep 17 00:00:00 2001 From: AIPass Date: Thu, 16 Apr 2026 01:07:37 -0700 Subject: [PATCH] =?UTF-8?q?feat(system):=20feat(setup):=20auto-configure?= =?UTF-8?q?=20AIPASS=5FHOME=20+=20PATH=20for=20cross-project=20access=20?= =?UTF-8?q?=E2=80=94=20all=20AIPass=20services=20(seedgo,=20flow,=20ai=5Fm?= =?UTF-8?q?ail,=20etc.)=20now=20available=20from=20any=20project=20after?= =?UTF-8?q?=20setup.=20Linux:=20AIPASS=5FHOME=20added=20to=20.bashrc.=20Wi?= =?UTF-8?q?ndows:=20AIPASS=5FHOME=20+=20PATH=20+=20PYTHONUTF8=20added=20to?= =?UTF-8?q?=20.bash=5Fprofile.=20Claude=20Code=20settings.json=20gets=20AI?= =?UTF-8?q?PASS=5FHOME=20in=20env=20block=20so=20dispatched=20agents=20inh?= =?UTF-8?q?erit=20it.=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: @devpulse --- setup.sh | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 6 deletions(-) diff --git a/setup.sh b/setup.sh index d420a087..707dba92 100755 --- a/setup.sh +++ b/setup.sh @@ -380,8 +380,19 @@ settings["hooks"] = { ], } +# Inject AIPASS_HOME into env block so dispatched agents find AIPass +import os +env_block = settings.get("env", {}) +env_block["AIPASS_HOME"] = repo_root +# Windows: force UTF-8 for Rich output in hook processes +msys = os.environ.get("MSYSTEM", "") + os.environ.get("OSTYPE", "") +if "MSYS" in msys or "msys" in msys or "MINGW" in msys: + env_block["PYTHONUTF8"] = "1" +settings["env"] = env_block + settings_path.write_text(json.dumps(settings, indent=2) + "\n") print(f" hooks -> {settings_path}") +print(f" AIPASS_HOME -> {repo_root} (in settings.json env)") PYEOF else echo "Skipping hooks (no .claude/hooks/ directory found)" @@ -484,15 +495,65 @@ else echo "Skipping Gemini CLI (not installed)" fi +# --- Set AIPASS_HOME + PATH so all services work from any project --- +echo "" +echo "Configuring cross-project access ..." + +if [ "$IS_WINDOWS" -eq 1 ]; then + # Windows (Git Bash): write to ~/.bash_profile + PROFILE="$HOME/.bash_profile" + touch "$PROFILE" + + # AIPASS_HOME + if ! grep -q "AIPASS_HOME" "$PROFILE" 2>/dev/null; then + echo "" >> "$PROFILE" + echo "# AIPass — cross-project access" >> "$PROFILE" + echo "export AIPASS_HOME=\"$SCRIPT_DIR\"" >> "$PROFILE" + echo " AIPASS_HOME added to $PROFILE" + else + echo " AIPASS_HOME already in $PROFILE" + fi + + # PATH (venv Scripts for Windows) + VENV_SCRIPTS="$SCRIPT_DIR/.venv/Scripts" + if ! grep -q ".venv/Scripts" "$PROFILE" 2>/dev/null; then + echo "export PATH=\"$VENV_SCRIPTS:\$PATH\"" >> "$PROFILE" + echo " PATH updated in $PROFILE (drone available globally)" + else + echo " PATH already includes venv in $PROFILE" + fi + + # PYTHONUTF8 + if ! grep -q "PYTHONUTF8" "$PROFILE" 2>/dev/null; then + echo "export PYTHONUTF8=1" >> "$PROFILE" + echo " PYTHONUTF8=1 added to $PROFILE" + fi + + # Export for current session too + export AIPASS_HOME="$SCRIPT_DIR" + export PATH="$VENV_SCRIPTS:$PATH" + export PYTHONUTF8=1 +else + # Linux/macOS: write to ~/.bashrc + PROFILE="$HOME/.bashrc" + + # AIPASS_HOME + if ! grep -q "AIPASS_HOME" "$PROFILE" 2>/dev/null; then + echo "" >> "$PROFILE" + echo "# AIPass — cross-project access" >> "$PROFILE" + echo "export AIPASS_HOME=\"$SCRIPT_DIR\"" >> "$PROFILE" + echo " AIPASS_HOME added to $PROFILE" + else + echo " AIPASS_HOME already in $PROFILE" + fi + + export AIPASS_HOME="$SCRIPT_DIR" +fi + # --- Create global symlinks for CLI tools (Linux/macOS only) --- echo "" if [ "$IS_WINDOWS" -eq 1 ]; then - echo "Windows detected — skipping symlink (ln/sudo not available on Windows)" - echo "" - echo "To use drone from any directory, add the venv to your PATH:" - echo " PowerShell: \$env:PATH = \"$SCRIPT_DIR\\.venv\\Scripts;\" + \$env:PATH" - echo " Git Bash: export PATH=\"$SCRIPT_DIR/.venv/bin:\$PATH\"" - echo " (Add to ~/.bash_profile for Git Bash persistence)" + echo "Windows: drone available via PATH (set above)" else echo "Creating global symlinks ..." VENV_BIN="$SCRIPT_DIR/.venv/bin"