Skip to content

Commit 14333c5

Browse files
GeneAIclaude
authored andcommitted
docs: Add v3.7.0 architecture docs and wizard factory CLI
Added comprehensive documentation for: - Wizard Factory completion and discovery - Workflow Factory completion and pattern analysis - CrewAI integration architecture - XML enhancement summary and migration status - Phase 1 completion status Added wizard factory CLI and coach wizard examples. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent 164e18b commit 14333c5

14 files changed

+6665
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Code Reviewer Wizard
2+
3+
**Domain:** software
4+
**Type:** Wizard
5+
**Generated:** Pattern-Compose Methodology
6+
7+
## Overview
8+
9+
Auto-generated wizard using proven patterns from the Empathy Framework.
10+
11+
## Patterns Used
12+
13+
- **Empathy Level**: 0-4 empathy level configuration
14+
- **User Guidance**: Help text, examples, and prompts
15+
- **Code Analysis Input**: Standard code analysis input (code, file_path, language)
16+
- **Risk Assessment**: Level 4 Anticipatory risk analysis
17+
- **Prediction**: Level 4 Anticipatory prediction of future issues
18+
- **Config Validation**: Validate wizard configuration on initialization
19+
20+
## Usage
21+
22+
```python
23+
from coach_wizards.code_reviewer_wizard import CodeReviewerWizard
24+
25+
wizard = CodeReviewerWizard()
26+
result = await wizard.process(user_input="...")
27+
```
28+
29+
## API Endpoints
30+
31+
```bash
32+
# Process with wizard
33+
POST /api/wizard/code_reviewer/process
34+
{
35+
"input": "your input here",
36+
"context": {}
37+
}
38+
```
39+
40+
## Testing
41+
42+
```bash
43+
# Run unit tests
44+
pytest tests/unit/wizards/test_code_reviewer_wizard.py
45+
46+
# Run with coverage
47+
pytest tests/unit/wizards/test_code_reviewer_wizard.py --cov
48+
```
49+
50+
## Next Steps
51+
52+
1. Customize wizard logic as needed
53+
2. Add domain-specific validation
54+
3. Extend with additional features
55+
4. Update tests for custom logic
56+
57+
---
58+
59+
**Generated by:** Empathy Framework - Wizard Factory
60+
**Methodology:** Pattern-Compose
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
"""Code reviewer Coach Wizard.
2+
3+
Auto-generated by Empathy Framework Scaffolding
4+
Methodology: pattern-compose
5+
Domain: software
6+
Patterns: empathy_level, user_guidance, code_analysis_input, risk_assessment, prediction, config_validation
7+
Generated: 2026-01-05T20:15:45.111917
8+
"""
9+
10+
import logging
11+
from typing import Any
12+
13+
from fastapi import APIRouter, HTTPException
14+
from pydantic import BaseModel, Field
15+
16+
from patterns import get_pattern_registry
17+
18+
logger = logging.getLogger(__name__)
19+
20+
router = APIRouter(prefix="/code_reviewer", tags=["code_reviewer"])
21+
22+
# Pattern registry for recommendations
23+
registry = get_pattern_registry()
24+
25+
26+
# Request/Response Models
27+
class AnalysisRequest(BaseModel):
28+
"""Request to analyze code."""
29+
30+
code: str = Field(..., description="Code to analyze")
31+
context: dict[str, Any] = Field(default_factory=dict, description="Additional context")
32+
include_risk_assessment: bool = Field(default=True, description="Include risk analysis")
33+
34+
35+
class AnalysisResult(BaseModel):
36+
"""Analysis result."""
37+
38+
wizard_id: str
39+
analysis: dict[str, Any]
40+
risk_assessment: dict[str, Any] | None = None
41+
predictions: list[dict[str, Any]] = Field(default_factory=list)
42+
43+
44+
# In-memory session storage (replace with Redis in production)
45+
sessions: dict[str, dict[str, Any]] = {}
46+
47+
48+
@router.post("/analyze", response_model=AnalysisResult)
49+
async def analyze_code(request: AnalysisRequest) -> AnalysisResult:
50+
"""Analyze code and provide recommendations.
51+
52+
Args:
53+
request: Analysis request with code and context
54+
55+
Returns:
56+
Analysis results with recommendations
57+
58+
Raises:
59+
HTTPException: If analysis fails
60+
"""
61+
try:
62+
# Create session
63+
wizard_id = f"code_reviewer_{len(sessions) + 1}"
64+
65+
# Perform code analysis
66+
analysis = await _analyze_code(request.code, request.context)
67+
68+
result = AnalysisResult(
69+
wizard_id=wizard_id,
70+
analysis=analysis,
71+
)
72+
73+
# Perform risk assessment
74+
if request.include_risk_assessment:
75+
risk_assessment = await _assess_risk(analysis)
76+
result.risk_assessment = risk_assessment
77+
78+
# Generate predictions
79+
predictions = await _generate_predictions(analysis)
80+
result.predictions = predictions
81+
82+
# Store session
83+
sessions[wizard_id] = {
84+
"wizard_id": wizard_id,
85+
"code": request.code,
86+
"analysis": analysis,
87+
"result": result.model_dump(),
88+
}
89+
90+
logger.info(f"Analysis complete for {wizard_id}")
91+
return result
92+
93+
except Exception as e:
94+
logger.exception(f"Analysis failed: {e}")
95+
raise HTTPException(status_code=500, detail=f"Analysis failed: {str(e)}")
96+
97+
98+
@router.get("/{wizard_id}/report", response_model=dict[str, Any])
99+
async def get_report(wizard_id: str) -> dict[str, Any]:
100+
"""Get analysis report.
101+
102+
Args:
103+
wizard_id: Wizard session ID
104+
105+
Returns:
106+
Complete analysis report
107+
108+
Raises:
109+
HTTPException: If session not found
110+
"""
111+
if wizard_id not in sessions:
112+
raise HTTPException(status_code=404, detail="Session not found")
113+
114+
session = sessions[wizard_id]
115+
return {
116+
"wizard_id": wizard_id,
117+
"analysis": session["analysis"],
118+
"result": session["result"],
119+
}
120+
121+
122+
# Helper functions
123+
async def _analyze_code(code: str, context: dict[str, Any]) -> dict[str, Any]:
124+
"""Analyze code (placeholder - implement actual analysis).
125+
126+
Args:
127+
code: Code to analyze
128+
context: Additional context
129+
130+
Returns:
131+
Analysis results
132+
"""
133+
# TODO: Implement actual code analysis
134+
return {
135+
"lines_of_code": len(code.split("\n")),
136+
"complexity": "medium",
137+
"issues_found": 0,
138+
"context": context,
139+
}
140+
141+
142+
async def _assess_risk(analysis: dict[str, Any]) -> dict[str, Any]:
143+
"""Assess risk based on analysis.
144+
145+
Args:
146+
analysis: Code analysis results
147+
148+
Returns:
149+
Risk assessment
150+
"""
151+
# TODO: Implement actual risk assessment
152+
return {
153+
"alert_level": "LOW",
154+
"risk_score": 0.2,
155+
"by_risk_level": {
156+
"critical": 0,
157+
"high": 0,
158+
"medium": 0,
159+
"low": 0,
160+
},
161+
}
162+
163+
164+
async def _generate_predictions(analysis: dict[str, Any]) -> list[dict[str, Any]]:
165+
"""Generate predictions about future issues.
166+
167+
Args:
168+
analysis: Code analysis results
169+
170+
Returns:
171+
List of predictions
172+
"""
173+
# TODO: Implement actual predictions
174+
return [
175+
{
176+
"type": "performance",
177+
"confidence": 0.8,
178+
"description": "May experience performance issues with large datasets",
179+
}
180+
]

0 commit comments

Comments
 (0)