| 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). |
| """ |
| |
| 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 |
|
|
| parser = argparse.ArgumentParser( |
| prog="geobot", |
| description="GeoBotv1 CLI - Geopolitical forecasting demos", |
| ) |
| subparsers = parser.add_subparsers(dest="command", required=True) |
|
|
| |
| 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() |
|
|