Ryan Malloy bec1606c86 Add comprehensive documentation system and tool call tracking
## Documentation System
- Create complete documentation hub at /dashboard/docs with:
  - Getting Started guide with quick setup and troubleshooting
  - Hook Setup Guide with platform-specific configurations
  - API Reference with all endpoints and examples
  - FAQ with searchable questions and categories
- Add responsive design with interactive features
- Update navigation in base template

## Tool Call Tracking
- Add ToolCall model for tracking Claude Code tool usage
- Create /api/tool-calls endpoints for recording and analytics
- Add tool_call hook type with auto-session detection
- Include tool calls in project statistics and recalculation
- Track tool names, parameters, execution time, and success rates

## Project Enhancements
- Add project timeline and statistics pages (fix 404 errors)
- Create recalculation script for fixing zero statistics
- Update project stats to include tool call counts
- Enhance session model with tool call relationships

## Infrastructure
- Switch from requirements.txt to pyproject.toml/uv.lock
- Add data import functionality for claude.json files
- Update database connection to include all new models
- Add comprehensive API documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 05:58:27 -06:00

33 lines
1.3 KiB
Python

"""
Tool call tracking model for Claude Code sessions.
"""
from datetime import datetime
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey, Boolean
from sqlalchemy.orm import relationship
from app.models.base import Base
class ToolCall(Base):
"""
Tracks individual tool calls made during Claude Code sessions.
This helps analyze which tools are used most frequently and their success rates.
"""
__tablename__ = "tool_calls"
id = Column(Integer, primary_key=True, index=True)
session_id = Column(String, ForeignKey("sessions.id"), nullable=False, index=True)
tool_name = Column(String(100), nullable=False, index=True)
parameters = Column(Text, nullable=True) # JSON string of tool parameters
result_status = Column(String(20), nullable=True, index=True) # success, error, timeout
error_message = Column(Text, nullable=True)
execution_time_ms = Column(Integer, nullable=True) # Tool execution time in milliseconds
timestamp = Column(DateTime, nullable=False, default=datetime.utcnow, index=True)
# Relationships
session = relationship("Session", back_populates="tool_calls")
def __repr__(self):
return f"<ToolCall(id={self.id}, tool={self.tool_name}, session={self.session_id})>"