File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from src .llm .factory import LLMFactory
2+ from src .schemas .performance import SlippageAnalysis , SlippageStatus
3+ from src .core .logging import logger
4+
5+
6+ class SlippageAnalyst :
7+ """
8+ The Specialized Intelligence Layer for GitOps Accountability.
9+ Analyzes 'Promise-vs-Reality' (Commit/PR) ratios.
10+ """
11+
12+ def __init__ (self , provider_name : str = None ):
13+ self .llm = LLMFactory .get_provider (provider_name )
14+
15+ async def analyze_performance_gap (
16+ self , promised_tasks : list [str ], actual_work_done : str
17+ ) -> SlippageAnalysis :
18+ """
19+ Calculates the slippage between what was committed in Git/Chat and what was delivered.
20+ """
21+ logger .info (
22+ "slippage_analysis_started" ,
23+ tasks_count = len (promised_tasks ),
24+ )
25+
26+ prompt = f"""
27+ Execute a high-stakes performance audit.
28+
29+ PROMISED TASKS:
30+ { promised_tasks }
31+
32+ ACTUAL WORK DONE (Evidence):
33+ { actual_work_done }
34+
35+ Analyze if the developer is 'slipping' or creating 'shadow debt' (promising refactors but only doing hotfixes).
36+ """
37+
38+ analysis : SlippageAnalysis = await self .llm .generate (
39+ prompt = prompt , response_model = SlippageAnalysis
40+ )
41+
42+ logger .info (
43+ "slippage_analysis_complete" ,
44+ status = analysis .status ,
45+ ratio = analysis .fulfillment_ratio ,
46+ )
47+
48+ return analysis
Original file line number Diff line number Diff line change 1+ from pydantic import BaseModel , Field
2+ from enum import Enum
3+
4+
5+ class SlippageStatus (str , Enum ):
6+ ON_TRACK = "on_track"
7+ SLIPPING = "slipping"
8+ BROKEN = "broken"
9+ SHADOW_DEBT = "shadow_debt"
10+
11+
12+ class SlippageAnalysis (BaseModel ):
13+ status : SlippageStatus
14+ fulfillment_ratio : float = Field (..., ge = 0 , le = 1 )
15+ detected_gap : str = Field (..., description = "Description of promised vs reality." )
16+ risk_to_system_stability : float = Field (..., ge = 0 , le = 1 )
17+ intervention_required : bool
18+
19+
20+ class GitCommitPromise (BaseModel ):
21+ commit_hash : str
22+ author_email : str
23+ message : str
24+ extracted_tasks : list [str ]
25+ deadline_hint : Optional [str ] = None
26+
27+
28+ class GitInbound (BaseModel ):
29+ repository : str
30+ branch : str
31+ commits : list [GitCommitPromise ]
You can’t perform that action at this time.
0 commit comments