-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtinymolty_main.py
More file actions
43 lines (35 loc) · 1.14 KB
/
tinymolty_main.py
File metadata and controls
43 lines (35 loc) · 1.14 KB
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
"""
TinyMolty main entry point module
This module provides the main() function for the CLI script
"""
from __future__ import annotations
import argparse
from pathlib import Path
from app import run
from config import (
resolve_secrets,
try_load_config,
validate_config,
)
from setup import run_setup
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description="TinyMolty - Moltbook AI agent bot")
parser.add_argument("--setup", action="store_true", help="Run setup wizard")
parser.add_argument("--config", type=str, help="Path to config TOML")
return parser.parse_args()
def main() -> None:
args = parse_args()
config_path = Path(args.config).expanduser() if args.config else None
if args.setup:
config = run_setup(config_path)
else:
config, error = try_load_config(config_path)
if config is None:
if error != "missing":
print(f"Config invalid: {error}")
config = run_setup(config_path)
secrets = resolve_secrets(config)
validate_config(config, secrets)
run(config, secrets)
if __name__ == "__main__":
main()