feat: add Claude Code conversation tracker
- Create claude-code-tracker service to monitor and parse Claude Code conversations - Parse JSONL format with messages, tool calls, and metadata - Store in SQLite with full-text search support - Generate daily summaries using Claude API - Add Conversations UI with search, stats, and conversation browsing - Integrate with dashboard backend and frontend - Add sync script for Mac to NAS file transfer
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import os
|
||||
import logging
|
||||
import asyncio
|
||||
|
||||
import db
|
||||
import collector
|
||||
import summarizer
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def main():
|
||||
"""Main service loop"""
|
||||
logger.info("Starting Claude Code Tracker service")
|
||||
|
||||
# Initialize database
|
||||
await db.init_db()
|
||||
logger.info("Database initialized")
|
||||
|
||||
# Create data directory if it doesn't exist
|
||||
data_dir = os.path.dirname(db.DB_PATH)
|
||||
os.makedirs(data_dir, exist_ok=True)
|
||||
|
||||
# Start collection and summarization tasks
|
||||
tasks = [
|
||||
asyncio.create_task(collector.collect_conversations()),
|
||||
asyncio.create_task(summarizer.summarize_daily())
|
||||
]
|
||||
|
||||
logger.info("Service started - collection and summarization tasks running")
|
||||
|
||||
try:
|
||||
await asyncio.gather(*tasks)
|
||||
except KeyboardInterrupt:
|
||||
logger.info("Shutting down...")
|
||||
for task in tasks:
|
||||
task.cancel()
|
||||
await asyncio.gather(*tasks, return_exceptions=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user