import datetime import hashlib import json from typing import Dict, List, Optional import regex as re import structlog from pydantic import BaseModel from codegate.config import Config from codegate.db.models import Alert, AlertSeverity from codegate.pipeline.base import PipelineContext logger = structlog.get_logger("codegate") class CachedFim(BaseModel): timestamp: datetime.datetime critical_alerts: List[Alert] initial_id: str # Regular expression to match file paths in FIM messages. # Compiled regex to improve performance. filepath_matcher = re.compile(r"^(#|//|