Add CLI, Docker setup, and quick start guide

- CLI tool for testing (cli.py)
- Docker Compose for easy deployment
- Dockerfile for backend
- QUICKSTART.md with setup instructions

Ready to deploy! Run: python cli.py or docker-compose up
This commit is contained in:
JA
2026-02-12 21:17:39 +00:00
parent d9a7c016b1
commit c9893335db
4 changed files with 339 additions and 0 deletions

84
cli.py Executable file
View File

@@ -0,0 +1,84 @@
#!/usr/bin/env python3
"""
Grimlock CLI - Simple command line interface for testing
"""
import asyncio
import os
import sys
from pathlib import Path
# Add backend to path
sys.path.insert(0, str(Path(__file__).parent / "backend"))
from core.ai_client import AIClient
from core.context_manager import ContextManager
from dotenv import load_dotenv
load_dotenv("backend/.env")
async def main():
print("=" * 60)
print("GRIMLOCK CLI")
print("=" * 60)
# Initialize
api_key = os.getenv("ANTHROPIC_API_KEY")
if not api_key:
print("ERROR: ANTHROPIC_API_KEY not set")
print("Copy backend/.env.example to backend/.env and add your API key")
return
print("\nInitializing...")
context_manager = ContextManager("backend/context")
context_manager.load_all_context()
print(f"Context loaded: {context_manager.get_summary()}")
ai_client = AIClient(api_key=api_key)
print("AI client ready")
# Interactive loop
print("\nGrimlock is online. Type 'exit' to quit.\n")
messages = []
while True:
try:
user_input = input("You: ").strip()
if not user_input:
continue
if user_input.lower() in ['exit', 'quit', 'q']:
print("\nGoodbye!")
break
# Add user message
messages.append({"role": "user", "content": user_input})
# Get context
context = context_manager.get_context_for_query(user_input)
system_prompt = context_manager.get_system_prompt()
if context:
system_prompt += f"\n\n# Company Context\n{context}"
# Get response
print("\nGrimlock: ", end="", flush=True)
response = await ai_client.chat(
messages=messages,
system_prompt=system_prompt
)
print(response)
print()
# Add assistant message
messages.append({"role": "assistant", "content": response})
except KeyboardInterrupt:
print("\n\nGoodbye!")
break
except Exception as e:
print(f"\nError: {e}\n")
if __name__ == "__main__":
asyncio.run(main())