mdan-cli 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,358 @@
1
+ """Test Agent (Youssef) - VERIFY Phase
2
+
3
+ Responsible for testing strategy, test execution, and quality assurance.
4
+ """
5
+
6
+ from crewai import Agent, Task
7
+ from typing import List, Optional
8
+ from ..tools.sql_tool import SQLTool
9
+ from ..tools.serper_tool import SerperTool
10
+ from ..tools.file_tool import FileTool
11
+
12
+
13
+ class TestAgent:
14
+ """Test Agent for VERIFY phase - Testing strategy and execution."""
15
+
16
+ def __init__(
17
+ self,
18
+ sql_tool: Optional[SQLTool] = None,
19
+ serper_tool: Optional[SerperTool] = None,
20
+ file_tool: Optional[FileTool] = None,
21
+ llm=None,
22
+ ):
23
+ """Initialize Test Agent.
24
+
25
+ Args:
26
+ sql_tool: SQL connector tool
27
+ serper_tool: Web search tool
28
+ file_tool: File operations tool
29
+ llm: Language model instance
30
+ """
31
+ self.sql_tool = sql_tool
32
+ self.serper_tool = serper_tool
33
+ self.file_tool = file_tool
34
+ self.llm = llm
35
+
36
+ tools = []
37
+ if sql_tool:
38
+ tools.append(sql_tool)
39
+ if serper_tool:
40
+ tools.append(serper_tool)
41
+ if file_tool:
42
+ tools.append(file_tool)
43
+
44
+ self.agent = Agent(
45
+ role="Test Engineer & QA Specialist",
46
+ goal="Ensure software quality through comprehensive testing strategies and execution",
47
+ backstory="""You are Youssef, an expert Test Engineer with deep knowledge of testing methodologies,
48
+ test automation, and quality assurance. You excel at designing test strategies, writing test cases,
49
+ and ensuring software meets quality standards. You are thorough, detail-oriented, and focused on
50
+ preventing bugs before they reach production.""",
51
+ verbose=True,
52
+ allow_delegation=False,
53
+ tools=tools,
54
+ llm=llm,
55
+ )
56
+
57
+ def create_test_strategy_task(self, project_context: str) -> Task:
58
+ """Create task for developing test strategy.
59
+
60
+ Args:
61
+ project_context: Project requirements and context
62
+
63
+ Returns:
64
+ Task for test strategy development
65
+ """
66
+ return Task(
67
+ description=f"""Develop a comprehensive test strategy for the project.
68
+
69
+ Project Context:
70
+ {project_context}
71
+
72
+ Your task:
73
+ 1. Analyze project requirements and identify testing needs
74
+ 2. Define test scope and objectives
75
+ 3. Identify test types needed (unit, integration, E2E, performance, security)
76
+ 4. Define test coverage targets (aim for 80%+)
77
+ 5. Identify test data requirements
78
+ 6. Define test environment setup
79
+ 7. Create test schedule and milestones
80
+ 8. Identify testing tools and frameworks needed
81
+
82
+ Output: Complete test strategy document with all sections defined.
83
+ """,
84
+ agent=self.agent,
85
+ expected_output="Comprehensive test strategy document covering scope, types, coverage, tools, and schedule",
86
+ )
87
+
88
+ def create_unit_tests_task(self, codebase_context: str) -> Task:
89
+ """Create task for writing unit tests.
90
+
91
+ Args:
92
+ codebase_context: Codebase structure and implementation details
93
+
94
+ Returns:
95
+ Task for unit test development
96
+ """
97
+ return Task(
98
+ description=f"""Write comprehensive unit tests for the codebase.
99
+
100
+ Codebase Context:
101
+ {codebase_context}
102
+
103
+ Your task:
104
+ 1. Analyze codebase structure and identify components to test
105
+ 2. Write unit tests for all business logic functions
106
+ 3. Ensure tests follow Arrange-Act-Assert pattern
107
+ 4. Use descriptive test names (test_function_scenario_expected_result)
108
+ 5. Test edge cases and error conditions
109
+ 6. Mock external dependencies appropriately
110
+ 7. Achieve 80%+ code coverage
111
+ 8. Use appropriate testing framework (pytest, unittest, etc.)
112
+
113
+ Output: Complete unit test suite with high coverage.
114
+ """,
115
+ agent=self.agent,
116
+ expected_output="Comprehensive unit test suite with 80%+ code coverage",
117
+ )
118
+
119
+ def create_integration_tests_task(self, api_context: str) -> Task:
120
+ """Create task for writing integration tests.
121
+
122
+ Args:
123
+ api_context: API endpoints and integration points
124
+
125
+ Returns:
126
+ Task for integration test development
127
+ """
128
+ return Task(
129
+ description=f"""Write integration tests for API and database interactions.
130
+
131
+ API Context:
132
+ {api_context}
133
+
134
+ Your task:
135
+ 1. Identify all API endpoints to test
136
+ 2. Write tests for database operations
137
+ 3. Test external service integrations
138
+ 4. Test authentication and authorization
139
+ 5. Test error handling and edge cases
140
+ 6. Use test databases/fixtures
141
+ 7. Test data validation
142
+ 8. Ensure tests are independent and repeatable
143
+
144
+ Output: Complete integration test suite covering all critical paths.
145
+ """,
146
+ agent=self.agent,
147
+ expected_output="Integration test suite covering all API endpoints and database operations",
148
+ )
149
+
150
+ def create_e2e_tests_task(self, user_flows: str) -> Task:
151
+ """Create task for writing E2E tests.
152
+
153
+ Args:
154
+ user_flows: User journey and flow descriptions
155
+
156
+ Returns:
157
+ Task for E2E test development
158
+ """
159
+ return Task(
160
+ description=f"""Write end-to-end tests for critical user flows.
161
+
162
+ User Flows:
163
+ {user_flows}
164
+
165
+ Your task:
166
+ 1. Identify critical user journeys
167
+ 2. Write E2E tests for each flow
168
+ 3. Test complete user workflows from start to finish
169
+ 4. Include happy path and error scenarios
170
+ 5. Test cross-browser compatibility if applicable
171
+ 6. Use appropriate E2E testing framework (Playwright, Cypress, Selenium)
172
+ 7. Ensure tests are maintainable and reliable
173
+ 8. Document test scenarios
174
+
175
+ Output: E2E test suite covering all critical user flows.
176
+ """,
177
+ agent=self.agent,
178
+ expected_output="E2E test suite covering all critical user journeys",
179
+ )
180
+
181
+ def create_test_execution_task(self, test_suite: str) -> Task:
182
+ """Create task for executing tests and reporting results.
183
+
184
+ Args:
185
+ test_suite: Test suite to execute
186
+
187
+ Returns:
188
+ Task for test execution
189
+ """
190
+ return Task(
191
+ description=f"""Execute the test suite and generate comprehensive test report.
192
+
193
+ Test Suite:
194
+ {test_suite}
195
+
196
+ Your task:
197
+ 1. Execute all tests in the suite
198
+ 2. Collect test results and metrics
199
+ 3. Calculate code coverage
200
+ 4. Identify failing tests and root causes
201
+ 5. Generate test report with:
202
+ - Test summary (total, passed, failed, skipped)
203
+ - Coverage metrics
204
+ - Performance metrics
205
+ - Failed test details with stack traces
206
+ - Recommendations for fixes
207
+ 6. Identify quality trends and patterns
208
+ 7. Document any blockers or issues
209
+
210
+ Output: Comprehensive test report with all metrics and recommendations.
211
+ """,
212
+ agent=self.agent,
213
+ expected_output="Detailed test report with coverage metrics, failure analysis, and recommendations",
214
+ )
215
+
216
+ def create_performance_tests_task(self, performance_requirements: str) -> Task:
217
+ """Create task for performance testing.
218
+
219
+ Args:
220
+ performance_requirements: Performance criteria and requirements
221
+
222
+ Returns:
223
+ Task for performance test development
224
+ """
225
+ return Task(
226
+ description=f"""Design and execute performance tests.
227
+
228
+ Performance Requirements:
229
+ {performance_requirements}
230
+
231
+ Your task:
232
+ 1. Identify performance-critical components
233
+ 2. Define performance metrics (response time, throughput, latency)
234
+ 3. Create load tests for expected traffic
235
+ 4. Create stress tests for peak conditions
236
+ 5. Test database query performance
237
+ 6. Identify performance bottlenecks
238
+ 7. Generate performance report with:
239
+ - Baseline metrics
240
+ - Test results
241
+ - Bottleneck analysis
242
+ - Optimization recommendations
243
+ 8. Set up performance monitoring
244
+
245
+ Output: Performance test suite and report with optimization recommendations.
246
+ """,
247
+ agent=self.agent,
248
+ expected_output="Performance test suite and report with bottleneck analysis",
249
+ )
250
+
251
+ def create_security_tests_task(self, security_context: str) -> Task:
252
+ """Create task for security testing.
253
+
254
+ Args:
255
+ security_context: Security requirements and context
256
+
257
+ Returns:
258
+ Task for security test development
259
+ """
260
+ return Task(
261
+ description=f"""Design and execute security tests.
262
+
263
+ Security Context:
264
+ {security_context}
265
+
266
+ Your task:
267
+ 1. Identify security vulnerabilities to test for
268
+ 2. Test for common vulnerabilities (OWASP Top 10)
269
+ 3. Test authentication and authorization
270
+ 4. Test input validation and sanitization
271
+ 5. Test for SQL injection, XSS, CSRF
272
+ 6. Test API security (rate limiting, authentication)
273
+ 7. Test data encryption and secure storage
274
+ 8. Generate security report with:
275
+ - Vulnerability findings
276
+ - Risk assessment
277
+ - Remediation recommendations
278
+ 9. Verify security best practices
279
+
280
+ Output: Security test report with vulnerability findings and remediation plan.
281
+ """,
282
+ agent=self.agent,
283
+ expected_output="Security test report with vulnerability assessment and remediation plan",
284
+ )
285
+
286
+ def create_test_automation_task(self, automation_context: str) -> Task:
287
+ """Create task for test automation setup.
288
+
289
+ Args:
290
+ automation_context: Test automation requirements
291
+
292
+ Returns:
293
+ Task for test automation setup
294
+ """
295
+ return Task(
296
+ description=f"""Set up test automation infrastructure.
297
+
298
+ Automation Context:
299
+ {automation_context}
300
+
301
+ Your task:
302
+ 1. Select appropriate testing frameworks and tools
303
+ 2. Set up test automation pipeline
304
+ 3. Configure CI/CD integration for automated tests
305
+ 4. Create test data management strategy
306
+ 5. Set up test reporting and notifications
307
+ 6. Configure test environment provisioning
308
+ 7. Document automation setup and maintenance
309
+ 8. Create guidelines for writing automated tests
310
+
311
+ Output: Complete test automation setup with documentation.
312
+ """,
313
+ agent=self.agent,
314
+ expected_output="Test automation infrastructure setup with CI/CD integration",
315
+ )
316
+
317
+ def create_quality_gate_task(self, quality_criteria: str) -> Task:
318
+ """Create task for defining quality gates.
319
+
320
+ Args:
321
+ quality_criteria: Quality criteria and thresholds
322
+
323
+ Returns:
324
+ Task for quality gate definition
325
+ """
326
+ return Task(
327
+ description=f"""Define quality gates for the project.
328
+
329
+ Quality Criteria:
330
+ {quality_criteria}
331
+
332
+ Your task:
333
+ 1. Define quality gate criteria for each phase
334
+ 2. Set thresholds for:
335
+ - Code coverage (minimum 80%)
336
+ - Test pass rate (100% for critical paths)
337
+ - Performance metrics
338
+ - Security scan results
339
+ - Code quality metrics
340
+ 3. Define gate approval process
341
+ 4. Create gate check automation
342
+ 5. Document gate criteria and process
343
+ 6. Define exception handling for gate failures
344
+ 7. Set up gate monitoring and reporting
345
+
346
+ Output: Quality gate definitions with automated checks and documentation.
347
+ """,
348
+ agent=self.agent,
349
+ expected_output="Quality gate definitions with automated checks and approval process",
350
+ )
351
+
352
+ def get_agent(self) -> Agent:
353
+ """Get the CrewAI Agent instance.
354
+
355
+ Returns:
356
+ CrewAI Agent instance
357
+ """
358
+ return self.agent
@@ -0,0 +1,257 @@
1
+ """UX Agent (Jihane) - DESIGN Phase"""
2
+
3
+ from typing import List, Optional
4
+ from dataclasses import dataclass
5
+
6
+ try:
7
+ from crewai import Agent, Task
8
+
9
+ CREWAI_AVAILABLE = True
10
+ except ImportError:
11
+ CREWAI_AVAILABLE = False
12
+
13
+
14
+ @dataclass
15
+ class UXAgentConfig:
16
+ """Configuration for UX Agent"""
17
+
18
+ name: str = "Jihane"
19
+ role: str = "UX Agent"
20
+ goal: str = "Design user experience, create flows, and ensure accessibility"
21
+ backstory: str = (
22
+ "Jihane is a UX designer with 10+ years of experience creating intuitive, "
23
+ "accessible user interfaces. She specializes in user-centered design, "
24
+ "design systems, and accessibility standards."
25
+ )
26
+ verbose: bool = True
27
+ allow_delegation: bool = False
28
+
29
+
30
+ class UXAgent:
31
+ """UX Agent for DESIGN phase - User experience and interface design"""
32
+
33
+ def __init__(
34
+ self, config: Optional[UXAgentConfig] = None, tools: Optional[List] = None
35
+ ):
36
+ """
37
+ Initialize UX Agent
38
+
39
+ Args:
40
+ config: Agent configuration
41
+ tools: List of tools available to the agent
42
+ """
43
+ if not CREWAI_AVAILABLE:
44
+ raise ImportError(
45
+ "crewai is not installed. Install it with: pip install crewai"
46
+ )
47
+
48
+ self.config = config or UXAgentConfig()
49
+ self.tools = tools or []
50
+
51
+ self._agent = Agent(
52
+ role=self.config.role,
53
+ goal=self.config.goal,
54
+ backstory=self.config.backstory,
55
+ verbose=self.config.verbose,
56
+ allow_delegation=self.config.allow_delegation,
57
+ tools=self.tools,
58
+ )
59
+
60
+ @property
61
+ def agent(self) -> Agent:
62
+ """Get the underlying CrewAI Agent"""
63
+ return self._agent
64
+
65
+ def create_user_flows_task(
66
+ self, user_stories: List[str], personas: Optional[str] = None
67
+ ) -> Task:
68
+ """
69
+ Create a task for designing user flows
70
+
71
+ Args:
72
+ user_stories: List of user stories
73
+ personas: User personas
74
+
75
+ Returns:
76
+ CrewAI Task for user flow design
77
+ """
78
+ description = f"""
79
+ Design user flows for the following user stories:
80
+
81
+ User Stories:
82
+ {chr(10).join(f"- {us}" for us in user_stories)}
83
+
84
+ Personas:
85
+ {personas or "To be defined"}
86
+
87
+ For each flow, provide:
88
+ 1. Flow name and purpose
89
+ 2. Step-by-step user journey
90
+ 3. Decision points
91
+ 4. Error states
92
+ 5. Success states
93
+ 6. Alternative paths
94
+
95
+ Use flowchart notation or clear step descriptions.
96
+ """
97
+
98
+ return Task(
99
+ description=description,
100
+ agent=self._agent,
101
+ expected_output="Detailed user flows in markdown format",
102
+ )
103
+
104
+ def create_wireframes_task(self, user_flows: str, screens: List[str]) -> Task:
105
+ """
106
+ Create a task for designing wireframes
107
+
108
+ Args:
109
+ user_flows: User flow descriptions
110
+ screens: List of screens to design
111
+
112
+ Returns:
113
+ CrewAI Task for wireframe design
114
+ """
115
+ description = f"""
116
+ Create wireframe specifications for the following screens:
117
+
118
+ Screens:
119
+ {chr(10).join(f"- {screen}" for screen in screens)}
120
+
121
+ User Flows:
122
+ {user_flows}
123
+
124
+ For each screen, describe:
125
+ 1. Layout structure
126
+ 2. Key components and their placement
127
+ 3. Navigation elements
128
+ 4. Call-to-action buttons
129
+ 5. Input fields and forms
130
+ 6. Content hierarchy
131
+
132
+ Use ASCII art or detailed descriptions to represent the wireframes.
133
+ """
134
+
135
+ return Task(
136
+ description=description,
137
+ agent=self._agent,
138
+ expected_output="Wireframe specifications for all screens",
139
+ )
140
+
141
+ def create_design_system_task(self, brand_guidelines: Optional[str] = None) -> Task:
142
+ """
143
+ Create a task for creating a design system
144
+
145
+ Args:
146
+ brand_guidelines: Brand guidelines if available
147
+
148
+ Returns:
149
+ CrewAI Task for design system creation
150
+ """
151
+ description = f"""
152
+ Create a comprehensive design system:
153
+
154
+ Brand Guidelines:
155
+ {brand_guidelines or "To be defined"}
156
+
157
+ The design system should include:
158
+ 1. Color palette (primary, secondary, semantic colors)
159
+ 2. Typography (font families, sizes, weights, line heights)
160
+ 3. Spacing system (8px grid)
161
+ 4. Component library (buttons, inputs, cards, modals, etc.)
162
+ 5. Icon system
163
+ 6. Layout patterns
164
+ 7. Animation guidelines
165
+ 8. Accessibility standards (WCAG 2.1 AA)
166
+
167
+ Provide code examples (CSS/Tailwind) where applicable.
168
+ """
169
+
170
+ return Task(
171
+ description=description,
172
+ agent=self._agent,
173
+ expected_output="Comprehensive design system documentation",
174
+ )
175
+
176
+ def create_accessibility_task(self, ui_description: str) -> Task:
177
+ """
178
+ Create a task for accessibility review
179
+
180
+ Args:
181
+ ui_description: Description of the UI
182
+
183
+ Returns:
184
+ CrewAI Task for accessibility review
185
+ """
186
+ description = f"""
187
+ Perform an accessibility review of the following UI:
188
+
189
+ UI Description:
190
+ {ui_description}
191
+
192
+ Review against WCAG 2.1 AA standards:
193
+ 1. Perceivable
194
+ - Text alternatives
195
+ - Time-based media
196
+ - Adaptable
197
+ - Distinguishable
198
+ 2. Operable
199
+ - Keyboard accessible
200
+ - Enough time
201
+ - Seizures
202
+ - Navigable
203
+ 3. Understandable
204
+ - Readable
205
+ - Predictable
206
+ - Input assistance
207
+ 4. Robust
208
+ - Compatible
209
+
210
+ Provide:
211
+ - Accessibility audit findings
212
+ - Specific issues with recommendations
213
+ - Priority levels for fixes
214
+ - Testing recommendations
215
+ """
216
+
217
+ return Task(
218
+ description=description,
219
+ agent=self._agent,
220
+ expected_output="Accessibility audit report with recommendations",
221
+ )
222
+
223
+ def create_prototype_task(self, wireframes: str, interactions: List[str]) -> Task:
224
+ """
225
+ Create a task for designing interactive prototype
226
+
227
+ Args:
228
+ wireframes: Wireframe specifications
229
+ interactions: List of interactions to design
230
+
231
+ Returns:
232
+ CrewAI Task for prototype design
233
+ """
234
+ description = f"""
235
+ Design an interactive prototype based on the wireframes:
236
+
237
+ Wireframes:
238
+ {wireframes}
239
+
240
+ Interactions to design:
241
+ {chr(10).join(f"- {interaction}" for interaction in interactions)}
242
+
243
+ For each interaction, specify:
244
+ 1. Trigger event
245
+ 2. Animation/transition
246
+ 3. Feedback to user
247
+ 4. Duration and timing
248
+ 5. States (normal, hover, active, disabled, etc.)
249
+
250
+ Provide implementation guidance for the chosen framework.
251
+ """
252
+
253
+ return Task(
254
+ description=description,
255
+ agent=self._agent,
256
+ expected_output="Interactive prototype specifications",
257
+ )
@@ -0,0 +1,13 @@
1
+ """CrewAI Flows Package"""
2
+
3
+ from .auto_flow import AutoFlow
4
+ from .discovery_flow import DiscoveryFlow
5
+ from .build_flow import BuildFlow
6
+ from .debate_flow import DebateFlow
7
+
8
+ __all__ = [
9
+ "AutoFlow",
10
+ "DiscoveryFlow",
11
+ "BuildFlow",
12
+ "DebateFlow",
13
+ ]