File size: 723 Bytes
279ebac
a02272f
 
 
 
 
 
 
 
 
 
 
 
 
279ebac
a02272f
 
 
279ebac
a02272f
279ebac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""ever-brain create <name> — Create a new Brain Instance."""

import typer

from brain.paths import get_brain_path
from brain.templates.brain_instance import scaffold_brain_instance
from brain.utils.display import error, success, info


def create(name: str = typer.Argument(..., help="Name for the new Brain Instance")) -> None:
    """Create a new Brain Instance at ~/brains/<name>/."""
    brain_path = get_brain_path(name)

    if brain_path.exists():
        error(f"Ever Brain instance '{name}' already exists.")
        raise typer.Exit(code=1)

    scaffold_brain_instance(brain_path)
    success(f"Ever Brain instance '{name}' created.")
    info(f"Path: {brain_path}")
    info("Next: ever-brain use " + name)