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): inspect uv symlink targets

cyh76ccbef1aab2
diff --git a/install.sh b/install.sh
index 516b61860..43e16b29e 100755
--- a/install.sh
+++ b/install.sh
@@ -185,8 +185,37 @@ is_apple_silicon_macos() {
[ "$(detect_os)" = "macos" ] && [ "$(sysctl -n hw.optional.arm64 2>/dev/null || echo 0)" = "1" ]
}
+resolve_binary_path() {
+ local path="$1"
+ local dir=""
+ local target=""
+ local depth=0
+
+ if [ -z "$path" ]; then
+ return 1
+ fi
+
+ while [ -L "$path" ] && [ "$depth" -lt 20 ] && command_exists readlink; do
+ target="$(readlink "$path" 2>/dev/null || true)"
+ if [ -z "$target" ]; then
+ break
+ fi
+ case "$target" in
+ /*) path="$target" ;;
+ *)
+ dir="$(dirname "$path")"
+ path="$dir/$target"
+ ;;
+ esac
+ depth=$((depth + 1))
+ done
+
+ printf '%s\n' "$path"
+}
+
binary_architecture() {
local path="$1"
+ path="$(resolve_binary_path "$path" || true)"
if [ -z "$path" ] || [ ! -e "$path" ] || ! command_exists file; then
return 1
diff --git a/tests/test_install_script.py b/tests/test_install_script.py
index 9cc2528bc..25a6558ae 100644
--- a/tests/test_install_script.py
+++ b/tests/test_install_script.py
@@ -405,3 +405,52 @@ def test_install_script_accepts_universal_uv_with_arm64e_slice_on_apple_silicon(
assert "Found x86_64 uv on Apple Silicon" not in install_result.stdout
assert "uv is already installed" in install_result.stdout
assert uv_log.read_text(encoding="utf-8") == str(path_dir)
+
+
+def test_install_script_checks_uv_symlink_target_architecture_on_apple_silicon(tmp_path):
+ home_dir = tmp_path / "home"
+ home_dir.mkdir()
+ path_dir = tmp_path / "path-bin"
+ path_dir.mkdir()
+ cellar_dir = tmp_path / "Cellar" / "uv" / "bin"
+ cellar_dir.mkdir(parents=True)
+ uv_log = tmp_path / "uv-tool-bin-dir.txt"
+
+ uv_link = path_dir / "uv"
+ uv_target = cellar_dir / "uv"
+ native_uv = home_dir / ".local" / "bin" / "uv"
+ native_uv.parent.mkdir(parents=True)
+ _write_fake_uv(uv_target, uv_log)
+ _write_fake_uv(native_uv, uv_log)
+ uv_link.symlink_to(uv_target)
+ _write_fake_uname(path_dir / "uname")
+ _write_fake_sysctl(path_dir / "sysctl", arm64=True)
+ _write_fake_file(
+ path_dir / "file",
+ {
+ uv_link: "symbolic link to Cellar/uv/bin/uv",
+ uv_target: "Mach-O 64-bit executable x86_64",
+ native_uv: "Mach-O 64-bit executable arm64",
+ },
+ )
+ _write_executable(
+ path_dir / "curl",
+ """\
+ #!/usr/bin/env bash
+ cat <<'EOF'
+ #!/usr/bin/env sh
+ mkdir -p "$HOME/.local/bin"
+ exit 0
+ EOF
+ """,
+ )
+
+ env = os.environ.copy()
+ env["HOME"] = str(home_dir)
+ env["PATH"] = os.pathsep.join([str(path_dir), "/usr/bin", "/bin"])
+
+ install_result = _install(env, cwd=tmp_path)
+
+ assert install_result.returncode == 0, install_result.stdout + install_result.stderr
+ assert "Found x86_64 uv on Apple Silicon" in install_result.stdout
+ assert uv_log.read_text(encoding="utf-8") == str(path_dir)
diff --git a/tests/test_vibe_cli.py b/tests/test_vibe_cli.py
index 87a4d3f15..9bb6e4394 100644
--- a/tests/test_vibe_cli.py
+++ b/tests/test_vibe_cli.py
@@ -249,6 +249,27 @@ def test_runtime_architecture_items_pass_for_arm64e_universal_uv_on_apple_silico
assert any(item["status"] == "pass" and "uv architecture: arm64" in item["message"] for item in items)
+def test_binary_architecture_follows_uv_symlink(tmp_path, monkeypatch):
+ uv_target = tmp_path / "Cellar" / "uv" / "bin" / "uv"
+ uv_target.parent.mkdir(parents=True)
+ uv_target.write_text("#!/bin/sh\n", encoding="utf-8")
+ uv_link = tmp_path / "bin" / "uv"
+ uv_link.parent.mkdir()
+ uv_link.symlink_to(uv_target)
+ calls = []
+
+ def fake_run(command, **kwargs):
+ calls.append(command)
+ return SimpleNamespace(stdout=f"{uv_target}: Mach-O 64-bit executable arm64\n", stderr="")
+
+ monkeypatch.setattr(cli.subprocess, "run", fake_run)
+
+ output = cli._binary_architecture(str(uv_link))
+
+ assert output and "arm64" in output
+ assert calls == [["file", str(uv_target)]]
+
+
def test_cmd_start_ensures_services_without_stopping(monkeypatch):
calls = []
config = SimpleNamespace(
diff --git a/vibe/cli.py b/vibe/cli.py
index 0d4c003aa..ec5208470 100644
--- a/vibe/cli.py
+++ b/vibe/cli.py
@@ -261,9 +261,10 @@ def _is_apple_silicon_host() -> bool:
def _binary_architecture(path: str | None) -> str | None:
if not path:
return None
+ resolved_path = str(Path(path).resolve())
try:
result = subprocess.run(
- ["file", path],
+ ["file", resolved_path],
capture_output=True,
text=True,
timeout=3,