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(release): validate install path and build artifacts

cyhc8a401b46481
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index ff4d10a00..f5df1ca61 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -40,13 +40,17 @@ jobs:
with:
python-version: "3.12"
- - name: Install test dependencies
+ - name: Install build and test dependencies
run: |
- pip install -e . pytest
+ pip install -e . build pytest
+
+ - name: Build package artifact
+ run: python -m build
- name: Run install and upgrade regressions
run: |
docker info
+ export VIBE_INSTALL_TEST_WHEEL="$(ls dist/*.whl)"
pytest \
tests/test_upgrade_flow.py \
tests/test_install_script.py \
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index d9537b6b6..dd83f02d9 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -41,12 +41,16 @@ jobs:
with:
python-version: "3.12"
- - name: Install test dependencies
- run: pip install -e . pytest
+ - name: Install build and test dependencies
+ run: pip install -e . build pytest
+
+ - name: Build package
+ run: python -m build
- name: Run release install and upgrade regressions
run: |
docker info
+ export VIBE_INSTALL_TEST_WHEEL="$(ls dist/*.whl)"
pytest \
tests/test_upgrade_flow.py \
tests/test_install_script.py \
@@ -54,12 +58,6 @@ jobs:
tests/e2e/test_upgrade_command.py \
-v
- - name: Install build tools
- run: pip install build
-
- - name: Build package
- run: python -m build
-
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
diff --git a/install.sh b/install.sh
index c59341cfd..3f4e40865 100755
--- a/install.sh
+++ b/install.sh
@@ -94,21 +94,8 @@ is_absolute_dir() {
}
choose_tool_bin_dir() {
- local preferred_dirs=(
- "$HOME/.local/bin"
- "$HOME/bin"
- "/usr/local/bin"
- "/opt/homebrew/bin"
- )
local dir
- for dir in "${preferred_dirs[@]}"; do
- if path_contains_dir "$ORIGINAL_PATH" "$dir" && ensure_writable_dir "$dir"; then
- echo "$dir"
- return 0
- fi
- done
-
local old_ifs="$IFS"
IFS=":"
for dir in $ORIGINAL_PATH; do
@@ -120,6 +107,20 @@ choose_tool_bin_dir() {
done
IFS="$old_ifs"
+ local preferred_dirs=(
+ "$HOME/.local/bin"
+ "$HOME/bin"
+ "/usr/local/bin"
+ "/opt/homebrew/bin"
+ )
+
+ for dir in "${preferred_dirs[@]}"; do
+ if is_absolute_dir "$dir" && ensure_writable_dir "$dir"; then
+ echo "$dir"
+ return 0
+ fi
+ done
+
return 1
}
@@ -136,6 +137,32 @@ uv_tool_install() {
fi
}
+install_package_candidate() {
+ local package_spec="$1"
+ shift
+
+ if [ "$package_spec" = "$PACKAGE_NAME" ]; then
+ uv_tool_install "$package_spec" --force --refresh "$@" 2>/dev/null
+ else
+ uv_tool_install "$package_spec" --force "$@" 2>/dev/null
+ fi
+}
+
+resolve_vibe_on_original_path() {
+ PATH="$ORIGINAL_PATH" command -v vibe 2>/dev/null || true
+}
+
+is_vibe_immediately_available() {
+ local resolved_vibe
+
+ if [ -z "$VIBE_BIN_PATH" ]; then
+ return 1
+ fi
+
+ resolved_vibe="$(resolve_vibe_on_original_path)"
+ [ -n "$resolved_vibe" ] && [ "$resolved_vibe" = "$VIBE_BIN_PATH" ]
+}
+
# Install uv if not present
install_uv() {
if command_exists uv; then
@@ -181,6 +208,7 @@ install_uv() {
# Install vibe-remote using uv (uv auto-downloads Python if needed)
install_vibe() {
info "Installing vibe-remote (Python will be downloaded automatically if needed)..."
+ local install_package_spec="${VIBE_INSTALL_PACKAGE_SPEC:-}"
VIBE_TOOL_BIN_DIR="$(choose_tool_bin_dir || true)"
if [ -n "$VIBE_TOOL_BIN_DIR" ]; then
@@ -188,16 +216,25 @@ install_vibe() {
else
warn "Could not find a writable directory in PATH; you may need a new shell before 'vibe' is available"
fi
+
+ if [ -n "$install_package_spec" ]; then
+ if install_package_candidate "$install_package_spec"; then
+ success "vibe-remote installed successfully (from custom package spec)"
+ return 0
+ fi
+
+ error "Failed to install vibe-remote from custom package spec: $install_package_spec"
+ fi
# uv tool install will auto-download Python if not available
# --force: reinstall even if already installed
# --refresh: refresh package cache to get latest version
# Try in order: PyPI -> China mirror (tsinghua) -> GitHub
- if uv_tool_install "$PACKAGE_NAME" --force --refresh 2>/dev/null; then
+ if install_package_candidate "$PACKAGE_NAME"; then
success "vibe-remote installed successfully (from PyPI)"
- elif uv_tool_install "$PACKAGE_NAME" --force --refresh --index-url https://pypi.tuna.tsinghua.edu.cn/simple 2>/dev/null; then
+ elif install_package_candidate "$PACKAGE_NAME" --index-url https://pypi.tuna.tsinghua.edu.cn/simple; then
success "vibe-remote installed successfully (from Tsinghua mirror)"
- elif uv_tool_install "git+https://github.com/${REPO}.git" --force 2>/dev/null; then
+ elif install_package_candidate "git+https://github.com/${REPO}.git"; then
success "vibe-remote installed successfully (from GitHub)"
else
error "Failed to install vibe-remote from all sources"
@@ -252,12 +289,12 @@ print_next_steps() {
echo -e "${GREEN}Installation complete!${NC}"
echo ""
echo -e "${BLUE}Next steps:${NC}"
- if command_exists vibe; then
+ if is_vibe_immediately_available; then
echo " 1. Run 'vibe' to start the setup wizard"
echo " 2. Configure your Slack app tokens in the web UI"
echo " 3. Enable channels and start chatting with AI agents"
else
- echo " 1. Run 'source ${vibe_dir}/env' (or restart your shell)"
+ echo " 1. Run 'export PATH=\"${vibe_dir}:\$PATH\"' in your shell"
echo " 2. Run 'vibe' to start the setup wizard"
echo " 3. Configure your Slack app tokens in the web UI"
echo " 4. Enable channels and start chatting with AI agents"
diff --git a/tests/e2e/test_install_command.py b/tests/e2e/test_install_command.py
index 1e47e0721..fe022914e 100644
--- a/tests/e2e/test_install_command.py
+++ b/tests/e2e/test_install_command.py
@@ -5,16 +5,38 @@ from __future__ import annotations
import os
import shutil
import subprocess
+import sys
+import tempfile
from pathlib import Path
import pytest
REPO_ROOT = Path(__file__).resolve().parents[2]
-INSTALL_SCRIPT = REPO_ROOT / "install.sh"
BASE_IMAGE = os.environ.get("VIBE_INSTALL_TEST_IMAGE", "debian:trixie-slim")
+def _resolve_install_wheel(fixtures_dir: Path) -> Path:
+ configured_wheel = os.environ.get("VIBE_INSTALL_TEST_WHEEL")
+ if configured_wheel:
+ wheel_path = Path(configured_wheel).resolve()
+ assert wheel_path.exists(), f"Expected install test wheel at {wheel_path}"
+ return wheel_path
+
+ result = subprocess.run(
+ [sys.executable, "-m", "pip", "wheel", ".", "--no-deps", "--wheel-dir", str(fixtures_dir)],
+ cwd=REPO_ROOT,
+ capture_output=True,
+ text=True,
+ timeout=600,
+ )
+ assert result.returncode == 0, result.stdout + result.stderr
+
+ wheels = sorted(fixtures_dir.glob("vibe_remote-*.whl"))
+ assert wheels, "Expected a built wheel for install test"
+ return wheels[-1]
+
+
def _docker_available() -> bool:
if not shutil.which("docker"):
return False
@@ -30,37 +52,49 @@ def test_install_command_starts_vibe_in_fresh_container():
if not _docker_available():
pytest.skip("Docker is not available")
- container_name = f"vibe-install-smoke-{os.getpid()}"
- command = (
- "apt-get update >/dev/null && "
- "apt-get install -y --no-install-recommends curl ca-certificates bash procps >/dev/null && "
- "cat /work/install.sh | bash && "
- "vibe && sleep 2 && vibe status"
- )
+ with tempfile.TemporaryDirectory(prefix="vibe-install-fixtures-") as tmpdir:
+ fixtures_dir = Path(tmpdir)
+ wheel_path = _resolve_install_wheel(fixtures_dir)
- result = subprocess.run(
- [
- "docker",
- "run",
- "--name",
- container_name,
- "--rm",
- "-v",
- f"{REPO_ROOT}:/work",
- "-w",
- "/work",
- BASE_IMAGE,
- "bash",
- "-lc",
- command,
- ],
- capture_output=True,
- text=True,
- timeout=600,
- )
+ container_name = f"vibe-install-smoke-{os.getpid()}"
+ command = (
+ "apt-get update >/dev/null && "
+ "apt-get install -y --no-install-recommends curl ca-certificates bash procps >/dev/null && "
+ f"cat /work/install.sh | env VIBE_INSTALL_PACKAGE_SPEC=/fixtures/{wheel_path.name} bash && "
+ "vibe version && "
+ "vibe && sleep 2 && vibe status"
+ )
+
+ try:
+ result = subprocess.run(
+ [
+ "docker",
+ "run",
+ "--name",
+ container_name,
+ "--rm",
+ "-v",
+ f"{REPO_ROOT}:/work",
+ "-v",
+ f"{wheel_path.parent}:/fixtures",
+ "-w",
+ "/work",
+ BASE_IMAGE,
+ "bash",
+ "-lc",
+ command,
+ ],
+ capture_output=True,
+ text=True,
+ timeout=900,
+ )
+ finally:
+ subprocess.run(["docker", "rm", "-f", container_name], capture_output=True)
assert result.returncode == 0, result.stdout + result.stderr
assert "Installing vibe command into" in result.stdout
+ assert "vibe-remote installed successfully (from custom package spec)" in result.stdout
+ assert "vibe-remote " in result.stdout
assert "Web UI:" in result.stdout
assert '"running": true' in result.stdout
assert '"service_pid":' in result.stdout
diff --git a/tests/test_install_script.py b/tests/test_install_script.py
index 102e803a1..421404784 100644
--- a/tests/test_install_script.py
+++ b/tests/test_install_script.py
@@ -16,6 +16,17 @@ def _write_executable(path: Path, content: str) -> None:
path.chmod(path.stat().st_mode | stat.S_IEXEC)
+def _run(command: str, *, cwd: Path, env: dict[str, str], timeout: int = 30) -> subprocess.CompletedProcess[str]:
+ return subprocess.run(
+ ["bash", "-c", command],
+ cwd=cwd,
+ env=env,
+ capture_output=True,
+ text=True,
+ timeout=timeout,
+ )
+
+
def _write_fake_uv(path: Path, uv_log: Path) -> None:
_write_executable(
path,
@@ -47,6 +58,14 @@ def _write_fake_uv(path: Path, uv_log: Path) -> None:
)
+def _install(env: dict[str, str], *, cwd: Path = REPO_ROOT) -> subprocess.CompletedProcess[str]:
+ return _run(f'bash "{INSTALL_SCRIPT}"', cwd=cwd, env=env)
+
+
+def _vibe_version(env: dict[str, str], *, cwd: Path = REPO_ROOT) -> subprocess.CompletedProcess[str]:
+ return _run("vibe version", cwd=cwd, env=env)
+
+
def test_install_script_keeps_vibe_available_on_current_path(tmp_path):
home_dir = tmp_path / "home"
home_dir.mkdir()
@@ -60,17 +79,14 @@ def test_install_script_keeps_vibe_available_on_current_path(tmp_path):
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,
- )
+ install_result = _install(env)
+ version_result = _vibe_version(env)
- assert result.returncode == 0, result.stdout + result.stderr
- assert "vibe-remote 9.9.9" in result.stdout
+ assert install_result.returncode == 0, install_result.stdout + install_result.stderr
+ assert "Run 'vibe' to start the setup wizard" in install_result.stdout
+ assert "export PATH=" not in install_result.stdout
+ assert version_result.returncode == 0, version_result.stdout + version_result.stderr
+ assert "vibe-remote 9.9.9" in version_result.stdout
assert uv_log.read_text(encoding="utf-8")
@@ -96,18 +112,34 @@ def test_install_script_prefers_new_bin_over_stale_local_bin(tmp_path):
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,
- )
+ install_result = _install(env)
+ version_result = _vibe_version(env)
+
+ assert install_result.returncode == 0, install_result.stdout + install_result.stderr
+ assert version_result.returncode == 0, version_result.stdout + version_result.stderr
+ assert "vibe-remote 9.9.9" in version_result.stdout
+ assert "vibe-remote 0.1.0" not in version_result.stdout
+
+
+def test_install_script_prefers_original_path_order(tmp_path):
+ home_dir = tmp_path / "home"
+ home_dir.mkdir()
+ first_dir = tmp_path / "first-bin"
+ first_dir.mkdir()
+ second_dir = tmp_path / "second-bin"
+ second_dir.mkdir()
+ uv_log = tmp_path / "uv-tool-bin-dir.txt"
+
+ _write_fake_uv(first_dir / "uv", uv_log)
+
+ env = os.environ.copy()
+ env["HOME"] = str(home_dir)
+ env["PATH"] = os.pathsep.join([str(first_dir), str(second_dir), "/usr/bin", "/bin"])
- 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
+ install_result = _install(env, cwd=tmp_path)
+
+ assert install_result.returncode == 0, install_result.stdout + install_result.stderr
+ assert uv_log.read_text(encoding="utf-8") == str(first_dir)
def test_install_script_skips_relative_path_entries_for_tool_bin(tmp_path):
@@ -125,16 +157,33 @@ def test_install_script_skips_relative_path_entries_for_tool_bin(tmp_path):
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,
- )
+ install_result = _install(env, cwd=tmp_path)
- assert result.returncode == 0, result.stdout + result.stderr
+ assert install_result.returncode == 0, install_result.stdout + install_result.stderr
selected_dir = Path(uv_log.read_text(encoding="utf-8"))
assert selected_dir.is_absolute()
assert not (relative_bin / "vibe").exists()
+
+
+def test_install_script_requires_path_export_when_install_dir_not_on_original_path(tmp_path):
+ home_dir = tmp_path / "home"
+ home_dir.mkdir()
+ uv_dir = tmp_path / "uv-bin"
+ uv_dir.mkdir()
+ uv_log = tmp_path / "uv-tool-bin-dir.txt"
+
+ _write_fake_uv(uv_dir / "uv", uv_log)
+ uv_dir.chmod(0o555)
+
+ env = os.environ.copy()
+ env["HOME"] = str(home_dir)
+ env["PATH"] = os.pathsep.join([str(uv_dir), "/usr/bin", "/bin"])
+
+ install_result = _install(env, cwd=tmp_path)
+ version_result = _vibe_version(env, cwd=tmp_path)
+ uv_dir.chmod(0o755)
+
+ assert install_result.returncode == 0, install_result.stdout + install_result.stderr
+ assert 'export PATH="' in install_result.stdout
+ assert str(home_dir / ".local" / "bin") in install_result.stdout
+ assert version_result.returncode != 0