mdan-cli 2.5.1 → 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.
Files changed (57) hide show
  1. package/AGENTS.md +76 -1
  2. package/README.md +274 -4
  3. package/agents/auto-orchestrator.md +343 -0
  4. package/agents/devops.md +511 -94
  5. package/cli/mdan.py +111 -6
  6. package/cli/mdan_crewai.py +539 -0
  7. package/core/crewai_orchestrator.md +419 -0
  8. package/core/debate-protocol.md +454 -0
  9. package/core/universal-envelope.md +113 -0
  10. package/integrations/__init__.py +33 -0
  11. package/integrations/crewai/__init__.py +27 -0
  12. package/integrations/crewai/agents/__init__.py +21 -0
  13. package/integrations/crewai/agents/architect_agent.py +264 -0
  14. package/integrations/crewai/agents/dev_agent.py +271 -0
  15. package/integrations/crewai/agents/devops_agent.py +421 -0
  16. package/integrations/crewai/agents/doc_agent.py +388 -0
  17. package/integrations/crewai/agents/product_agent.py +203 -0
  18. package/integrations/crewai/agents/security_agent.py +386 -0
  19. package/integrations/crewai/agents/test_agent.py +358 -0
  20. package/integrations/crewai/agents/ux_agent.py +257 -0
  21. package/integrations/crewai/flows/__init__.py +13 -0
  22. package/integrations/crewai/flows/auto_flow.py +451 -0
  23. package/integrations/crewai/flows/build_flow.py +297 -0
  24. package/integrations/crewai/flows/debate_flow.py +422 -0
  25. package/integrations/crewai/flows/discovery_flow.py +267 -0
  26. package/integrations/crewai/orchestrator.py +558 -0
  27. package/integrations/crewai/skills/__init__.py +8 -0
  28. package/integrations/crewai/skills/skill_router.py +534 -0
  29. package/integrations/crewai/tools/__init__.py +11 -0
  30. package/integrations/crewai/tools/file_tool.py +355 -0
  31. package/integrations/crewai/tools/serper_tool.py +169 -0
  32. package/integrations/crewai/tools/sql_tool.py +435 -0
  33. package/memory/CONTEXT-SAVE-FORMAT.md +328 -0
  34. package/memory/MEMORY-AUTO.json +66 -0
  35. package/memory/RESUME-PROTOCOL.md +379 -0
  36. package/package.json +1 -1
  37. package/phases/auto-01-load.md +165 -0
  38. package/phases/auto-02-discover.md +207 -0
  39. package/phases/auto-03-plan.md +509 -0
  40. package/phases/auto-04-architect.md +567 -0
  41. package/phases/auto-05-implement.md +713 -0
  42. package/phases/auto-06-test.md +559 -0
  43. package/phases/auto-07-deploy.md +510 -0
  44. package/phases/auto-08-doc.md +970 -0
  45. package/skills/azure-devops/skill.md +1757 -0
  46. package/templates/dotnet-blazor/README.md +415 -0
  47. package/templates/external-services/ExampleService.cs +361 -0
  48. package/templates/external-services/IService.cs +113 -0
  49. package/templates/external-services/README.md +325 -0
  50. package/templates/external-services/ServiceBase.cs +492 -0
  51. package/templates/external-services/ServiceProvider.cs +243 -0
  52. package/templates/prompts/devops-agent.yaml +327 -0
  53. package/templates/prompts.json +15 -1
  54. package/templates/sql-server/README.md +37 -0
  55. package/templates/sql-server/functions.sql +158 -0
  56. package/templates/sql-server/schema.sql +188 -0
  57. package/templates/sql-server/stored-procedures.sql +284 -0
