Skip to content

Commit 5c51082

Browse files
committed
Chore: Remove commercial documentation from public repository
1 parent 3890105 commit 5c51082

3 files changed

Lines changed: 76 additions & 30 deletions

File tree

COMMERCIAL.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/core/reporting.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from src.schemas.performance import SlippageAnalysis, TruthGapAnalysis
2+
from src.schemas.agents import UserHistory
3+
from datetime import datetime
4+
5+
6+
class AuditReportGenerator:
7+
"""
8+
The 'Cash Generator': Turns raw database data and agent analysis into a
9+
professional PDF/JSON report that can be sold as a service.
10+
"""
11+
12+
@staticmethod
13+
def generate_audit_summary(
14+
user: UserHistory,
15+
slippage: SlippageAnalysis,
16+
truth_gap: TruthGapAnalysis
17+
) -> dict:
18+
"""
19+
Creates a high-value 'Performance Integrity Audit' for a manager.
20+
"""
21+
return {
22+
"report_id": f"AUDIT-{datetime.now().strftime('%Y%m%d')}-{user.user_id}",
23+
"generated_at": datetime.now().isoformat(),
24+
"subject": {
25+
"user_id": user.user_id,
26+
"reliability_score": f"{user.reliability_score:.2f}%",
27+
"total_commitments": user.total_commitments
28+
},
29+
"performance_metrics": {
30+
"status": slippage.status,
31+
"fulfillment_ratio": f"{slippage.fulfillment_ratio * 100:.2f}%",
32+
"detected_gap": slippage.detected_gap
33+
},
34+
"integrity_score": {
35+
"aligned": not truth_gap.gap_detected,
36+
"truth_score": f"{truth_gap.truth_score * 100:.2f}%",
37+
"explanation": truth_gap.explanation
38+
},
39+
"intervention_recommendation": {
40+
"required": slippage.intervention_required or truth_gap.gap_detected,
41+
"tone": truth_gap.recommended_tone,
42+
"summary": "High risk of technical debt accumulation detected." if truth_gap.gap_detected else "Maintain current performance."
43+
}
44+
}

src/main.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,13 @@ async def ingest_git_commitment(commit_data: dict):
142142
from src.core.database import get_user_by_git_email
143143

144144
extractor = CommitmentExtractor()
145-
# Simplified Git payload handling for demo purposes
146145
author_email = commit_data.get("author_email")
147146
message = commit_data.get("message")
148147

149148
user = await get_user_by_git_email(author_email)
150149
user_id = user.user_id if user else "unknown_git_user"
151150

152151
extracted = await extractor.parse_conversation(message)
153-
154-
# In a full system, we would enqueue this for monitoring
155152
logger.info("git_commitment_extracted", user_id=user_id, task=extracted.what)
156153

157154
return {
@@ -160,3 +157,35 @@ async def ingest_git_commitment(commit_data: dict):
160157
"task": extracted.what,
161158
"identity_matched": user_id != "unknown_git_user"
162159
}
160+
161+
@app.get("/reports/audit/{user_id}")
162+
async def get_performance_audit(user_id: str):
163+
"""
164+
CASH-GENERATION ENDPOINT: Generates a professional Performance Integrity Audit.
165+
This is the deliverable you sell to Engineering Managers.
166+
"""
167+
from src.core.database import get_user_reliability
168+
from src.agents.performance import SlippageAnalyst, TruthGapDetector
169+
from src.core.reporting import AuditReportGenerator
170+
171+
# 1. Gather Data
172+
score, slack_id = await get_user_reliability(user_id)
173+
# Mocking historical evidence for the audit report demo
174+
promised = ["Refactor API", "Fix CSS", "Update Docs"]
175+
reality = "Only updated some typos in README. No major code changes detected."
176+
177+
# 2. Run Agents
178+
analyst = SlippageAnalyst()
179+
detector = TruthGapDetector()
180+
181+
slippage = await analyst.analyze_performance_gap(promised, reality)
182+
gap = await detector.detect_gap("I am 90% done with the refactor", reality)
183+
184+
# 3. Compile Report
185+
from src.schemas.agents import UserHistory
186+
user_mock = UserHistory(user_id=user_id, reliability_score=score, total_commitments=10)
187+
188+
report = AuditReportGenerator.generate_audit_summary(user_mock, slippage, gap)
189+
190+
return report
191+

0 commit comments

Comments
 (0)