Completely removed the database context recall system while preserving database tables for safety. This major cleanup removes 80+ files and 16,831 lines of code. What was removed: - API layer: 4 routers (conversation-contexts, context-snippets, project-states, decision-logs) with 35+ endpoints - Database models: 5 models (ConversationContext, ContextSnippet, DecisionLog, ProjectState, ContextTag) - Services: 4 service layers with business logic - Schemas: 4 Pydantic schema files - Claude Code hooks: 13 hook files (user-prompt-submit, task-complete, sync-contexts, periodic saves) - Scripts: 15+ scripts (import, migration, testing, tombstone checking) - Tests: 5 test files (context recall, compression, diagnostics) - Documentation: 30+ markdown files (guides, architecture, quick starts) - Utilities: context compression, conversation parsing Files modified: - api/main.py: Removed router registrations - api/models/__init__.py: Removed model imports - api/schemas/__init__.py: Removed schema imports - api/services/__init__.py: Removed service imports - .claude/claude.md: Completely rewritten without context references Database tables preserved: - conversation_contexts, context_snippets, context_tags, project_states, decision_logs (5 orphaned tables remain for safety) - Migration created but NOT applied: 20260118_172743_remove_context_system.py - Tables can be dropped later when confirmed not needed New files added: - CONTEXT_SYSTEM_REMOVAL_SUMMARY.md: Detailed removal report - CONTEXT_SYSTEM_REMOVAL_COMPLETE.md: Final status - CONTEXT_EXPORT_RESULTS.md: Export attempt results - scripts/export-tombstoned-contexts.py: Export tool for future use - migrations/versions/20260118_172743_remove_context_system.py Impact: - Reduced from 130 to 95 API endpoints - Reduced from 43 to 38 active database tables - Removed 16,831 lines of code - System fully operational without context recall Reason for removal: - System was not actively used (no tombstoned contexts found) - Reduces codebase complexity - Focuses on core MSP work tracking functionality - Database preserved for safety (can rollback if needed) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
136 lines
3.9 KiB
Python
136 lines
3.9 KiB
Python
"""
|
|
ClaudeTools FastAPI Application
|
|
Main entry point for the ClaudeTools MSP management system API
|
|
"""
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from contextlib import asynccontextmanager
|
|
|
|
from api.config import get_settings
|
|
|
|
settings = get_settings()
|
|
from api.database import engine
|
|
|
|
# Import routers
|
|
from api.routers import (
|
|
machines,
|
|
clients,
|
|
sites,
|
|
networks,
|
|
tags,
|
|
sessions,
|
|
projects,
|
|
tasks,
|
|
billable_time,
|
|
work_items,
|
|
services,
|
|
infrastructure,
|
|
firewall_rules,
|
|
m365_tenants,
|
|
credentials,
|
|
credential_audit_logs,
|
|
security_incidents,
|
|
bulk_import,
|
|
version,
|
|
)
|
|
|
|
# Import middleware
|
|
from api.middleware.error_handler import register_exception_handlers
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
"""
|
|
Lifespan event handler for startup and shutdown operations
|
|
"""
|
|
# Startup
|
|
print("Starting ClaudeTools API...")
|
|
print(f"Database: {settings.DATABASE_NAME}")
|
|
print(f"JWT Auth: {'Enabled' if settings.JWT_SECRET_KEY else 'Disabled'}")
|
|
|
|
yield
|
|
|
|
# Shutdown
|
|
print("Shutting down ClaudeTools API...")
|
|
engine.dispose()
|
|
|
|
|
|
# Initialize FastAPI application
|
|
app = FastAPI(
|
|
title="ClaudeTools API",
|
|
description="MSP Work Tracking and Infrastructure Management System",
|
|
version="1.0.0",
|
|
docs_url="/api/docs",
|
|
redoc_url="/api/redoc",
|
|
openapi_url="/api/openapi.json",
|
|
lifespan=lifespan
|
|
)
|
|
|
|
# Configure CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.ALLOWED_ORIGINS.split(",") if settings.ALLOWED_ORIGINS else ["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Register exception handlers
|
|
register_exception_handlers(app)
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
"""Root endpoint - API status check"""
|
|
return {
|
|
"status": "online",
|
|
"service": "ClaudeTools API",
|
|
"version": "1.0.0",
|
|
"docs": "/api/docs"
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
async def health_check():
|
|
"""Health check endpoint for monitoring"""
|
|
return {
|
|
"status": "healthy",
|
|
"database": "connected"
|
|
}
|
|
|
|
|
|
# Register routers
|
|
# System endpoints
|
|
app.include_router(version.router, prefix="/api", tags=["System"])
|
|
|
|
# Entity endpoints
|
|
app.include_router(machines.router, prefix="/api/machines", tags=["Machines"])
|
|
app.include_router(clients.router, prefix="/api/clients", tags=["Clients"])
|
|
app.include_router(sites.router, prefix="/api/sites", tags=["Sites"])
|
|
app.include_router(networks.router, prefix="/api/networks", tags=["Networks"])
|
|
app.include_router(tags.router, prefix="/api/tags", tags=["Tags"])
|
|
app.include_router(sessions.router, prefix="/api/sessions", tags=["Sessions"])
|
|
app.include_router(projects.router, prefix="/api/projects", tags=["Projects"])
|
|
app.include_router(tasks.router, prefix="/api/tasks", tags=["Tasks"])
|
|
app.include_router(billable_time.router, prefix="/api/billable-time", tags=["Billable Time"])
|
|
app.include_router(work_items.router, prefix="/api/work-items", tags=["Work Items"])
|
|
app.include_router(services.router, prefix="/api/services", tags=["Services"])
|
|
app.include_router(infrastructure.router, prefix="/api/infrastructure", tags=["Infrastructure"])
|
|
app.include_router(m365_tenants.router, prefix="/api/m365-tenants", tags=["M365 Tenants"])
|
|
app.include_router(firewall_rules.router, prefix="/api/firewall-rules", tags=["Firewall Rules"])
|
|
app.include_router(credentials.router, prefix="/api/credentials", tags=["Credentials"])
|
|
app.include_router(credential_audit_logs.router, prefix="/api/credential-audit-logs", tags=["Credential Audit Logs"])
|
|
app.include_router(security_incidents.router, prefix="/api/security-incidents", tags=["Security Incidents"])
|
|
app.include_router(bulk_import.router, prefix="/api/bulk-import", tags=["Bulk Import"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
uvicorn.run(
|
|
"api.main:app",
|
|
host="0.0.0.0",
|
|
port=8000,
|
|
reload=True
|
|
)
|