Files
local_swarm/main.py
T

97 lines
2.7 KiB
Python

#!/usr/bin/env python3
"""
Local Swarm - Automatically configure and run a swarm of small coding LLMs
"""
import argparse
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from rich.console import Console
from rich.panel import Panel
console = Console()
def main():
parser = argparse.ArgumentParser(
description="Local Swarm - AI-powered coding LLM swarm",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
python main.py # Auto-detect and start
python main.py --detect # Show hardware detection only
python main.py --model qwen:3b:q4 # Use specific model
python main.py --port 8080 # Use custom port
python main.py --instances 4 # Force 4 instances
"""
)
parser.add_argument(
"--detect",
action="store_true",
help="Show hardware detection and exit"
)
parser.add_argument(
"--model",
type=str,
help="Model to use (format: name:size:quant, e.g., qwen:3b:q4)"
)
parser.add_argument(
"--port",
type=int,
default=8000,
help="Port to run the API server on (default: 8000)"
)
parser.add_argument(
"--instances",
type=int,
help="Force number of instances (overrides auto-calculation)"
)
parser.add_argument(
"--download-only",
action="store_true",
help="Download models only, don't start server"
)
parser.add_argument(
"--config",
type=str,
default="config.yaml",
help="Path to config file"
)
parser.add_argument(
"--version",
action="version",
version="%(prog)s 0.1.0"
)
args = parser.parse_args()
# Show welcome
console.print(Panel.fit(
"[bold blue]Local Swarm[/bold blue] - AI-powered coding LLM swarm\n"
"Automatically configures optimal LLM setup for your hardware",
title="Welcome",
border_style="blue"
))
if args.detect:
console.print("[yellow]Hardware detection mode - not yet implemented[/yellow]")
console.print("Run without --detect to start the swarm (once implemented)")
return
console.print("[green]Starting Local Swarm...[/green]")
console.print("[dim]Note: This is a placeholder. Implementation in progress.[/dim]")
console.print()
console.print("[bold]Next steps:[/bold]")
console.print("1. Check PLAN.md for implementation details")
console.print("2. Start implementing src/hardware/detector.py")
console.print("3. Continue with other modules")
if __name__ == "__main__":
main()