Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(install): preserve selected vibe bin

cyh66ae7c96b401
diff --git a/install.sh b/install.sh
index 8bcc03899..c59341cfd 100755
--- a/install.sh
+++ b/install.sh
@@ -86,6 +86,13 @@ ensure_writable_dir() {
[ -d "$dir" ] && [ -w "$dir" ]
}
+is_absolute_dir() {
+ case "$1" in
+ /*) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
choose_tool_bin_dir() {
local preferred_dirs=(
"$HOME/.local/bin"
@@ -105,7 +112,7 @@ choose_tool_bin_dir() {
local old_ifs="$IFS"
IFS=":"
for dir in $ORIGINAL_PATH; do
- if [ -n "$dir" ] && ensure_writable_dir "$dir"; then
+ if [ -n "$dir" ] && is_absolute_dir "$dir" && ensure_writable_dir "$dir"; then
IFS="$old_ifs"
echo "$dir"
return 0
@@ -202,10 +209,10 @@ verify_installation() {
info "Verifying installation..."
# Refresh PATH
+ export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
if [ -n "$VIBE_TOOL_BIN_DIR" ]; then
export PATH="$VIBE_TOOL_BIN_DIR:$PATH"
fi
- export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
if command_exists vibe; then
VIBE_BIN_PATH="$(command -v vibe)"
diff --git a/tests/test_install_script.py b/tests/test_install_script.py
index 35401b2df..102e803a1 100644
--- a/tests/test_install_script.py
+++ b/tests/test_install_script.py
@@ -16,15 +16,9 @@ def _write_executable(path: Path, content: str) -> None:
path.chmod(path.stat().st_mode | stat.S_IEXEC)
-def test_install_script_keeps_vibe_available_on_current_path(tmp_path):
- home_dir = tmp_path / "home"
- home_dir.mkdir()
- path_dir = tmp_path / "path-bin"
- path_dir.mkdir()
- uv_log = tmp_path / "uv-tool-bin-dir.txt"
-
+def _write_fake_uv(path: Path, uv_log: Path) -> None:
_write_executable(
- path_dir / "uv",
+ path,
f"""\
#!/usr/bin/env bash
set -euo pipefail
@@ -52,6 +46,16 @@ def test_install_script_keeps_vibe_available_on_current_path(tmp_path):
""",
)
+
+def test_install_script_keeps_vibe_available_on_current_path(tmp_path):
+ home_dir = tmp_path / "home"
+ home_dir.mkdir()
+ path_dir = tmp_path / "path-bin"
+ path_dir.mkdir()
+ uv_log = tmp_path / "uv-tool-bin-dir.txt"
+
+ _write_fake_uv(path_dir / "uv", uv_log)
+
env = os.environ.copy()
env["HOME"] = str(home_dir)
env["PATH"] = os.pathsep.join([str(path_dir), "/usr/bin", "/bin"])
@@ -68,3 +72,69 @@ def test_install_script_keeps_vibe_available_on_current_path(tmp_path):
assert result.returncode == 0, result.stdout + result.stderr
assert "vibe-remote 9.9.9" in result.stdout
assert uv_log.read_text(encoding="utf-8")
+
+
+def test_install_script_prefers_new_bin_over_stale_local_bin(tmp_path):
+ home_dir = tmp_path / "home"
+ home_dir.mkdir()
+ local_bin = home_dir / ".local" / "bin"
+ local_bin.mkdir(parents=True)
+ path_dir = tmp_path / "path-bin"
+ path_dir.mkdir()
+ uv_log = tmp_path / "uv-tool-bin-dir.txt"
+
+ _write_fake_uv(path_dir / "uv", uv_log)
+ _write_executable(
+ local_bin / "vibe",
+ """\
+ #!/usr/bin/env bash
+ echo "vibe-remote 0.1.0"
+ """,
+ )
+
+ env = os.environ.copy()
+ env["HOME"] = str(home_dir)
+ env["PATH"] = os.pathsep.join([str(path_dir), "/usr/bin", "/bin"])
+
+ result = subprocess.run(
+ ["bash", "-lc", f'bash "{INSTALL_SCRIPT}" && vibe version'],
+ cwd=REPO_ROOT,
+ env=env,
+ capture_output=True,
+ text=True,
+ timeout=30,
+ )
+
+ assert result.returncode == 0, result.stdout + result.stderr
+ assert "vibe-remote 9.9.9" in result.stdout
+ assert "vibe-remote 0.1.0" not in result.stdout
+
+
+def test_install_script_skips_relative_path_entries_for_tool_bin(tmp_path):
+ home_dir = tmp_path / "home"
+ home_dir.mkdir()
+ relative_bin = tmp_path / "bin"
+ relative_bin.mkdir()
+ path_dir = tmp_path / "path-bin"
+ path_dir.mkdir()
+ uv_log = tmp_path / "uv-tool-bin-dir.txt"
+
+ _write_fake_uv(path_dir / "uv", uv_log)
+
+ env = os.environ.copy()
+ env["HOME"] = str(home_dir)
+ env["PATH"] = os.pathsep.join(["bin", str(path_dir), "/usr/bin", "/bin"])
+
+ result = subprocess.run(
+ ["bash", "-lc", f'bash "{INSTALL_SCRIPT}" && vibe version'],
+ cwd=tmp_path,
+ env=env,
+ capture_output=True,
+ text=True,
+ timeout=30,
+ )
+
+ assert result.returncode == 0, result.stdout + result.stderr
+ selected_dir = Path(uv_log.read_text(encoding="utf-8"))
+ assert selected_dir.is_absolute()
+ assert not (relative_bin / "vibe").exists()