File size: 1,924 Bytes
e035c40
 
 
 
 
 
 
484e3bc
e035c40
484e3bc
e035c40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import argparse
import sys
import subprocess
from pathlib import Path


def run_basic_demo() -> None:
    """
    Run the basic usage example (examples/01_basic_usage.py).
    """
    # Always resolve project root as the top folder containing /geobot/
    project_root = Path(__file__).resolve().parents[1]
    examples_dir = project_root / "examples"
    script = examples_dir / "01_basic_usage.py"

    script = project_root / "examples" / "01_basic_usage.py"
    print(f"[GeoBot CLI] Running basic demo: {script}")
    sys.exit(
        subprocess.run([sys.executable, str(script)], check=False).returncode
    )

def run_taiwan_situation_room() -> None:
    project_root = Path(__file__).resolve().parents[1]
    script = project_root / "examples" / "taiwan_situation_room.py"

    if not script.exists():
        print(f"[GeoBot CLI] Taiwan demo script not found at: {script}")
        sys.exit(1)

    print(f"[GeoBot CLI] Launching Taiwan Situation Room: {script}")
    sys.exit(subprocess.run([sys.executable, str(script)], check=False).returncode)


def main() -> None:
    import subprocess  # local import to avoid issues if not used

    parser = argparse.ArgumentParser(
        prog="geobot",
        description="GeoBotv1 CLI - Geopolitical forecasting demos",
    )
    subparsers = parser.add_subparsers(dest="command", required=True)

    # geobot forecast --scenario taiwan
    p_forecast = subparsers.add_parser(
        "forecast", help="Run a forecasting demo scenario"
    )
    p_forecast.add_argument(
        "--scenario",
        type=str,
        default="basic",
        help="Scenario name (e.g. 'basic', 'taiwan')",
    )

    args = parser.parse_args()

    if args.command == "forecast":
        scenario = (args.scenario or "").lower()
        if scenario == "taiwan":
            run_taiwan_situation_room()
        else:
            run_basic_demo()
    else:
        parser.print_help()