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,388 @@
1
+ """Documentation Agent (Amina) - SHIP Phase
2
+
3
+ Responsible for documentation, user guides, and technical writing.
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 DocAgent:
14
+ """Documentation Agent for SHIP phase - Documentation and technical writing."""
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 Documentation 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="Technical Writer & Documentation Specialist",
46
+ goal="Create comprehensive, clear, and user-friendly documentation for the project",
47
+ backstory="""You are Amina, an expert Technical Writer with deep knowledge of technical documentation,
48
+ user guides, and developer documentation. You excel at explaining complex concepts clearly, creating
49
+ comprehensive guides, and ensuring documentation is accessible to all users. You are detail-oriented,
50
+ user-focused, and committed to documentation excellence.""",
51
+ verbose=True,
52
+ allow_delegation=False,
53
+ tools=tools,
54
+ llm=llm,
55
+ )
56
+
57
+ def create_readme_task(self, project_context: str) -> Task:
58
+ """Create task for writing README documentation.
59
+
60
+ Args:
61
+ project_context: Project overview and features
62
+
63
+ Returns:
64
+ Task for README documentation
65
+ """
66
+ return Task(
67
+ description=f"""Create comprehensive README documentation.
68
+
69
+ Project Context:
70
+ {project_context}
71
+
72
+ Your task:
73
+ 1. Write clear project description
74
+ 2. List key features and capabilities
75
+ 3. Provide installation instructions
76
+ 4. Include quick start guide
77
+ 5. Document configuration options
78
+ 6. Provide usage examples
79
+ 7. Include contribution guidelines
80
+ 8. Add license information
81
+ 9. Include badges (build status, coverage, version)
82
+ 10. Add links to additional documentation
83
+
84
+ Output: Comprehensive README.md file with all sections.
85
+ """,
86
+ agent=self.agent,
87
+ expected_output="Complete README.md with project overview, installation, usage, and contribution guidelines",
88
+ )
89
+
90
+ def create_api_documentation_task(self, api_context: str) -> Task:
91
+ """Create task for API documentation.
92
+
93
+ Args:
94
+ api_context: API endpoints and specifications
95
+
96
+ Returns:
97
+ Task for API documentation
98
+ """
99
+ return Task(
100
+ description=f"""Create comprehensive API documentation.
101
+
102
+ API Context:
103
+ {api_context}
104
+
105
+ Your task:
106
+ 1. Document all API endpoints
107
+ 2. Include request/response formats
108
+ 3. Document authentication and authorization
109
+ 4. Provide code examples for each endpoint
110
+ 5. Document error responses
111
+ 6. Include rate limiting information
112
+ 7. Document query parameters and headers
113
+ 8. Create API reference section
114
+ 9. Include interactive API examples if possible
115
+ 10. Document versioning and deprecation policy
116
+
117
+ Output: Complete API documentation with examples and reference.
118
+ """,
119
+ agent=self.agent,
120
+ expected_output="Comprehensive API documentation with endpoints, examples, and reference",
121
+ )
122
+
123
+ def create_user_guide_task(self, user_context: str) -> Task:
124
+ """Create task for user guide documentation.
125
+
126
+ Args:
127
+ user_context: User workflows and features
128
+
129
+ Returns:
130
+ Task for user guide
131
+ """
132
+ return Task(
133
+ description=f"""Create comprehensive user guide.
134
+
135
+ User Context:
136
+ {user_context}
137
+
138
+ Your task:
139
+ 1. Write introduction and overview
140
+ 2. Document key features and capabilities
141
+ 3. Create step-by-step tutorials
142
+ 4. Include screenshots and diagrams
143
+ 5. Document common use cases
144
+ 6. Provide troubleshooting guide
145
+ 7. Include FAQ section
146
+ 8. Document best practices
147
+ 9. Create getting started guide
148
+ 10. Include advanced usage examples
149
+
150
+ Output: Complete user guide with tutorials and examples.
151
+ """,
152
+ agent=self.agent,
153
+ expected_output="Comprehensive user guide with tutorials, examples, and troubleshooting",
154
+ )
155
+
156
+ def create_developer_guide_task(self, dev_context: str) -> Task:
157
+ """Create task for developer guide documentation.
158
+
159
+ Args:
160
+ dev_context: Development setup and architecture
161
+
162
+ Returns:
163
+ Task for developer guide
164
+ """
165
+ return Task(
166
+ description=f"""Create comprehensive developer guide.
167
+
168
+ Developer Context:
169
+ {dev_context}
170
+
171
+ Your task:
172
+ 1. Document development environment setup
173
+ 2. Explain project architecture
174
+ 3. Document code structure and organization
175
+ 4. Provide development workflow guide
176
+ 5. Document testing procedures
177
+ 6. Include code style guidelines
178
+ 7. Document contribution process
179
+ 8. Provide debugging guide
180
+ 9. Document deployment process
181
+ 10. Include architecture diagrams
182
+
183
+ Output: Complete developer guide with setup, architecture, and contribution guidelines.
184
+ """,
185
+ agent=self.agent,
186
+ expected_output="Comprehensive developer guide with setup, architecture, and contribution process",
187
+ )
188
+
189
+ def create_architecture_documentation_task(self, arch_context: str) -> Task:
190
+ """Create task for architecture documentation.
191
+
192
+ Args:
193
+ arch_context: System architecture and design decisions
194
+
195
+ Returns:
196
+ Task for architecture documentation
197
+ """
198
+ return Task(
199
+ description=f"""Create comprehensive architecture documentation.
200
+
201
+ Architecture Context:
202
+ {arch_context}
203
+
204
+ Your task:
205
+ 1. Document system architecture overview
206
+ 2. Explain architectural decisions (ADRs)
207
+ 3. Document components and their interactions
208
+ 4. Include architecture diagrams
209
+ 5. Document data flow
210
+ 6. Explain technology choices
211
+ 7. Document scalability considerations
212
+ 8. Include security architecture
213
+ 9. Document deployment architecture
214
+ 10. Document future roadmap
215
+
216
+ Output: Complete architecture documentation with diagrams and design decisions.
217
+ """,
218
+ agent=self.agent,
219
+ expected_output="Comprehensive architecture documentation with diagrams and design decisions",
220
+ )
221
+
222
+ def create_changelog_task(self, changelog_context: str) -> Task:
223
+ """Create task for changelog documentation.
224
+
225
+ Args:
226
+ changelog_context: Version history and changes
227
+
228
+ Returns:
229
+ Task for changelog
230
+ """
231
+ return Task(
232
+ description=f"""Create comprehensive changelog.
233
+
234
+ Changelog Context:
235
+ {changelog_context}
236
+
237
+ Your task:
238
+ 1. Document all version changes
239
+ 2. Categorize changes (Added, Changed, Deprecated, Removed, Fixed, Security)
240
+ 3. Include version numbers and dates
241
+ 4. Document breaking changes
242
+ 5. Include migration guides for breaking changes
243
+ 6. Link to relevant issues/PRs
244
+ 7. Follow Keep a Changelog format
245
+ 8. Document upgrade instructions
246
+
247
+ Output: Complete CHANGELOG.md following Keep a Changelog format.
248
+ """,
249
+ agent=self.agent,
250
+ expected_output="Complete CHANGELOG.md with version history and migration guides",
251
+ )
252
+
253
+ def create_troubleshooting_guide_task(self, troubleshooting_context: str) -> Task:
254
+ """Create task for troubleshooting guide.
255
+
256
+ Args:
257
+ troubleshooting_context: Common issues and solutions
258
+
259
+ Returns:
260
+ Task for troubleshooting guide
261
+ """
262
+ return Task(
263
+ description=f"""Create comprehensive troubleshooting guide.
264
+
265
+ Troubleshooting Context:
266
+ {troubleshooting_context}
267
+
268
+ Your task:
269
+ 1. Identify common issues and errors
270
+ 2. Provide step-by-step solutions
271
+ 3. Include error messages and their meanings
272
+ 4. Document diagnostic steps
273
+ 5. Provide log analysis guidance
274
+ 6. Include debugging tips
275
+ 7. Document known issues and workarounds
276
+ 8. Provide contact information for support
277
+ 9. Include escalation procedures
278
+
279
+ Output: Complete troubleshooting guide with common issues and solutions.
280
+ """,
281
+ agent=self.agent,
282
+ expected_output="Comprehensive troubleshooting guide with common issues and solutions",
283
+ )
284
+
285
+ def create_migration_guide_task(self, migration_context: str) -> Task:
286
+ """Create task for migration guide.
287
+
288
+ Args:
289
+ migration_context: Migration requirements and procedures
290
+
291
+ Returns:
292
+ Task for migration guide
293
+ """
294
+ return Task(
295
+ description=f"""Create comprehensive migration guide.
296
+
297
+ Migration Context:
298
+ {migration_context}
299
+
300
+ Your task:
301
+ 1. Document migration prerequisites
302
+ 2. Provide step-by-step migration process
303
+ 3. Include data migration procedures
304
+ 4. Document configuration changes
305
+ 5. Provide rollback procedures
306
+ 6. Include testing checklist
307
+ 7. Document downtime requirements
308
+ 8. Provide post-migration verification steps
309
+ 9. Include common migration issues and solutions
310
+
311
+ Output: Complete migration guide with procedures and rollback steps.
312
+ """,
313
+ agent=self.agent,
314
+ expected_output="Comprehensive migration guide with procedures and rollback steps",
315
+ )
316
+
317
+ def create_code_examples_task(self, examples_context: str) -> Task:
318
+ """Create task for code examples documentation.
319
+
320
+ Args:
321
+ examples_context: Code usage patterns and examples
322
+
323
+ Returns:
324
+ Task for code examples
325
+ """
326
+ return Task(
327
+ description=f"""Create comprehensive code examples documentation.
328
+
329
+ Examples Context:
330
+ {examples_context}
331
+
332
+ Your task:
333
+ 1. Identify common use cases
334
+ 2. Create code examples for each use case
335
+ 3. Include explanations for each example
336
+ 4. Provide complete, runnable examples
337
+ 5. Document input/output for each example
338
+ 6. Include best practices examples
339
+ 7. Document anti-patterns to avoid
340
+ 8. Provide advanced usage examples
341
+ 9. Include integration examples
342
+
343
+ Output: Complete code examples documentation with explanations.
344
+ """,
345
+ agent=self.agent,
346
+ expected_output="Comprehensive code examples documentation with explanations",
347
+ )
348
+
349
+ def create_release_notes_task(self, release_context: str) -> Task:
350
+ """Create task for release notes.
351
+
352
+ Args:
353
+ release_context: Release details and changes
354
+
355
+ Returns:
356
+ Task for release notes
357
+ """
358
+ return Task(
359
+ description=f"""Create comprehensive release notes.
360
+
361
+ Release Context:
362
+ {release_context}
363
+
364
+ Your task:
365
+ 1. Write release summary
366
+ 2. List new features
367
+ 3. Document improvements and enhancements
368
+ 4. List bug fixes
369
+ 5. Document breaking changes
370
+ 6. Include upgrade instructions
371
+ 7. Document known issues
372
+ 8. Include acknowledgments
373
+ 9. Provide download links
374
+ 10. Include compatibility information
375
+
376
+ Output: Complete release notes with all relevant information.
377
+ """,
378
+ agent=self.agent,
379
+ expected_output="Comprehensive release notes with features, fixes, and upgrade instructions",
380
+ )
381
+
382
+ def get_agent(self) -> Agent:
383
+ """Get the CrewAI Agent instance.
384
+
385
+ Returns:
386
+ CrewAI Agent instance
387
+ """
388
+ return self.agent
@@ -0,0 +1,203 @@
1
+ """Product Agent (Khalil) - DISCOVER 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 ProductAgentConfig:
16
+ """Configuration for Product Agent"""
17
+
18
+ name: str = "Khalil"
19
+ role: str = "Product Agent"
20
+ goal: str = "Gather requirements, create PRD, and define user stories"
21
+ backstory: str = (
22
+ "Khalil is an expert product manager with 15+ years of experience in "
23
+ "software product development. He excels at understanding user needs, "
24
+ "prioritizing features, and creating clear product requirements documents."
25
+ )
26
+ verbose: bool = True
27
+ allow_delegation: bool = False
28
+
29
+
30
+ class ProductAgent:
31
+ """Product Agent for DISCOVER phase - Requirements gathering and PRD creation"""
32
+
33
+ def __init__(
34
+ self, config: Optional[ProductAgentConfig] = None, tools: Optional[List] = None
35
+ ):
36
+ """
37
+ Initialize Product 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 ProductAgentConfig()
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_prd_task(
66
+ self, project_description: str, user_input: str, context: Optional[dict] = None
67
+ ) -> Task:
68
+ """
69
+ Create a task for generating PRD
70
+
71
+ Args:
72
+ project_description: Description of the project
73
+ user_input: User's input and requirements
74
+ context: Additional context information
75
+
76
+ Returns:
77
+ CrewAI Task for PRD generation
78
+ """
79
+ context = context or {}
80
+
81
+ description = f"""
82
+ Based on the following project description and user input, create a comprehensive
83
+ Product Requirements Document (PRD):
84
+
85
+ Project Description: {project_description}
86
+ User Input: {user_input}
87
+ Additional Context: {context}
88
+
89
+ The PRD should include:
90
+ 1. Executive Summary
91
+ 2. Problem Statement
92
+ 3. Target Audience / Personas
93
+ 4. User Stories (with acceptance criteria)
94
+ 5. Functional Requirements
95
+ 6. Non-Functional Requirements
96
+ 7. Success Metrics
97
+ 8. MVP Scope (MoSCoW prioritization)
98
+ """
99
+
100
+ return Task(
101
+ description=description,
102
+ agent=self._agent,
103
+ expected_output="A comprehensive PRD document in markdown format",
104
+ )
105
+
106
+ def create_user_stories_task(self, prd_content: str, num_stories: int = 10) -> Task:
107
+ """
108
+ Create a task for generating user stories
109
+
110
+ Args:
111
+ prd_content: Content of the PRD
112
+ num_stories: Number of user stories to generate
113
+
114
+ Returns:
115
+ CrewAI Task for user story generation
116
+ """
117
+ description = f"""
118
+ Based on the PRD below, create {num_stores} detailed user stories with acceptance criteria:
119
+
120
+ {prd_content}
121
+
122
+ Each user story should follow the format:
123
+ - As a [type of user]
124
+ - I want [some goal]
125
+ - So that [some benefit]
126
+
127
+ Include acceptance criteria for each story using Given/When/Then format.
128
+ """
129
+
130
+ return Task(
131
+ description=description,
132
+ agent=self._agent,
133
+ expected_output="A list of user stories with acceptance criteria",
134
+ )
135
+
136
+ def create_personas_task(self, project_description: str) -> Task:
137
+ """
138
+ Create a task for generating user personas
139
+
140
+ Args:
141
+ project_description: Description of the project
142
+
143
+ Returns:
144
+ CrewAI Task for persona generation
145
+ """
146
+ description = f"""
147
+ Based on the project description, create detailed user personas:
148
+
149
+ Project: {project_description}
150
+
151
+ For each persona, include:
152
+ - Name and role
153
+ - Demographics
154
+ - Goals and motivations
155
+ - Pain points
156
+ - Technical proficiency
157
+ - Usage scenarios
158
+ """
159
+
160
+ return Task(
161
+ description=description,
162
+ agent=self._agent,
163
+ expected_output="Detailed user personas in markdown format",
164
+ )
165
+
166
+ def prioritize_features_task(
167
+ self, features: List[str], constraints: Optional[dict] = None
168
+ ) -> Task:
169
+ """
170
+ Create a task for prioritizing features using MoSCoW method
171
+
172
+ Args:
173
+ features: List of features to prioritize
174
+ constraints: Project constraints (time, budget, resources)
175
+
176
+ Returns:
177
+ CrewAI Task for feature prioritization
178
+ """
179
+ constraints = constraints or {}
180
+
181
+ description = f"""
182
+ Prioritize the following features using the MoSCoW method:
183
+
184
+ Features:
185
+ {chr(10).join(f"- {f}" for f in features)}
186
+
187
+ Constraints:
188
+ {constraints}
189
+
190
+ Categorize each feature as:
191
+ - Must Have: Critical for MVP
192
+ - Should Have: Important but not critical
193
+ - Could Have: Nice to have if time permits
194
+ - Won't Have: Out of scope for this release
195
+
196
+ Provide rationale for each categorization.
197
+ """
198
+
199
+ return Task(
200
+ description=description,
201
+ agent=self._agent,
202
+ expected_output="Prioritized feature list with MoSCoW categories",
203
+ )