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): parse uv file descriptions only

cyh6346def0e660
diff --git a/install.sh b/install.sh
index 43e16b29e..ae09fa296 100755
--- a/install.sh
+++ b/install.sh
@@ -221,7 +221,7 @@ binary_architecture() {
return 1
fi
- file "$path" 2>/dev/null || true
+ file -b "$path" 2>/dev/null || true
}
is_arm64_binary() {
diff --git a/tests/test_install_script.py b/tests/test_install_script.py
index 25a6558ae..89fc4729b 100644
--- a/tests/test_install_script.py
+++ b/tests/test_install_script.py
@@ -60,12 +60,18 @@ def _write_fake_uv(path: Path, uv_log: Path) -> None:
def _write_fake_file(path: Path, mapping: dict[Path, str]) -> None:
cases = "\n".join(
- f' "{target}") echo "{target}: {description}" ;;' for target, description in mapping.items()
+ f' "{target}") echo "${{prefix}}{description}" ;;' for target, description in mapping.items()
)
_write_executable(
path,
f"""\
#!/usr/bin/env bash
+ prefix=""
+ if [ "${{1:-}}" = "-b" ]; then
+ shift
+ else
+ prefix="${{1:-}}: "
+ fi
case "${{1:-}}" in
{cases}
*) echo "${{1:-}}: POSIX shell script text executable" ;;
@@ -454,3 +460,51 @@ def test_install_script_checks_uv_symlink_target_architecture_on_apple_silicon(t
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)
+
+
+def test_install_script_ignores_arch_tokens_in_uv_path_prefix(tmp_path):
+ home_dir = tmp_path / "home"
+ home_dir.mkdir()
+ path_dir = tmp_path / "path-bin"
+ path_dir.mkdir()
+ uv_target_dir = tmp_path / "arm64-prefix" / "uv" / "bin"
+ uv_target_dir.mkdir(parents=True)
+ uv_log = tmp_path / "uv-tool-bin-dir.txt"
+
+ existing_uv = path_dir / "uv"
+ uv_target = uv_target_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)
+ existing_uv.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_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 9bb6e4394..82a54db9e 100644
--- a/tests/test_vibe_cli.py
+++ b/tests/test_vibe_cli.py
@@ -267,7 +267,22 @@ def test_binary_architecture_follows_uv_symlink(tmp_path, monkeypatch):
output = cli._binary_architecture(str(uv_link))
assert output and "arm64" in output
- assert calls == [["file", str(uv_target)]]
+ assert calls == [["file", "-b", str(uv_target)]]
+
+
+def test_binary_architecture_omits_path_prefix_before_token_parsing(tmp_path, monkeypatch):
+ uv_path = tmp_path / "arm64-prefix" / "uv"
+ uv_path.parent.mkdir(parents=True)
+ uv_path.write_text("#!/bin/sh\n", encoding="utf-8")
+
+ def fake_run(command, **kwargs):
+ return SimpleNamespace(stdout="Mach-O 64-bit executable x86_64\n", stderr="")
+
+ monkeypatch.setattr(cli.subprocess, "run", fake_run)
+
+ output = cli._binary_architecture(str(uv_path))
+
+ assert cli._architecture_token(output) == "x86_64"
def test_cmd_start_ensures_services_without_stopping(monkeypatch):
diff --git a/vibe/cli.py b/vibe/cli.py
index ec5208470..420371e3a 100644
--- a/vibe/cli.py
+++ b/vibe/cli.py
@@ -264,7 +264,7 @@ def _binary_architecture(path: str | None) -> str | None:
resolved_path = str(Path(path).resolve())
try:
result = subprocess.run(
- ["file", resolved_path],
+ ["file", "-b", resolved_path],
capture_output=True,
text=True,
timeout=3,