@@ -63,6 +63,7 @@ class ManageDocumentationCrewResult:
6363 confidence : float = 0.0
6464 cost : float = 0.0
6565 duration_ms : int = 0
66+ formatted_report : str = ""
6667
6768 def to_dict (self ) -> dict :
6869 return {
@@ -75,6 +76,7 @@ def to_dict(self) -> dict:
7576 "confidence" : self .confidence ,
7677 "cost" : self .cost ,
7778 "duration_ms" : self .duration_ms ,
79+ "formatted_report" : self .formatted_report ,
7880 }
7981
8082
@@ -117,6 +119,100 @@ def get_user_prompt(self, context: dict) -> str:
117119Expected output format: { self .expected_output } """
118120
119121
122+ def format_manage_docs_report (result : ManageDocumentationCrewResult , path : str ) -> str :
123+ """Format documentation management output as a human-readable report.
124+
125+ Args:
126+ result: The ManageDocumentationCrewResult
127+ path: The path that was analyzed
128+
129+ Returns:
130+ Formatted report string
131+ """
132+ lines = []
133+
134+ # Header with confidence
135+ confidence = result .confidence
136+ if confidence >= 0.8 :
137+ confidence_icon = "🟢"
138+ confidence_text = "HIGH CONFIDENCE"
139+ elif confidence >= 0.5 :
140+ confidence_icon = "🟡"
141+ confidence_text = "MODERATE CONFIDENCE"
142+ else :
143+ confidence_icon = "🔴"
144+ confidence_text = "LOW CONFIDENCE (Mock Mode)"
145+
146+ lines .append ("=" * 60 )
147+ lines .append ("DOCUMENTATION SYNC REPORT" )
148+ lines .append ("=" * 60 )
149+ lines .append ("" )
150+ lines .append (f"Path Analyzed: { path } " )
151+ lines .append (f"Confidence: { confidence_icon } { confidence_text } ({ confidence :.0%} )" )
152+ lines .append ("" )
153+
154+ # Summary
155+ lines .append ("-" * 60 )
156+ lines .append ("SUMMARY" )
157+ lines .append ("-" * 60 )
158+ lines .append (f"Files Analyzed: { result .files_analyzed } " )
159+ lines .append (f"Docs Needing Update: { result .docs_needing_update } " )
160+ lines .append (f"New Docs Needed: { result .new_docs_needed } " )
161+ lines .append (f"Duration: { result .duration_ms } ms ({ result .duration_ms / 1000 :.1f} s)" )
162+ lines .append (f"Cost: ${ result .cost :.4f} " )
163+ lines .append ("" )
164+
165+ # Agent Findings
166+ if result .findings :
167+ lines .append ("-" * 60 )
168+ lines .append ("AGENT FINDINGS" )
169+ lines .append ("-" * 60 )
170+ for i , finding in enumerate (result .findings , 1 ):
171+ agent = finding .get ("agent" , f"Agent { i } " )
172+ response = finding .get ("response" , "" )
173+ cost = finding .get ("cost" , 0.0 )
174+
175+ lines .append (f"\n { i } . { agent } (Cost: ${ cost :.4f} )" )
176+ lines .append (" " + "-" * 54 )
177+
178+ # Show truncated response
179+ if len (response ) > 500 :
180+ lines .append (f" { response [:500 ]} ..." )
181+ lines .append (f" [Truncated - { len (response )} chars total]" )
182+ else :
183+ lines .append (f" { response } " )
184+ lines .append ("" )
185+
186+ # Recommendations
187+ if result .recommendations :
188+ lines .append ("-" * 60 )
189+ lines .append ("RECOMMENDATIONS" )
190+ lines .append ("-" * 60 )
191+ for i , rec in enumerate (result .recommendations , 1 ):
192+ lines .append (f"{ i } . { rec } " )
193+ lines .append ("" )
194+
195+ # Next Steps
196+ lines .append ("-" * 60 )
197+ lines .append ("NEXT STEPS" )
198+ lines .append ("-" * 60 )
199+ lines .append ("1. Review agent findings above for specific files" )
200+ lines .append ("2. Prioritize documentation updates based on impact" )
201+ lines .append ("3. Use 'Generate Docs' workflow for auto-generation" )
202+ lines .append ("4. Run this workflow periodically to keep docs in sync" )
203+ lines .append ("" )
204+
205+ # Footer
206+ lines .append ("=" * 60 )
207+ if result .success :
208+ lines .append ("✅ Documentation sync analysis complete" )
209+ else :
210+ lines .append ("❌ Documentation sync analysis failed" )
211+ lines .append ("=" * 60 )
212+
213+ return "\n " .join (lines )
214+
215+
120216class ManageDocumentationCrew :
121217 """Manage_Documentation - Documentation management crew.
122218
@@ -545,7 +641,8 @@ async def execute(
545641 if len (all_responses ) > 2 :
546642 recommendations .append ("See synthesizer output for prioritized action plan" )
547643
548- return ManageDocumentationCrewResult (
644+ # Create result
645+ result = ManageDocumentationCrewResult (
549646 success = True ,
550647 findings = all_findings ,
551648 recommendations = recommendations ,
@@ -557,6 +654,11 @@ async def execute(
557654 duration_ms = duration_ms ,
558655 )
559656
657+ # Generate formatted report
658+ result .formatted_report = format_manage_docs_report (result , path )
659+
660+ return result
661+
560662
561663# CLI entry point for testing
562664if __name__ == "__main__" :
@@ -574,22 +676,7 @@ async def main():
574676
575677 result = await crew .execute (path = path )
576678
577- print ("\n " + "=" * 60 )
578- print ("RESULTS" )
579- print ("=" * 60 )
580- print (f"Success: { result .success } " )
581- print (f"Files Analyzed: { result .files_analyzed } " )
582- print (f"Duration: { result .duration_ms } ms" )
583- print (f"Cost: ${ result .cost :.4f} " )
584- print (f"Confidence: { result .confidence :.0%} " )
585- print ()
586- print ("Recommendations:" )
587- for rec in result .recommendations :
588- print (f" - { rec } " )
589- print ()
590- print ("Agent Outputs:" )
591- for finding in result .findings :
592- print (f"\n [{ finding ['agent' ]} ]" )
593- print (finding ["response" ][:500 ])
679+ # Print formatted report
680+ print ("\n " + result .formatted_report )
594681
595682 asyncio .run (main ())
0 commit comments