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.
- package/AGENTS.md +76 -1
- package/README.md +274 -4
- package/agents/auto-orchestrator.md +343 -0
- package/agents/devops.md +511 -94
- package/cli/mdan.py +111 -6
- package/cli/mdan_crewai.py +539 -0
- package/core/crewai_orchestrator.md +419 -0
- package/core/debate-protocol.md +454 -0
- package/core/universal-envelope.md +113 -0
- package/integrations/__init__.py +33 -0
- package/integrations/crewai/__init__.py +27 -0
- package/integrations/crewai/agents/__init__.py +21 -0
- package/integrations/crewai/agents/architect_agent.py +264 -0
- package/integrations/crewai/agents/dev_agent.py +271 -0
- package/integrations/crewai/agents/devops_agent.py +421 -0
- package/integrations/crewai/agents/doc_agent.py +388 -0
- package/integrations/crewai/agents/product_agent.py +203 -0
- package/integrations/crewai/agents/security_agent.py +386 -0
- package/integrations/crewai/agents/test_agent.py +358 -0
- package/integrations/crewai/agents/ux_agent.py +257 -0
- package/integrations/crewai/flows/__init__.py +13 -0
- package/integrations/crewai/flows/auto_flow.py +451 -0
- package/integrations/crewai/flows/build_flow.py +297 -0
- package/integrations/crewai/flows/debate_flow.py +422 -0
- package/integrations/crewai/flows/discovery_flow.py +267 -0
- package/integrations/crewai/orchestrator.py +558 -0
- package/integrations/crewai/skills/__init__.py +8 -0
- package/integrations/crewai/skills/skill_router.py +534 -0
- package/integrations/crewai/tools/__init__.py +11 -0
- package/integrations/crewai/tools/file_tool.py +355 -0
- package/integrations/crewai/tools/serper_tool.py +169 -0
- package/integrations/crewai/tools/sql_tool.py +435 -0
- package/memory/CONTEXT-SAVE-FORMAT.md +328 -0
- package/memory/MEMORY-AUTO.json +66 -0
- package/memory/RESUME-PROTOCOL.md +379 -0
- package/package.json +1 -1
- package/phases/auto-01-load.md +165 -0
- package/phases/auto-02-discover.md +207 -0
- package/phases/auto-03-plan.md +509 -0
- package/phases/auto-04-architect.md +567 -0
- package/phases/auto-05-implement.md +713 -0
- package/phases/auto-06-test.md +559 -0
- package/phases/auto-07-deploy.md +510 -0
- package/phases/auto-08-doc.md +970 -0
- package/skills/azure-devops/skill.md +1757 -0
- package/templates/dotnet-blazor/README.md +415 -0
- package/templates/external-services/ExampleService.cs +361 -0
- package/templates/external-services/IService.cs +113 -0
- package/templates/external-services/README.md +325 -0
- package/templates/external-services/ServiceBase.cs +492 -0
- package/templates/external-services/ServiceProvider.cs +243 -0
- package/templates/prompts/devops-agent.yaml +327 -0
- package/templates/prompts.json +15 -1
- package/templates/sql-server/README.md +37 -0
- package/templates/sql-server/functions.sql +158 -0
- package/templates/sql-server/schema.sql +188 -0
- package/templates/sql-server/stored-procedures.sql +284 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
# CrewAI Orchestrator Documentation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The CrewAI Orchestrator is a comprehensive integration of CrewAI into MDANV2, providing intelligent multi-agent orchestration, skill routing, and autonomous development capabilities.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
integrations/crewai/
|
|
11
|
+
├── agents/ # CrewAI agents (8 specialized agents)
|
|
12
|
+
├── flows/ # CrewAI flows (4 orchestration flows)
|
|
13
|
+
├── tools/ # Custom tools (Serper, SQL, File)
|
|
14
|
+
├── skills/ # Skill router for intelligent task routing
|
|
15
|
+
└── orchestrator.py # Main orchestrator class
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Components
|
|
19
|
+
|
|
20
|
+
### Agents
|
|
21
|
+
|
|
22
|
+
Eight specialized CrewAI agents mapped to MDAN phases:
|
|
23
|
+
|
|
24
|
+
| Agent | Phase | Expertise |
|
|
25
|
+
|-------|-------|-----------|
|
|
26
|
+
| ProductAgent (Khalil) | DISCOVER | Requirements, PRD, user stories |
|
|
27
|
+
| ArchitectAgent (Reda) | DESIGN | Architecture, tech stack, ADR |
|
|
28
|
+
| UXAgent (Jihane) | DESIGN | User flows, wireframes, design system |
|
|
29
|
+
| DevAgent (Haytame) | BUILD | Implementation, refactoring, debugging |
|
|
30
|
+
| TestAgent (Youssef) | VERIFY | Testing strategy, test execution |
|
|
31
|
+
| SecurityAgent (Said) | BUILD+VERIFY | Security review, vulnerability assessment |
|
|
32
|
+
| DevOpsAgent (Anas) | SHIP | Deployment, CI/CD, infrastructure |
|
|
33
|
+
| DocAgent (Amina) | SHIP | Documentation, user guides |
|
|
34
|
+
|
|
35
|
+
### Flows
|
|
36
|
+
|
|
37
|
+
Four CrewAI flows for different orchestration patterns:
|
|
38
|
+
|
|
39
|
+
1. **AutoFlow** - Full autonomous development cycle (8 phases)
|
|
40
|
+
2. **DiscoveryFlow** - DISCOVER phase orchestration
|
|
41
|
+
3. **BuildFlow** - BUILD phase orchestration
|
|
42
|
+
4. **DebateFlow** - Multi-agent debate for consensus
|
|
43
|
+
|
|
44
|
+
### Tools
|
|
45
|
+
|
|
46
|
+
Three custom tools for agent capabilities:
|
|
47
|
+
|
|
48
|
+
1. **SerperTool** - Web search via Serper API
|
|
49
|
+
2. **SQLTool** - Async SQL connector (PostgreSQL, MySQL, SQLServer, SQLite)
|
|
50
|
+
3. **FileTool** - File operations (read, write, list, copy, move)
|
|
51
|
+
|
|
52
|
+
### Skill Router
|
|
53
|
+
|
|
54
|
+
Intelligent skill detection and routing:
|
|
55
|
+
|
|
56
|
+
- Detects required skills from task descriptions
|
|
57
|
+
- Routes tasks to appropriate agents
|
|
58
|
+
- Supports 50+ skills across all domains
|
|
59
|
+
- Maintains execution history
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Install CrewAI dependencies
|
|
65
|
+
pip install -r requirements_crewai.txt
|
|
66
|
+
|
|
67
|
+
# Set environment variables
|
|
68
|
+
export SERPER_API_KEY="your-serper-api-key"
|
|
69
|
+
export OPENAI_API_KEY="your-openai-api-key" # or other LLM provider
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
### Basic Usage
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
import asyncio
|
|
78
|
+
from integrations.crewai.orchestrator import CrewAIOrchestrator
|
|
79
|
+
|
|
80
|
+
async def main():
|
|
81
|
+
# Initialize orchestrator
|
|
82
|
+
orchestrator = CrewAIOrchestrator(
|
|
83
|
+
project_path="/path/to/project",
|
|
84
|
+
llm=your_llm_instance,
|
|
85
|
+
sql_config={
|
|
86
|
+
"db_type": "postgresql",
|
|
87
|
+
"host": "localhost",
|
|
88
|
+
"port": 5432,
|
|
89
|
+
"database": "mydb",
|
|
90
|
+
"user": "user",
|
|
91
|
+
"password": "password"
|
|
92
|
+
},
|
|
93
|
+
serper_api_key="your-serper-api-key"
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Execute a task
|
|
97
|
+
result = await orchestrator.execute_task(
|
|
98
|
+
"Create a PRD for a todo app"
|
|
99
|
+
)
|
|
100
|
+
print(result)
|
|
101
|
+
|
|
102
|
+
asyncio.run(main())
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Autonomous Mode
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# Enable autonomous mode
|
|
109
|
+
orchestrator = CrewAIOrchestrator(
|
|
110
|
+
project_path="/path/to/project",
|
|
111
|
+
llm=your_llm_instance,
|
|
112
|
+
auto_mode=True
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Run full autonomous development cycle
|
|
116
|
+
result = await orchestrator.run_auto_mode(
|
|
117
|
+
"Build a todo app with user authentication"
|
|
118
|
+
)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Multi-Agent Debate
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
# Start a debate on a topic
|
|
125
|
+
result = await orchestrator.start_debate(
|
|
126
|
+
"Should we use PostgreSQL or MongoDB for this project?"
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Skill-Based Execution
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from integrations.crewai.skills import SkillRouter
|
|
134
|
+
|
|
135
|
+
# Initialize skill router
|
|
136
|
+
skill_router = SkillRouter(orchestrator)
|
|
137
|
+
|
|
138
|
+
# Execute based on detected skills
|
|
139
|
+
result = await skill_router.execute_skills(
|
|
140
|
+
"Create unit tests for the authentication module"
|
|
141
|
+
)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Custom Crew
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from crewai import Process
|
|
148
|
+
|
|
149
|
+
# Create a custom crew with specific agents
|
|
150
|
+
crew = orchestrator.create_crew(
|
|
151
|
+
agent_names=["architect", "dev", "test"],
|
|
152
|
+
process=Process.sequential
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
# Execute tasks with the crew
|
|
156
|
+
from crewai import Task
|
|
157
|
+
|
|
158
|
+
tasks = [
|
|
159
|
+
Task(
|
|
160
|
+
description="Design the system architecture",
|
|
161
|
+
agent=orchestrator.agents["architect"].get_agent()
|
|
162
|
+
),
|
|
163
|
+
Task(
|
|
164
|
+
description="Implement the features",
|
|
165
|
+
agent=orchestrator.agents["dev"].get_agent()
|
|
166
|
+
),
|
|
167
|
+
Task(
|
|
168
|
+
description="Write tests",
|
|
169
|
+
agent=orchestrator.agents["test"].get_agent()
|
|
170
|
+
)
|
|
171
|
+
]
|
|
172
|
+
|
|
173
|
+
result = await orchestrator.execute_crew(crew, tasks)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Configuration
|
|
177
|
+
|
|
178
|
+
### SQL Configuration
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
sql_config = {
|
|
182
|
+
"db_type": "postgresql", # or "mysql", "sqlserver", "sqlite"
|
|
183
|
+
"host": "localhost",
|
|
184
|
+
"port": 5432,
|
|
185
|
+
"database": "mydb",
|
|
186
|
+
"user": "user",
|
|
187
|
+
"password": "password",
|
|
188
|
+
"pool_size": 10,
|
|
189
|
+
"max_overflow": 20
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### LLM Configuration
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
from langchain_openai import ChatOpenAI
|
|
197
|
+
|
|
198
|
+
llm = ChatOpenAI(
|
|
199
|
+
model="gpt-4",
|
|
200
|
+
temperature=0.7,
|
|
201
|
+
api_key="your-api-key"
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
orchestrator = CrewAIOrchestrator(
|
|
205
|
+
project_path="/path/to/project",
|
|
206
|
+
llm=llm
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## API Reference
|
|
211
|
+
|
|
212
|
+
### CrewAIOrchestrator
|
|
213
|
+
|
|
214
|
+
#### Methods
|
|
215
|
+
|
|
216
|
+
- `analyze_task(task_description: str) -> Dict[str, Any]` - Analyze task and determine agent/flow
|
|
217
|
+
- `execute_task(task_description: str, context: Optional[Dict] = None) -> Dict[str, Any]` - Execute a task
|
|
218
|
+
- `run_auto_mode(user_input: str) -> Dict[str, Any]` - Run autonomous mode
|
|
219
|
+
- `start_debate(topic: str) -> Dict[str, Any]` - Start multi-agent debate
|
|
220
|
+
- `create_crew(agent_names: List[str], process: Process, verbose: bool) -> Crew` - Create custom crew
|
|
221
|
+
- `execute_crew(crew: Crew, tasks: List[Task]) -> Dict[str, Any]` - Execute crew with tasks
|
|
222
|
+
- `get_state() -> Dict[str, Any]` - Get orchestrator state
|
|
223
|
+
- `save_state(filepath: str)` - Save state to file
|
|
224
|
+
- `load_state(filepath: str)` - Load state from file
|
|
225
|
+
- `enable_auto_mode()` - Enable autonomous mode
|
|
226
|
+
- `disable_auto_mode()` - Disable autonomous mode
|
|
227
|
+
- `is_auto_mode_enabled() -> bool` - Check auto mode status
|
|
228
|
+
|
|
229
|
+
### SkillRouter
|
|
230
|
+
|
|
231
|
+
#### Methods
|
|
232
|
+
|
|
233
|
+
- `detect_skills(task_description: str) -> Set[Skill]` - Detect required skills
|
|
234
|
+
- `get_agent_for_skill(skill: Skill) -> Optional[str]` - Get agent for skill
|
|
235
|
+
- `execute_skills(task_description: str, context: Optional[Dict] = None) -> Dict[str, Any]` - Execute skills
|
|
236
|
+
- `get_skill_execution_history() -> List[Dict]` - Get execution history
|
|
237
|
+
- `clear_skill_execution_history()` - Clear history
|
|
238
|
+
- `get_all_skills() -> List[str]` - Get all available skills
|
|
239
|
+
|
|
240
|
+
## Available Skills
|
|
241
|
+
|
|
242
|
+
### Product Skills
|
|
243
|
+
- requirement_analysis
|
|
244
|
+
- prd_creation
|
|
245
|
+
- user_story_writing
|
|
246
|
+
- persona_creation
|
|
247
|
+
- feature_prioritization
|
|
248
|
+
- acceptance_criteria
|
|
249
|
+
|
|
250
|
+
### Architecture Skills
|
|
251
|
+
- system_architecture
|
|
252
|
+
- tech_stack_selection
|
|
253
|
+
- adr_documentation
|
|
254
|
+
- api_design
|
|
255
|
+
- database_schema
|
|
256
|
+
|
|
257
|
+
### UX Skills
|
|
258
|
+
- user_flow_design
|
|
259
|
+
- wireframe_creation
|
|
260
|
+
- design_system
|
|
261
|
+
- accessibility
|
|
262
|
+
- prototype_creation
|
|
263
|
+
|
|
264
|
+
### Development Skills
|
|
265
|
+
- implementation
|
|
266
|
+
- refactoring
|
|
267
|
+
- code_review
|
|
268
|
+
- testing
|
|
269
|
+
- debugging
|
|
270
|
+
|
|
271
|
+
### Testing Skills
|
|
272
|
+
- test_strategy
|
|
273
|
+
- unit_testing
|
|
274
|
+
- integration_testing
|
|
275
|
+
- e2e_testing
|
|
276
|
+
- test_execution
|
|
277
|
+
- performance_testing
|
|
278
|
+
- security_testing
|
|
279
|
+
- test_automation
|
|
280
|
+
- quality_gate
|
|
281
|
+
|
|
282
|
+
### Security Skills
|
|
283
|
+
- security_review
|
|
284
|
+
- vulnerability_scan
|
|
285
|
+
- secure_coding
|
|
286
|
+
- dependency_security
|
|
287
|
+
- authentication_security
|
|
288
|
+
- data_protection
|
|
289
|
+
- api_security
|
|
290
|
+
- security_monitoring
|
|
291
|
+
- compliance_review
|
|
292
|
+
|
|
293
|
+
### DevOps Skills
|
|
294
|
+
- ci_cd_pipeline
|
|
295
|
+
- docker_setup
|
|
296
|
+
- kubernetes_setup
|
|
297
|
+
- azure_deployment
|
|
298
|
+
- monitoring_setup
|
|
299
|
+
- deployment_strategy
|
|
300
|
+
- infrastructure_as_code
|
|
301
|
+
- backup_recovery
|
|
302
|
+
- scaling_strategy
|
|
303
|
+
- security_hardening
|
|
304
|
+
|
|
305
|
+
### Documentation Skills
|
|
306
|
+
- readme_creation
|
|
307
|
+
- api_documentation
|
|
308
|
+
- user_guide
|
|
309
|
+
- developer_guide
|
|
310
|
+
- architecture_documentation
|
|
311
|
+
- changelog
|
|
312
|
+
- troubleshooting_guide
|
|
313
|
+
- migration_guide
|
|
314
|
+
- code_examples
|
|
315
|
+
- release_notes
|
|
316
|
+
|
|
317
|
+
### Tool Skills
|
|
318
|
+
- web_search
|
|
319
|
+
- sql_query
|
|
320
|
+
- file_operation
|
|
321
|
+
|
|
322
|
+
## State Management
|
|
323
|
+
|
|
324
|
+
The orchestrator maintains state that can be saved and loaded:
|
|
325
|
+
|
|
326
|
+
```python
|
|
327
|
+
# Save state
|
|
328
|
+
orchestrator.save_state("orchestrator_state.json")
|
|
329
|
+
|
|
330
|
+
# Load state
|
|
331
|
+
orchestrator.load_state("orchestrator_state.json")
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Context Save/Load
|
|
335
|
+
|
|
336
|
+
Flows support context save/load for resuming:
|
|
337
|
+
|
|
338
|
+
```python
|
|
339
|
+
# Save flow context
|
|
340
|
+
flow = orchestrator.flows["auto"]
|
|
341
|
+
flow.save_context("auto_flow_context.json")
|
|
342
|
+
|
|
343
|
+
# Load flow context
|
|
344
|
+
loaded_flow = AutoFlow.load_context("auto_flow_context.json", llm=your_llm)
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Error Handling
|
|
348
|
+
|
|
349
|
+
All async methods return a result dictionary with status:
|
|
350
|
+
|
|
351
|
+
```python
|
|
352
|
+
result = await orchestrator.execute_task("some task")
|
|
353
|
+
|
|
354
|
+
if result["status"] == "success":
|
|
355
|
+
print("Task completed:", result["result"])
|
|
356
|
+
else:
|
|
357
|
+
print("Task failed:", result["error"])
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## Best Practices
|
|
361
|
+
|
|
362
|
+
1. **Use appropriate flows** - Use AutoFlow for full cycles, specific flows for single phases
|
|
363
|
+
2. **Enable auto mode carefully** - Auto mode executes all phases without intervention
|
|
364
|
+
3. **Monitor execution** - Check state and task history for progress
|
|
365
|
+
4. **Save state regularly** - Save state after major milestones
|
|
366
|
+
5. **Use skill routing** - Let SkillRouter detect and route skills automatically
|
|
367
|
+
6. **Configure tools properly** - Ensure SQL and Serper tools are configured correctly
|
|
368
|
+
7. **Handle errors gracefully** - Check result status before proceeding
|
|
369
|
+
|
|
370
|
+
## Troubleshooting
|
|
371
|
+
|
|
372
|
+
### Common Issues
|
|
373
|
+
|
|
374
|
+
1. **CrewAI import errors**
|
|
375
|
+
- Ensure `crewai>=0.80.0` is installed
|
|
376
|
+
- Check Python version (3.9+)
|
|
377
|
+
|
|
378
|
+
2. **SQL connection errors**
|
|
379
|
+
- Verify database credentials
|
|
380
|
+
- Check database is accessible
|
|
381
|
+
- Ensure correct db_type is specified
|
|
382
|
+
|
|
383
|
+
3. **Serper API errors**
|
|
384
|
+
- Verify SERPER_API_KEY is set
|
|
385
|
+
- Check API key is valid
|
|
386
|
+
|
|
387
|
+
4. **LLM errors**
|
|
388
|
+
- Verify API key is set
|
|
389
|
+
- Check model is available
|
|
390
|
+
- Ensure sufficient credits
|
|
391
|
+
|
|
392
|
+
## Integration with MDAN CLI
|
|
393
|
+
|
|
394
|
+
The CrewAI orchestrator can be integrated with the existing MDAN CLI:
|
|
395
|
+
|
|
396
|
+
```python
|
|
397
|
+
# In cli/mdan.py
|
|
398
|
+
from integrations.crewai.orchestrator import CrewAIOrchestrator
|
|
399
|
+
|
|
400
|
+
def cmd_auto(args):
|
|
401
|
+
orchestrator = CrewAIOrchestrator(
|
|
402
|
+
project_path=args.project,
|
|
403
|
+
llm=get_llm(),
|
|
404
|
+
auto_mode=True
|
|
405
|
+
)
|
|
406
|
+
result = asyncio.run(orchestrator.run_auto_mode(args.input))
|
|
407
|
+
print(result)
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## Future Enhancements
|
|
411
|
+
|
|
412
|
+
- [ ] Add more specialized agents
|
|
413
|
+
- [ ] Implement skill caching
|
|
414
|
+
- [ ] Add parallel execution support
|
|
415
|
+
- [ ] Implement skill composition
|
|
416
|
+
- [ ] Add real-time progress monitoring
|
|
417
|
+
- [ ] Implement skill learning from execution history
|
|
418
|
+
- [ ] Add support for custom skills
|
|
419
|
+
- [ ] Implement skill versioning
|