Spaces:
Running
Running
File size: 1,382 Bytes
00a2010 | 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 | """CLI entry points for the installed package."""
from __future__ import annotations
def serve() -> None:
"""Start the FastAPI server (registered as `free-claude-code` script)."""
import uvicorn
from cli.process_registry import kill_all_best_effort
from config.settings import get_settings
settings = get_settings()
try:
uvicorn.run(
"api.app:app",
host=settings.host,
port=settings.port,
log_level="debug",
timeout_graceful_shutdown=5,
)
finally:
kill_all_best_effort()
def init() -> None:
"""Scaffold config at ~/.config/free-claude-code/.env (registered as `fcc-init`)."""
import importlib.resources
from pathlib import Path
config_dir = Path.home() / ".config" / "free-claude-code"
env_file = config_dir / ".env"
if env_file.exists():
print(f"Config already exists at {env_file}")
print("Delete it first if you want to reset to defaults.")
return
config_dir.mkdir(parents=True, exist_ok=True)
template = (
importlib.resources.files("config").joinpath("env.example").read_text("utf-8")
)
env_file.write_text(template, encoding="utf-8")
print(f"Config created at {env_file}")
print(
"Edit it to set your API keys and model preferences, then run: free-claude-code"
)
|