Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

refactor(setup): single-source .setup-complete marker helpers

Ruben Lütke9948963d0dff
diff --git a/jarvis/core/config.py b/jarvis/core/config.py
index 9397e0e604..3bf1037ae9 100644
--- a/jarvis/core/config.py
+++ b/jarvis/core/config.py
@@ -2633,14 +2633,17 @@ def ensure_project_root_cwd() -> Path:
def is_first_run() -> bool:
"""Return True when the user has not yet completed the setup wizard."""
- marker = DATA_DIR / ".setup-complete"
- return not marker.exists()
+ # Delegates to jarvis.setup.state so the stdlib-only fast-boot onboarding
+ # path and this heavy module can never disagree on the marker location.
+ from jarvis.setup.state import setup_complete_marker_exists
+
+ return not setup_complete_marker_exists()
def mark_setup_complete() -> None:
DATA_DIR.mkdir(parents=True, exist_ok=True)
(DATA_DIR / ".setup-complete").write_text(
- f"Setup abgeschlossen auf Python {sys.version.split()[0]}\n",
+ f"Setup completed on Python {sys.version.split()[0]}\n",
encoding="utf-8",
)
diff --git a/jarvis/setup/state.py b/jarvis/setup/state.py
index 4b353fe5b1..b7ce1181d6 100644
--- a/jarvis/setup/state.py
+++ b/jarvis/setup/state.py
@@ -67,6 +67,22 @@ def state_path(override: Path | None = None) -> Path:
return override if override is not None else _DEFAULT_STATE_PATH
+def setup_complete_marker_path(path: Path | None = None) -> Path:
+ """Location of the legacy ``.setup-complete`` marker.
+
+ Lives next to the setup-state file (the ``data/`` dir) so the fast-boot
+ onboarding path and ``jarvis.core.config.is_first_run`` agree on ONE file
+ without importing the heavy config module. ``path`` is the state-file
+ override used by tests.
+ """
+ return state_path(path).parent / ".setup-complete"
+
+
+def setup_complete_marker_exists(path: Path | None = None) -> bool:
+ """True when the legacy wizard/setup completion marker is present."""
+ return setup_complete_marker_path(path).exists()
+
+
def load_setup_state(path: Path | None = None) -> dict[str, Any]:
"""Read the setup-state file and return its dict view.
@@ -273,6 +289,8 @@ def reset_onboarding(path: Path | None = None) -> list[str]:
__all__ = [
"state_path",
+ "setup_complete_marker_path",
+ "setup_complete_marker_exists",
"load_setup_state",
"has_seen_obsidian_setup",
"mark_obsidian_seen",
diff --git a/tests/unit/setup/test_setup_marker.py b/tests/unit/setup/test_setup_marker.py
new file mode 100644
index 0000000000..80c65e4bd7
--- /dev/null
+++ b/tests/unit/setup/test_setup_marker.py
@@ -0,0 +1,22 @@
+"""Tests for the single-source .setup-complete marker helpers."""
+from pathlib import Path
+
+from jarvis.setup import state as st
+
+
+def test_marker_path_is_sibling_of_state_file(tmp_path: Path) -> None:
+ state_file = tmp_path / "setup_state.json"
+ assert st.setup_complete_marker_path(state_file) == tmp_path / ".setup-complete"
+
+
+def test_marker_exists_roundtrip(tmp_path: Path) -> None:
+ state_file = tmp_path / "setup_state.json"
+ assert st.setup_complete_marker_exists(state_file) is False
+ (tmp_path / ".setup-complete").write_text("done\n", encoding="utf-8")
+ assert st.setup_complete_marker_exists(state_file) is True
+
+
+def test_default_marker_matches_config_data_dir() -> None:
+ from jarvis.core.config import DATA_DIR
+
+ assert st.setup_complete_marker_path() == DATA_DIR / ".setup-complete"