File size: 2,338 Bytes
279ebac
a02272f
 
60f4128
a02272f
 
 
 
279ebac
a02272f
 
37b748e
 
 
 
a02272f
 
 
 
37b748e
a02272f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37b748e
 
 
 
 
 
a02272f
 
279ebac
a02272f
37b748e
 
 
 
279ebac
 
 
37b748e
 
 
a02272f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""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()