ever-brain / brain /commands /status.py
AlexKurian's picture
feat: implement landing page and documentation site with CLI integration and status command
ddb260a
Raw
History Blame Contribute Delete
2.34 kB
"""Ever Brain status — Display current Ever Brain system state."""
from brain.config import get_active_brain
from brain.paths import get_workspace_dir, get_project_root
from brain.utils.display import console, info
def status() -> None:
"""Show the current Ever Brain system status."""
active = get_active_brain()
workspace = get_workspace_dir()
root = get_project_root()
from brain.config import get_storage_mode
mode = get_storage_mode()
brain_name = "None"
brain_path_str = "-"
project = "None"
memory_path = "-"
version = "-"
runtime = "Disconnected"
if active and active.exists():
brain_name = active.name
brain_path_str = str(active)
# Count versions
versions_dir = active / "versions"
if versions_dir.exists():
version_dirs = [
d for d in versions_dir.iterdir()
if d.is_dir() and d.name.startswith("v")
]
if version_dirs:
latest = sorted(
version_dirs,
key=lambda d: int(d.name[1:]) if d.name[1:].isdigit() else 0,
)[-1]
version = latest.name
else:
version = "v0 (no syncs yet)"
else:
version = "v0 (no syncs yet)"
if workspace.exists():
runtime = "Connected"
project_file = workspace / "current_project"
if project_file.exists():
proj = project_file.read_text(encoding="utf-8").strip()
if proj:
project = proj
# Determine memory path based on mode
if mode == "local":
memory_path = str(workspace / "memory")
elif active:
memory_path = str(active / "projects" / project)
console.print()
console.print("[bold]Ever Brain Status[/bold]")
console.print()
info(f"Designated Root: {root}")
info(f"Storage Mode: {mode.upper()}")
info(f"Workspace Runtime: {runtime}")
console.print()
info(f"Active Ever Brain: {brain_name}")
info(f"Ever Brain Path: {brain_path_str}")
info(f"Ever Brain Version: {version}")
console.print()
info(f"Attached Project: {project}")
info(f"Project Memory: {memory_path}")
console.print()