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.

feat(rebrand): migrate default home to avibe

cyhb412ceda9136
diff --git a/config/__init__.py b/config/__init__.py
index 12c99c5cc..c7181c882 100644
--- a/config/__init__.py
+++ b/config/__init__.py
@@ -1,4 +1,6 @@
from .paths import (
+ AVIBE_HOME_ENV,
+ LEGACY_VIBE_REMOTE_HOME_ENV,
get_vibe_remote_dir,
get_config_dir,
get_state_dir,
@@ -12,6 +14,7 @@ from .paths import (
get_settings_path,
get_sessions_path,
ensure_data_dirs,
+ migrate_default_home,
)
from .v2_config import V2Config
from .v2_settings import SettingsStore
@@ -21,6 +24,8 @@ __all__ = [
"V2Config",
"SettingsStore",
"SessionsStore",
+ "AVIBE_HOME_ENV",
+ "LEGACY_VIBE_REMOTE_HOME_ENV",
"get_vibe_remote_dir",
"get_config_dir",
"get_state_dir",
@@ -34,4 +39,5 @@ __all__ = [
"get_settings_path",
"get_sessions_path",
"ensure_data_dirs",
+ "migrate_default_home",
]
diff --git a/config/paths.py b/config/paths.py
index 427e5d0f9..70039bc89 100644
--- a/config/paths.py
+++ b/config/paths.py
@@ -1,12 +1,114 @@
import os
+import sys
from pathlib import Path
+AVIBE_HOME_ENV = "AVIBE_HOME"
+LEGACY_VIBE_REMOTE_HOME_ENV = "VIBE_REMOTE_HOME"
+AVIBE_HOME_DIRNAME = ".avibe"
+LEGACY_VIBE_REMOTE_HOME_DIRNAME = ".vibe_remote"
+HOME_MIGRATION_NOTICE_PATH = "state/home_migration_notice"
+
+
+def _expand_path(value: str | Path) -> Path:
+ return Path(value).expanduser().resolve()
+
+
+def _default_avibe_dir(home: Path | None = None) -> Path:
+ return (home or Path.home()) / AVIBE_HOME_DIRNAME
+
+
+def _legacy_vibe_remote_dir(home: Path | None = None) -> Path:
+ return (home or Path.home()) / LEGACY_VIBE_REMOTE_HOME_DIRNAME
+
+
+def _is_symlink_to(path: Path, target: Path) -> bool:
+ if not path.is_symlink():
+ return False
+ try:
+ return path.resolve() == target.resolve()
+ except OSError:
+ return False
+
+
+def _safe_symlink_legacy_home(target: Path, legacy: Path) -> bool:
+ if legacy.exists() or legacy.is_symlink():
+ return _is_symlink_to(legacy, target)
+ try:
+ legacy.symlink_to(target, target_is_directory=True)
+ except OSError:
+ return False
+ return True
+
+
+def _write_migration_notice(root: Path, message: str) -> bool:
+ notice_path = root / HOME_MIGRATION_NOTICE_PATH
+ if notice_path.exists():
+ return False
+ try:
+ notice_path.parent.mkdir(parents=True, exist_ok=True)
+ notice_path.write_text(message.rstrip() + "\n", encoding="utf-8")
+ except OSError:
+ return False
+ print(message, file=sys.stderr)
+ return True
+
+
def get_vibe_remote_dir() -> Path:
- custom = os.environ.get("VIBE_REMOTE_HOME")
+ custom = os.environ.get(AVIBE_HOME_ENV)
if custom:
- return Path(custom).expanduser().resolve()
- return Path.home() / ".vibe_remote"
+ return _expand_path(custom)
+
+ legacy_custom = os.environ.get(LEGACY_VIBE_REMOTE_HOME_ENV)
+ if legacy_custom:
+ return _expand_path(legacy_custom)
+
+ avibe_dir = _default_avibe_dir()
+ legacy_dir = _legacy_vibe_remote_dir()
+ if avibe_dir.exists() or avibe_dir.is_symlink():
+ return avibe_dir
+ if legacy_dir.exists() or legacy_dir.is_symlink():
+ return legacy_dir
+ return avibe_dir
+
+
+def migrate_default_home() -> Path:
+ """Adopt the default avibe home while preserving legacy path compatibility.
+
+ Explicit home env vars are honored as-is and never migrated. The migration
+ only applies to default homes under ``Path.home()``.
+ """
+ if os.environ.get(AVIBE_HOME_ENV) or os.environ.get(LEGACY_VIBE_REMOTE_HOME_ENV):
+ return get_vibe_remote_dir()
+
+ avibe_dir = _default_avibe_dir()
+ legacy_dir = _legacy_vibe_remote_dir()
+
+ if avibe_dir.exists() or avibe_dir.is_symlink():
+ _safe_symlink_legacy_home(avibe_dir, legacy_dir)
+ if legacy_dir.exists() and not _is_symlink_to(legacy_dir, avibe_dir) and legacy_dir != avibe_dir:
+ _write_migration_notice(
+ avibe_dir,
+ "avibe is using ~/.avibe. A real ~/.vibe_remote directory also exists and was not modified.",
+ )
+ return avibe_dir
+
+ if legacy_dir.exists() and not legacy_dir.is_symlink():
+ try:
+ legacy_dir.rename(avibe_dir)
+ except OSError:
+ return legacy_dir
+ _safe_symlink_legacy_home(avibe_dir, legacy_dir)
+ _write_migration_notice(
+ avibe_dir,
+ "Migrated runtime home from ~/.vibe_remote to ~/.avibe. The old path now points to ~/.avibe.",
+ )
+ return avibe_dir
+
+ if legacy_dir.is_symlink():
+ return legacy_dir.resolve()
+
+ return avibe_dir
def get_config_dir() -> Path:
@@ -121,6 +223,7 @@ Keep entries short, factual, reusable, deduplicated, and free of secrets unless
def ensure_data_dirs() -> None:
+ migrate_default_home()
get_config_dir().mkdir(parents=True, exist_ok=True)
get_state_dir().mkdir(parents=True, exist_ok=True)
get_logs_dir().mkdir(parents=True, exist_ok=True)
diff --git a/tests/conftest.py b/tests/conftest.py
index 07de431e9..367fa8ed1 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -3,7 +3,8 @@
Per AGENTS.md ("Tests and probes must never mutate the current local
environment or live user state"), every test runs against an isolated
data directory by default, so config writes, state files, and runtime
-markers can never leak into the developer's real ``~/.vibe_remote/``
+markers can never leak into the developer's real ``~/.avibe/`` or
+``~/.vibe_remote/``
directory.
Historically a handful of install / upgrade tests mocked
@@ -21,7 +22,7 @@ regressions in path-resolution logic.
Path-resolution tests (e.g. ``tests/test_v2_paths.py::test_paths_are_under_home``)
intentionally cover the env-var-unset branch where ``get_vibe_remote_dir``
-falls back to ``Path.home() / '.vibe_remote'``. Those opt out with
+falls back to the default home. Those opt out with
``@pytest.mark.uses_real_paths``, run against the real environment, and
must remain read-only (they may not call ``cfg.save()`` or otherwise
write to ``~/.vibe_remote/``).
@@ -36,4 +37,5 @@ import pytest
def _isolate_vibe_remote_home(request, tmp_path, monkeypatch):
if request.node.get_closest_marker("uses_real_paths"):
return
+ monkeypatch.delenv("AVIBE_HOME", raising=False)
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / ".vibe_remote"))
diff --git a/tests/test_v2_paths.py b/tests/test_v2_paths.py
index df6b6d510..d5b99986c 100644
--- a/tests/test_v2_paths.py
+++ b/tests/test_v2_paths.py
@@ -6,7 +6,7 @@ from config import paths
@pytest.mark.uses_real_paths
def test_paths_are_under_home():
root = paths.get_vibe_remote_dir()
- assert root.name == ".vibe_remote"
+ assert root.name in {".avibe", ".vibe_remote"}
assert paths.get_config_path().parent == paths.get_config_dir()
assert paths.get_settings_path().parent == paths.get_state_dir()
assert paths.get_sessions_path().parent == paths.get_state_dir()
@@ -15,14 +15,14 @@ def test_paths_are_under_home():
def test_ensure_data_dirs(tmp_path, monkeypatch):
- monkeypatch.setattr(paths, "get_vibe_remote_dir", lambda: tmp_path / ".vibe_remote")
- paths.ensure_data_dirs()
- assert (tmp_path / ".vibe_remote" / "config").exists()
- assert (tmp_path / ".vibe_remote" / "state").exists()
- assert (tmp_path / ".vibe_remote" / "logs").exists()
- assert (tmp_path / ".vibe_remote" / "runtime").exists()
- assert (tmp_path / ".vibe_remote" / "attachments").exists()
- preferences_path = tmp_path / ".vibe_remote" / "state" / "user_preferences.md"
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path / ".avibe"))
+ paths.ensure_data_dirs()
+ assert (tmp_path / ".avibe" / "config").exists()
+ assert (tmp_path / ".avibe" / "state").exists()
+ assert (tmp_path / ".avibe" / "logs").exists()
+ assert (tmp_path / ".avibe" / "runtime").exists()
+ assert (tmp_path / ".avibe" / "attachments").exists()
+ preferences_path = tmp_path / ".avibe" / "state" / "user_preferences.md"
assert preferences_path.exists()
text = preferences_path.read_text(encoding="utf-8")
assert "# User Context and Preferences" in text
@@ -30,3 +30,130 @@ def test_ensure_data_dirs(tmp_path, monkeypatch):
assert "### platform/user_id" in text
assert "communicate, work, and make decisions." in text
assert "free of secrets unless the user explicitly asks." in text
+
+
+def test_avibe_home_env_wins_over_legacy_env(tmp_path, monkeypatch):
+ avibe_home = tmp_path / "custom-avibe"
+ legacy_home = tmp_path / "custom-legacy"
+ monkeypatch.setenv("AVIBE_HOME", str(avibe_home))
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(legacy_home))
+
+ assert paths.get_vibe_remote_dir() == avibe_home.resolve()
+
+ paths.ensure_data_dirs()
+
+ assert (avibe_home / "state").exists()
+ assert not legacy_home.exists()
+
+
+def test_legacy_env_is_honored_without_migration(tmp_path, monkeypatch):
+ legacy_home = tmp_path / "explicit-legacy"
+ monkeypatch.delenv("AVIBE_HOME", raising=False)
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(legacy_home))
+
+ assert paths.get_vibe_remote_dir() == legacy_home.resolve()
+
+ paths.ensure_data_dirs()
+
+ assert (legacy_home / "state").exists()
+ assert not (tmp_path / ".avibe").exists()
+
+
+def test_default_prefers_existing_avibe_home(tmp_path, monkeypatch):
+ monkeypatch.delenv("AVIBE_HOME", raising=False)
+ monkeypatch.delenv("VIBE_REMOTE_HOME", raising=False)
+ monkeypatch.setattr(paths.Path, "home", lambda: tmp_path)
+ avibe_home = tmp_path / ".avibe"
+ avibe_home.mkdir()
+
+ assert paths.get_vibe_remote_dir() == avibe_home
+
+ paths.ensure_data_dirs()
+
+ assert avibe_home.exists()
+ assert (tmp_path / ".vibe_remote").is_symlink()
+ assert (tmp_path / ".vibe_remote").resolve() == avibe_home.resolve()
+
+
+def test_default_adopts_old_user_home_without_data_loss(tmp_path, monkeypatch, capsys):
+ monkeypatch.delenv("AVIBE_HOME", raising=False)
+ monkeypatch.delenv("VIBE_REMOTE_HOME", raising=False)
+ monkeypatch.setattr(paths.Path, "home", lambda: tmp_path)
+ old_home = tmp_path / ".vibe_remote"
+ old_state = old_home / "state"
+ old_state.mkdir(parents=True)
+ (old_state / "settings.json").write_text('{"ok": true}', encoding="utf-8")
+
+ assert paths.get_vibe_remote_dir() == old_home
+
+ paths.ensure_data_dirs()
+
+ avibe_home = tmp_path / ".avibe"
+ assert avibe_home.is_dir()
+ assert (avibe_home / "state" / "settings.json").read_text(encoding="utf-8") == '{"ok": true}'
+ assert old_home.is_symlink()
+ assert old_home.resolve() == avibe_home.resolve()
+ notice_path = avibe_home / paths.HOME_MIGRATION_NOTICE_PATH
+ assert notice_path.exists()
+ assert "Migrated runtime home" in notice_path.read_text(encoding="utf-8")
+ assert "Migrated runtime home" in capsys.readouterr().err
+
+ paths.ensure_data_dirs()
+
+ assert capsys.readouterr().err == ""
+ assert notice_path.read_text(encoding="utf-8").count("Migrated runtime home") == 1
+
+
+def test_existing_avibe_and_legacy_real_dirs_do_not_clobber(tmp_path, monkeypatch, capsys):
+ monkeypatch.delenv("AVIBE_HOME", raising=False)
+ monkeypatch.delenv("VIBE_REMOTE_HOME", raising=False)
+ monkeypatch.setattr(paths.Path, "home", lambda: tmp_path)
+ avibe_home = tmp_path / ".avibe"
+ legacy_home = tmp_path / ".vibe_remote"
+ avibe_home.mkdir()
+ legacy_home.mkdir()
+ (legacy_home / "legacy.txt").write_text("legacy", encoding="utf-8")
+
+ assert paths.get_vibe_remote_dir() == avibe_home
+
+ paths.ensure_data_dirs()
+
+ assert avibe_home.is_dir()
+ assert legacy_home.is_dir()
+ assert not legacy_home.is_symlink()
+ assert (legacy_home / "legacy.txt").read_text(encoding="utf-8") == "legacy"
+ notice_path = avibe_home / paths.HOME_MIGRATION_NOTICE_PATH
+ assert notice_path.exists()
+ assert "was not modified" in notice_path.read_text(encoding="utf-8")
+ assert "was not modified" in capsys.readouterr().err
+
+
+def test_symlink_creation_failure_still_uses_avibe_home(tmp_path, monkeypatch):
+ monkeypatch.delenv("AVIBE_HOME", raising=False)
+ monkeypatch.delenv("VIBE_REMOTE_HOME", raising=False)
+ monkeypatch.setattr(paths.Path, "home", lambda: tmp_path)
+ avibe_home = tmp_path / ".avibe"
+ avibe_home.mkdir()
+
+ def fail_symlink(self, target, target_is_directory=False):
+ raise OSError("no symlink permission")
+
+ monkeypatch.setattr(paths.Path, "symlink_to", fail_symlink)
+
+ paths.ensure_data_dirs()
+
+ assert avibe_home.is_dir()
+ assert not (tmp_path / ".vibe_remote").exists()
+
+
+def test_default_new_user_uses_avibe_home(tmp_path, monkeypatch):
+ monkeypatch.delenv("AVIBE_HOME", raising=False)
+ monkeypatch.delenv("VIBE_REMOTE_HOME", raising=False)
+ monkeypatch.setattr(paths.Path, "home", lambda: tmp_path)
+
+ assert paths.get_vibe_remote_dir() == tmp_path / ".avibe"
+
+ paths.ensure_data_dirs()
+
+ assert (tmp_path / ".avibe" / "state").exists()
+ assert not (tmp_path / ".vibe_remote").exists()
diff --git a/vibe/sentry_integration.py b/vibe/sentry_integration.py
index 5750be6db..25710834b 100644
--- a/vibe/sentry_integration.py
+++ b/vibe/sentry_integration.py
@@ -12,6 +12,7 @@ from pathlib import Path
from typing import Any, Optional
from config.v2_config import V2Config
+from config import paths
logger = logging.getLogger(__name__)
@@ -146,7 +147,7 @@ def detect_sentry_environment() -> str:
if deployment:
return deployment.strip()
- vibe_home = os.environ.get("VIBE_REMOTE_HOME", "")
+ vibe_home = os.environ.get("AVIBE_HOME") or os.environ.get("VIBE_REMOTE_HOME", "")
if "three-regression" in vibe_home:
return "regression"
@@ -188,7 +189,7 @@ def resolve_sentry_options() -> Optional[dict[str, Any]]:
def build_sentry_contexts(config: V2Config, component: str, environment: str) -> dict[str, dict[str, Any]]:
- vibe_home = os.environ.get("VIBE_REMOTE_HOME") or str(Path.home() / ".vibe_remote")
+ vibe_home = str(paths.get_vibe_remote_dir())
return {
"runtime": {
"python_version": platform.python_version(),