@@ -0,0 +1,264 @@
1
+ """Architect Agent (Reda) - 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 ArchitectAgentConfig:
16
+ """Configuration for Architect Agent"""
17
+
18
+ name: str = "Reda"
19
+ role: str = "Architect Agent"
20
+ goal: str = "Design system architecture, select tech stack, and create ADRs"
21
+ backstory: str = (
22
+ "Reda is a senior software architect with 20+ years of experience designing "
23
+ "scalable, maintainable systems. He specializes in microservices, cloud-native "
24
+ "architectures, and technology stack selection."
25
+ )
26
+ verbose: bool = True
27
+ allow_delegation: bool = False
28
+
29
+
30
+ class ArchitectAgent:
31
+ """Architect Agent for DESIGN phase - Architecture and tech stack"""
32
+
33
+ def __init__(
34
+ self,
35
+ config: Optional[ArchitectAgentConfig] = None,
36
+ tools: Optional[List] = None,
37
+ ):
38
+ """
39
+ Initialize Architect Agent
40
+
41
+ Args:
42
+ config: Agent configuration
43
+ tools: List of tools available to the agent
44
+ """
45
+ if not CREWAI_AVAILABLE:
46
+ raise ImportError(
47
+ "crewai is not installed. Install it with: pip install crewai"
48
+ )
49
+
50
+ self.config = config or ArchitectAgentConfig()
51
+ self.tools = tools or []
52
+
53
+ self._agent = Agent(
54
+ role=self.config.role,
55
+ goal=self.config.goal,
56
+ backstory=self.config.backstory,
57
+ verbose=self.config.verbose,
58
+ allow_delegation=self.config.allow_delegation,
59
+ tools=self.tools,
60
+ )
61
+
62
+ @property
63
+ def agent(self) -> Agent:
64
+ """Get the underlying CrewAI Agent"""
65
+ return self._agent
66
+
67
+ def create_architecture_task(
68
+ self, prd_content: str, constraints: Optional[dict] = None
69
+ ) -> Task:
70
+ """
71
+ Create a task for designing system architecture
72
+
73
+ Args:
74
+ prd_content: Content of the PRD
75
+ constraints: Technical and business constraints
76
+
77
+ Returns:
78
+ CrewAI Task for architecture design
79
+ """
80
+ constraints = constraints or {}
81
+
82
+ description = f"""
83
+ Based on the PRD below, design a comprehensive system architecture:
84
+
85
+ PRD:
86
+ {prd_content}
87
+
88
+ Constraints:
89
+ {constraints}
90
+
91
+ The architecture document should include:
92
+ 1. High-level architecture diagram (described in text)
93
+ 2. Component breakdown
94
+ 3. Data flow
95
+ 4. Technology stack recommendations
96
+ 5. Scalability considerations
97
+ 6. Security considerations
98
+ 7. Deployment architecture
99
+ """
100
+
101
+ return Task(
102
+ description=description,
103
+ agent=self._agent,
104
+ expected_output="A comprehensive architecture document in markdown format",
105
+ )
106
+
107
+ def create_tech_stack_task(
108
+ self, requirements: List[str], preferences: Optional[dict] = None
109
+ ) -> Task:
110
+ """
111
+ Create a task for selecting technology stack
112
+
113
+ Args:
114
+ requirements: Technical requirements
115
+ preferences: Team preferences and existing tech
116
+
117
+ Returns:
118
+ CrewAI Task for tech stack selection
119
+ """
120
+ preferences = preferences or {}
121
+
122
+ description = f"""
123
+ Select an optimal technology stack based on the following requirements:
124
+
125
+ Requirements:
126
+ {chr(10).join(f"- {r}" for r in requirements)}
127
+
128
+ Preferences:
129
+ {preferences}
130
+
131
+ Provide recommendations for:
132
+ - Programming language(s)
133
+ - Framework(s)
134
+ - Database(s)
135
+ - Caching layer
136
+ - Message queue (if needed)
137
+ - Frontend framework (if applicable)
138
+ - DevOps tools
139
+
140
+ For each recommendation, provide:
141
+ - Justification
142
+ - Pros and cons
143
+ - Alternatives considered
144
+ """
145
+
146
+ return Task(
147
+ description=description,
148
+ agent=self._agent,
149
+ expected_output="Technology stack recommendations with justifications",
150
+ )
151
+
152
+ def create_adr_task(
153
+ self, decision_topic: str, context: str, options: List[str]
154
+ ) -> Task:
155
+ """
156
+ Create a task for creating an Architecture Decision Record (ADR)
157
+
158
+ Args:
159
+ decision_topic: Title of the decision
160
+ context: Background and context
161
+ options: List of options being considered
162
+
163
+ Returns:
164
+ CrewAI Task for ADR creation
165
+ """
166
+ description = f"""
167
+ Create an Architecture Decision Record (ADR) for the following:
168
+
169
+ Decision: {decision_topic}
170
+
171
+ Context:
172
+ {context}
173
+
174
+ Options being considered:
175
+ {chr(10).join(f"{i + 1}. {opt}" for i, opt in enumerate(options))}
176
+
177
+ The ADR should follow this format:
178
+ 1. Status (Proposed/Accepted/Rejected/Superseded)
179
+ 2. Context
180
+ 3. Decision
181
+ 4. Consequences (positive and negative)
182
+ 5. Alternatives considered
183
+ """
184
+
185
+ return Task(
186
+ description=description,
187
+ agent=self._agent,
188
+ expected_output="A complete ADR document",
189
+ )
190
+
191
+ def create_api_design_task(
192
+ self, requirements: List[str], data_models: Optional[str] = None
193
+ ) -> Task:
194
+ """
195
+ Create a task for designing API endpoints
196
+
197
+ Args:
198
+ requirements: API requirements
199
+ data_models: Data model descriptions
200
+
201
+ Returns:
202
+ CrewAI Task for API design
203
+ """
204
+ description = f"""
205
+ Design RESTful API endpoints based on the following requirements:
206
+
207
+ Requirements:
208
+ {chr(10).join(f"- {r}" for r in requirements)}
209
+
210
+ Data Models:
211
+ {data_models or "To be defined"}
212
+
213
+ For each endpoint, specify:
214
+ - HTTP method and path
215
+ - Request parameters (path, query, body)
216
+ - Response format
217
+ - Authentication requirements
218
+ - Rate limiting considerations
219
+ - Error responses
220
+
221
+ Organize endpoints by resource and provide OpenAPI/Swagger specification.
222
+ """
223
+
224
+ return Task(
225
+ description=description,
226
+ agent=self._agent,
227
+ expected_output="API design document with endpoint specifications",
228
+ )
229
+
230
+ def create_database_schema_task(
231
+ self, requirements: List[str], tech_stack: Optional[str] = None
232
+ ) -> Task:
233
+ """
234
+ Create a task for designing database schema
235
+
236
+ Args:
237
+ requirements: Data requirements
238
+ tech_stack: Database technology being used
239
+
240
+ Returns:
241
+ CrewAI Task for database schema design
242
+ """
243
+ description = f"""
244
+ Design a database schema based on the following requirements:
245
+
246
+ Requirements:
247
+ {chr(10).join(f"- {r}" for r in requirements)}
248
+
249
+ Database Technology: {tech_stack or "To be determined"}
250
+
251
+ Provide:
252
+ 1. Entity-Relationship diagram (described in text)
253
+ 2. Table definitions with columns, data types, and constraints
254
+ 3. Indexes for performance
255
+ 4. Relationships (foreign keys)
256
+ 5. Migration strategy
257
+ 6. SQL DDL statements (if applicable)
258
+ """
259
+
260
+ return Task(
261
+ description=description,
262
+ agent=self._agent,
263
+ expected_output="Database schema design with DDL statements",
264
+ )
@@ -0,0 +1,271 @@
1
+ """Dev Agent (Haytame) - BUILD 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 DevAgentConfig:
16
+ """Configuration for Dev Agent"""
17
+
18
+ name: str = "Haytame"
19
+ role: str = "Dev Agent"
20
+ goal: str = "Implement features, write clean code, and ensure quality"
21
+ backstory: str = (
22
+ "Haytame is a senior software engineer with 12+ years of experience in "
23
+ "full-stack development. He writes clean, maintainable code and follows "
24
+ "best practices for testing, documentation, and code review."
25
+ )
26
+ verbose: bool = True
27
+ allow_delegation: bool = False
28
+
29
+
30
+ class DevAgent:
31
+ """Dev Agent for BUILD phase - Implementation and coding"""
32
+
33
+ def __init__(
34
+ self, config: Optional[DevAgentConfig] = None, tools: Optional[List] = None
35
+ ):
36
+ """
37
+ Initialize Dev 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 DevAgentConfig()
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_implementation_task(
66
+ self,
67
+ user_story: str,
68
+ acceptance_criteria: List[str],
69
+ tech_stack: Optional[dict] = None,
70
+ ) -> Task:
71
+ """
72
+ Create a task for implementing a user story
73
+
74
+ Args:
75
+ user_story: User story to implement
76
+ acceptance_criteria: List of acceptance criteria
77
+ tech_stack: Technology stack being used
78
+
79
+ Returns:
80
+ CrewAI Task for implementation
81
+ """
82
+ tech_stack = tech_stack or {}
83
+
84
+ description = f"""
85
+ Implement the following user story:
86
+
87
+ User Story: {user_story}
88
+
89
+ Acceptance Criteria:
90
+ {chr(10).join(f"- {ac}" for ac in acceptance_criteria)}
91
+
92
+ Technology Stack:
93
+ {tech_stack}
94
+
95
+ Provide:
96
+ 1. Implementation plan
97
+ 2. Code for the feature (following best practices)
98
+ 3. Unit tests
99
+ 4. Integration points
100
+ 5. Any configuration changes needed
101
+
102
+ Ensure code is:
103
+ - Clean and readable
104
+ - Well-documented
105
+ - Following SOLID principles
106
+ - Type-hinted (if applicable)
107
+ - Error-handled appropriately
108
+ """
109
+
110
+ return Task(
111
+ description=description,
112
+ agent=self._agent,
113
+ expected_output="Complete implementation with code and tests",
114
+ )
115
+
116
+ def create_refactoring_task(self, code_content: str, issues: List[str]) -> Task:
117
+ """
118
+ Create a task for refactoring code
119
+
120
+ Args:
121
+ code_content: Code to refactor
122
+ issues: List of issues to address
123
+
124
+ Returns:
125
+ CrewAI Task for refactoring
126
+ """
127
+ description = f"""
128
+ Refactor the following code to address these issues:
129
+
130
+ Issues to address:
131
+ {chr(10).join(f"- {issue}" for issue in issues)}
132
+
133
+ Code:
134
+ {code_content}
135
+
136
+ Provide:
137
+ 1. Refactored code
138
+ 2. Explanation of changes
139
+ 3. Tests to verify the refactoring
140
+ 4. Any performance improvements
141
+ """
142
+
143
+ return Task(
144
+ description=description,
145
+ agent=self._agent,
146
+ expected_output="Refactored code with explanations",
147
+ )
148
+
149
+ def create_code_review_task(
150
+ self, code_content: str, context: Optional[str] = None
151
+ ) -> Task:
152
+ """
153
+ Create a task for code review
154
+
155
+ Args:
156
+ code_content: Code to review
157
+ context: Context about the code
158
+
159
+ Returns:
160
+ CrewAI Task for code review
161
+ """
162
+ description = f"""
163
+ Perform a thorough code review:
164
+
165
+ Context:
166
+ {context or "No additional context provided"}
167
+
168
+ Code:
169
+ {code_content}
170
+
171
+ Review for:
172
+ 1. Code quality and readability
173
+ 2. Potential bugs
174
+ 3. Security vulnerabilities
175
+ 4. Performance issues
176
+ 5. Best practices adherence
177
+ 6. Test coverage
178
+ 7. Documentation
179
+
180
+ Provide:
181
+ - Overall assessment
182
+ - Specific issues found (with line references if possible)
183
+ - Suggestions for improvement
184
+ - Approval status (Approved/Request Changes)
185
+ """
186
+
187
+ return Task(
188
+ description=description,
189
+ agent=self._agent,
190
+ expected_output="Detailed code review with findings and recommendations",
191
+ )
192
+
193
+ def create_test_task(self, code_content: str, requirements: List[str]) -> Task:
194
+ """
195
+ Create a task for writing tests
196
+
197
+ Args:
198
+ code_content: Code to test
199
+ requirements: Test requirements
200
+
201
+ Returns:
202
+ CrewAI Task for test writing
203
+ """
204
+ description = f"""
205
+ Write comprehensive tests for the following code:
206
+
207
+ Code:
208
+ {code_content}
209
+
210
+ Test Requirements:
211
+ {chr(10).join(f"- {req}" for req in requirements)}
212
+
213
+ Provide:
214
+ 1. Unit tests
215
+ 2. Integration tests (if applicable)
216
+ 3. Edge case tests
217
+ 4. Mock implementations (if needed)
218
+ 5. Test documentation
219
+
220
+ Ensure tests are:
221
+ - Clear and maintainable
222
+ - Following Arrange-Act-Assert pattern
223
+ - Well-named and descriptive
224
+ - Independent of each other
225
+ """
226
+
227
+ return Task(
228
+ description=description,
229
+ agent=self._agent,
230
+ expected_output="Comprehensive test suite",
231
+ )
232
+
233
+ def create_debugging_task(
234
+ self, error_message: str, code_content: str, context: Optional[str] = None
235
+ ) -> Task:
236
+ """
237
+ Create a task for debugging
238
+
239
+ Args:
240
+ error_message: Error message or stack trace
241
+ code_content: Code with the bug
242
+ context: Additional context
243
+
244
+ Returns:
245
+ CrewAI Task for debugging
246
+ """
247
+ description = f"""
248
+ Debug the following issue:
249
+
250
+ Error:
251
+ {error_message}
252
+
253
+ Context:
254
+ {context or "No additional context provided"}
255
+
256
+ Code:
257
+ {code_content}
258
+
259
+ Provide:
260
+ 1. Root cause analysis
261
+ 2. Fixed code
262
+ 3. Explanation of the fix
263
+ 4. Tests to prevent regression
264
+ 5. Suggestions for preventing similar issues
265
+ """
266
+
267
+ return Task(
268
+ description=description,
269
+ agent=self._agent,
270
+ expected_output="Bug fix with explanation and tests",
271
+ )