dhurandhar 1.0.2 → 2.0.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/AI_FEATURES.md +369 -0
- package/API_REFERENCE.md +300 -0
- package/CHANGELOG.md +406 -0
- package/CODEGEN_GUIDE.md +315 -0
- package/DEMO_WALKTHROUGH.md +297 -0
- package/INTEGRATION_GUIDE.md +256 -0
- package/README.md +211 -453
- package/TROUBLESHOOTING.md +375 -0
- package/cli/commands/agents/arjuna.js +669 -0
- package/cli/commands/agents/bheema.js +976 -0
- package/cli/commands/agents/bhishma.js +433 -0
- package/cli/commands/agents/draupadi.js +771 -0
- package/cli/commands/agents/nakula.js +534 -0
- package/cli/commands/agents/sahadeva.js +452 -0
- package/cli/commands/agents/yudhishthira.js +709 -0
- package/cli/commands/ai-assist.js +246 -0
- package/cli/commands/back.js +35 -0
- package/cli/commands/codegen.js +125 -0
- package/cli/commands/decisions.js +100 -0
- package/cli/commands/diagrams.js +99 -0
- package/cli/commands/export.js +64 -0
- package/cli/commands/init.js +193 -0
- package/cli/commands/integrate.js +208 -0
- package/cli/commands/next.js +48 -0
- package/cli/commands/phase.js +150 -0
- package/cli/commands/review.js +189 -0
- package/cli/commands/status.js +134 -0
- package/cli/commands/undo.js +52 -0
- package/cli/dhurandhar.js +278 -0
- package/core/system-design-map/schema-v2.yaml +299 -0
- package/cross-cutting/ai/ai-engine.js +234 -0
- package/cross-cutting/ai/pattern-detector.js +272 -0
- package/cross-cutting/cascading-review/workflow.js +602 -0
- package/cross-cutting/code-generation/backend/nestjs-generator.js +146 -0
- package/cross-cutting/code-generation/frontend/react-generator.js +183 -0
- package/cross-cutting/code-generation/generator-engine.js +164 -0
- package/cross-cutting/code-generation/infrastructure/docker-k8s-generator.js +134 -0
- package/cross-cutting/code-generation/tests/jest-generator.js +156 -0
- package/cross-cutting/constraint-propagation/propagator.js +258 -0
- package/cross-cutting/decision-registry/README.md +176 -0
- package/cross-cutting/decision-registry/registry.js +168 -0
- package/cross-cutting/dependency-tracking/tracker.js +200 -0
- package/cross-cutting/diagram-generation/generator.js +173 -0
- package/cross-cutting/export/markdown-exporter.js +384 -0
- package/cross-cutting/integrations/confluence-integration.js +261 -0
- package/cross-cutting/integrations/github-integration.js +183 -0
- package/cross-cutting/integrations/jira-integration.js +200 -0
- package/cross-cutting/performance/cache-manager.js +138 -0
- package/cross-cutting/performance/cancellation-token.js +167 -0
- package/cross-cutting/performance/progress-tracker.js +134 -0
- package/cross-cutting/performance/yaml-optimizer.js +133 -0
- package/cross-cutting/session-rehydration/rehydration.js +166 -0
- package/cross-cutting/ux/confirmation.js +175 -0
- package/cross-cutting/ux/error-handler.js +191 -0
- package/cross-cutting/ux/undo-manager.js +234 -0
- package/jest.config.js +61 -0
- package/package.json +48 -24
- package/phases/api-design/master-agent/nakula.md +163 -0
- package/phases/entities-and-domain/master-agent/sahadeva.md +314 -0
- package/phases/features-discovery/README.md +142 -0
- package/phases/features-discovery/master-agent/yudhishthira.md +238 -0
- package/phases/high-level-design/master-agent/bheema.md +184 -0
- package/phases/implementation/master-agent/bheema.md +209 -0
- package/phases/low-level-design/master-agent/arjuna.md +229 -0
- package/phases/requirements-engineering/master-agent/bhishma.md +265 -0
- package/phases/review-and-audit/master-agent/draupadi.md +248 -0
- package/sub-agents/REMAINING_SUB_AGENTS.md +154 -0
- package/sub-agents/cross-cutting/dhaumya.md +214 -0
- package/sub-agents/cross-cutting/sanjaya.md +213 -0
- package/sub-agents/cross-cutting/vidura.md +197 -0
- package/sub-agents/phase1-features/dhritarashtra.md +184 -0
- package/sub-agents/phase1-features/drupada.md +148 -0
- package/sub-agents/phase1-features/jarasandha.md +188 -0
- package/sub-agents/phase1-features/virat.md +169 -0
- package/sub-agents/phase2-requirements/bhurishravas.js +91 -0
- package/sub-agents/phase2-requirements/drona.js +155 -0
- package/sub-agents/phase2-requirements/kripa.js +170 -0
- package/sub-agents/phase2-requirements/shantanu.js +82 -0
- package/sub-agents/phase3-entities/kunti.js +173 -0
- package/sub-agents/phase3-entities/pandu.js +148 -0
- package/sub-agents/phase4-apis/ashwatthama.js +138 -0
- package/sub-agents/phase4-apis/karna.js +235 -0
- package/sub-agents/phase5-hld/drona.js +155 -0
- package/sub-agents/phase5-hld/shakuni.js +157 -0
- package/sub-agents/phase6-lld/abhimanyu.js +146 -0
- package/sub-agents/phase6-lld/drona.js +155 -0
- package/sub-agents/phase6-lld/ghatotkacha.js +153 -0
- package/sub-agents/phase7-implementation/barbarik.js +155 -0
- package/sub-agents/phase7-implementation/yuyutsu.js +200 -0
- package/sub-agents/universal/draupadi-advisor.js +284 -0
- package/test/integration/full-workflow.test.js +259 -0
- package/test/unit/ai-engine.test.js +161 -0
- package/test/unit/code-generator.test.js +209 -0
- package/test/unit/pattern-detector.test.js +213 -0
- package/.dhurandhar-session-start.md +0 -280
- package/docs/ARCHITECTURE_V2.md +0 -249
- package/docs/DECISION_REGISTRY.md +0 -357
- package/docs/IMPLEMENTATION_PERSONAS.md +0 -406
- package/docs/PLUGGABLE_STRATEGIES.md +0 -439
- package/docs/SYSTEM_OBSERVER.md +0 -433
- package/docs/TEST_FIRST_AGILE.md +0 -359
- package/docs/architecture.md +0 -279
- package/docs/engineering-first-philosophy.md +0 -263
- package/docs/getting-started.md +0 -218
- package/docs/module-development.md +0 -323
- package/docs/strategy-example.md +0 -299
- package/docs/test-first-example.md +0 -392
- package/src/core/README.md +0 -92
- package/src/core/agent-instructions/backend-developer.md +0 -750
- package/src/core/agent-instructions/devops-engineer.md +0 -430
- package/src/core/agent-instructions/dhurandhar-council.md +0 -610
- package/src/core/agent-instructions/edge-case-hunter.md +0 -414
- package/src/core/agent-instructions/frontend-developer.md +0 -554
- package/src/core/agent-instructions/lead-system-architect.md +0 -766
- package/src/core/agent-instructions/system-observer.md +0 -461
- package/src/core/agent-instructions/test-architect.md +0 -401
- package/src/core/module.yaml +0 -54
- package/src/core/schemas/design-module-schema.yaml +0 -995
- package/src/core/schemas/system-design-map-schema.yaml +0 -324
- package/src/modules/example/README.md +0 -130
- package/src/modules/example/module.yaml +0 -252
- package/tools/cli/commands/audit.js +0 -267
- package/tools/cli/commands/config.js +0 -113
- package/tools/cli/commands/context.js +0 -170
- package/tools/cli/commands/decisions.js +0 -398
- package/tools/cli/commands/entity.js +0 -218
- package/tools/cli/commands/epic.js +0 -125
- package/tools/cli/commands/install.js +0 -172
- package/tools/cli/commands/module.js +0 -109
- package/tools/cli/commands/service.js +0 -167
- package/tools/cli/commands/story.js +0 -225
- package/tools/cli/commands/strategy.js +0 -294
- package/tools/cli/commands/test.js +0 -331
- package/tools/cli/commands/validate.js +0 -107
- package/tools/cli/dhurandhar.js +0 -212
- package/tools/lib/config-manager.js +0 -170
- package/tools/lib/filesystem.js +0 -126
- package/tools/lib/module-installer.js +0 -61
- package/tools/lib/module-manager.js +0 -149
- package/tools/lib/sdm-manager.js +0 -982
- package/tools/lib/test-engine.js +0 -422
- package/tools/lib/test-templates/api-client.template.js +0 -100
- package/tools/lib/test-templates/vitest.config.template.js +0 -37
- package/tools/lib/validators/config-validator.js +0 -113
- package/tools/lib/validators/module-validator.js +0 -137
package/AI_FEATURES.md
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# AI Features Guide
|
|
2
|
+
|
|
3
|
+
**Dhurandhar v2.0.0** includes AI-powered design assistance to help you create better systems faster.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🤖 **AI Capabilities**
|
|
8
|
+
|
|
9
|
+
1. **Smart Feature Suggestions** - AI recommends features for your project
|
|
10
|
+
2. **Requirements Generation** - Auto-generate requirements from features
|
|
11
|
+
3. **Entity Extraction** - Identify entities from requirements
|
|
12
|
+
4. **Design Pattern Detection** - Automatically detect patterns in your design
|
|
13
|
+
5. **Anti-Pattern Detection** - Find design smells and code issues
|
|
14
|
+
6. **Improvement Suggestions** - Get recommendations for better design
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 🚀 **Quick Start**
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Interactive AI assistant
|
|
22
|
+
dhurandhar ai
|
|
23
|
+
|
|
24
|
+
# Specific AI actions
|
|
25
|
+
dhurandhar ai -a features # Feature suggestions
|
|
26
|
+
dhurandhar ai -a requirements # Generate requirements
|
|
27
|
+
dhurandhar ai -a entities # Extract entities
|
|
28
|
+
dhurandhar ai -a patterns # Detect design patterns
|
|
29
|
+
dhurandhar ai -a improve # Overall improvements
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 💡 **1. Smart Feature Suggestions**
|
|
35
|
+
|
|
36
|
+
### **When to Use**
|
|
37
|
+
- Starting a new project
|
|
38
|
+
- Brainstorming features
|
|
39
|
+
- Need inspiration
|
|
40
|
+
|
|
41
|
+
### **Usage**
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
dhurandhar ai -a features
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or during design:
|
|
48
|
+
```bash
|
|
49
|
+
dhurandhar yudhishthira
|
|
50
|
+
# You'll be asked: "Would you like AI-powered feature suggestions?"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### **Example Output**
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
🤖 AI Feature Suggestions:
|
|
57
|
+
|
|
58
|
+
1. User Authentication
|
|
59
|
+
Description: Secure login and registration
|
|
60
|
+
Dharmic Value: Protects user identity (Satya - Truth)
|
|
61
|
+
|
|
62
|
+
2. User Dashboard
|
|
63
|
+
Description: Personalized user homepage
|
|
64
|
+
Dharmic Value: Empowers users (Moksha - Liberation)
|
|
65
|
+
|
|
66
|
+
3. Search Functionality
|
|
67
|
+
Description: Find content quickly
|
|
68
|
+
Dharmic Value: Saves user time (Ahimsa - Non-harm)
|
|
69
|
+
|
|
70
|
+
4. Notifications
|
|
71
|
+
Description: Keep users informed
|
|
72
|
+
Dharmic Value: Transparent communication (Satya - Truth)
|
|
73
|
+
|
|
74
|
+
5. User Profile
|
|
75
|
+
Description: Manage personal information
|
|
76
|
+
Dharmic Value: User control (Moksha - Liberation)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### **AI Providers**
|
|
80
|
+
|
|
81
|
+
**Mock Mode** (Default - No API key required):
|
|
82
|
+
- Rule-based suggestions
|
|
83
|
+
- Common features database
|
|
84
|
+
- Dharmic alignment built-in
|
|
85
|
+
- Great for learning
|
|
86
|
+
|
|
87
|
+
**OpenAI Mode** (GPT-4):
|
|
88
|
+
```bash
|
|
89
|
+
export OPENAI_API_KEY=sk-...
|
|
90
|
+
# Then use dhurandhar ai
|
|
91
|
+
```
|
|
92
|
+
- Advanced natural language understanding
|
|
93
|
+
- Context-aware suggestions
|
|
94
|
+
- Creative feature ideas
|
|
95
|
+
|
|
96
|
+
**Anthropic Mode** (Claude 3.5 Sonnet):
|
|
97
|
+
```bash
|
|
98
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
99
|
+
# Then use dhurandhar ai
|
|
100
|
+
```
|
|
101
|
+
- Excellent reasoning
|
|
102
|
+
- Dharma-aware suggestions
|
|
103
|
+
- Thoughtful recommendations
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 📋 **2. Requirements Generation**
|
|
108
|
+
|
|
109
|
+
### **When to Use**
|
|
110
|
+
- Have features, need requirements
|
|
111
|
+
- Want structured requirements
|
|
112
|
+
- Speed up Phase 2 (Bhishma)
|
|
113
|
+
|
|
114
|
+
### **Usage**
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
dhurandhar ai -a requirements
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### **Prerequisites**
|
|
121
|
+
- Complete Phase 1 (Features)
|
|
122
|
+
|
|
123
|
+
### **Example Output**
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
🤖 AI-Suggested Requirements:
|
|
127
|
+
|
|
128
|
+
1. System shall implement user authentication
|
|
129
|
+
Feature: User Authentication
|
|
130
|
+
Criteria: Given a user with valid credentials,
|
|
131
|
+
when they submit login form,
|
|
132
|
+
then they should be authenticated
|
|
133
|
+
|
|
134
|
+
2. System shall implement user dashboard
|
|
135
|
+
Feature: User Dashboard
|
|
136
|
+
Criteria: Given an authenticated user,
|
|
137
|
+
when they access dashboard,
|
|
138
|
+
then they should see personalized content
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 🗂️ **3. Entity Extraction**
|
|
144
|
+
|
|
145
|
+
### **When to Use**
|
|
146
|
+
- Have requirements, need entities
|
|
147
|
+
- Identify domain model
|
|
148
|
+
- Speed up Phase 3 (Sahadeva)
|
|
149
|
+
|
|
150
|
+
### **Usage**
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
dhurandhar ai -a entities
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### **How it Works**
|
|
157
|
+
- Analyzes requirement text
|
|
158
|
+
- Extracts common nouns (User, Order, Product, etc.)
|
|
159
|
+
- Suggests entities with attributes placeholder
|
|
160
|
+
|
|
161
|
+
### **Example Output**
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
🤖 AI-Suggested Entities:
|
|
165
|
+
|
|
166
|
+
1. User
|
|
167
|
+
2. Order
|
|
168
|
+
3. Product
|
|
169
|
+
4. Payment
|
|
170
|
+
5. Notification
|
|
171
|
+
|
|
172
|
+
💡 Use these in Phase 3 (Sahadeva)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 🔍 **4. Design Pattern Detection**
|
|
178
|
+
|
|
179
|
+
### **When to Use**
|
|
180
|
+
- After designing classes (Phase 6)
|
|
181
|
+
- Before implementation
|
|
182
|
+
- Code review
|
|
183
|
+
|
|
184
|
+
### **Usage**
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
dhurandhar ai -a patterns
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Or automatically during design:
|
|
191
|
+
```bash
|
|
192
|
+
dhurandhar arjuna
|
|
193
|
+
# Pattern detection runs automatically during review
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### **Detected Patterns**
|
|
197
|
+
|
|
198
|
+
**Good Patterns** ✅:
|
|
199
|
+
- **Singleton** - getInstance methods
|
|
200
|
+
- **Repository** - CRUD operations (find, save, delete)
|
|
201
|
+
- **Factory** - Object creation (create, build methods)
|
|
202
|
+
- **Service** - Business logic (UserService, OrderService)
|
|
203
|
+
|
|
204
|
+
**Anti-Patterns** ⚠️:
|
|
205
|
+
- **God Class** - Too many methods (>15) or properties (>10)
|
|
206
|
+
- **Circular Dependencies** - Classes depend on each other
|
|
207
|
+
- **Missing Error Handling** - No error/exception methods
|
|
208
|
+
|
|
209
|
+
### **Example Output**
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
✅ Design Patterns Detected:
|
|
213
|
+
|
|
214
|
+
Repository - UserRepository
|
|
215
|
+
Good! Repository pattern separates data access logic
|
|
216
|
+
|
|
217
|
+
Service - UserService
|
|
218
|
+
Service layer for business logic - excellent
|
|
219
|
+
|
|
220
|
+
⚠️ Anti-Patterns Detected:
|
|
221
|
+
|
|
222
|
+
God Class - OrderService
|
|
223
|
+
Issue: OrderService has too many methods (18)
|
|
224
|
+
Suggestion: Break down into smaller, focused classes
|
|
225
|
+
|
|
226
|
+
💡 Suggestions:
|
|
227
|
+
|
|
228
|
+
✅ Detected 4 design patterns
|
|
229
|
+
Good architecture! Consider documenting these patterns
|
|
230
|
+
|
|
231
|
+
🚨 Found 1 anti-pattern
|
|
232
|
+
Review and refactor the identified issues
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 📈 **5. Improvement Suggestions**
|
|
238
|
+
|
|
239
|
+
### **When to Use**
|
|
240
|
+
- Any time during design
|
|
241
|
+
- Before finalizing
|
|
242
|
+
- Quality check
|
|
243
|
+
|
|
244
|
+
### **Usage**
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
dhurandhar ai -a improve
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### **What it Checks**
|
|
251
|
+
- Completeness (all phases done?)
|
|
252
|
+
- Quality scores (API elegance, class precision)
|
|
253
|
+
- Missing components
|
|
254
|
+
- Best practices
|
|
255
|
+
|
|
256
|
+
### **Example Output**
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
🔍 Analyzing Overall Design Quality...
|
|
260
|
+
|
|
261
|
+
⚠️ No entities defined
|
|
262
|
+
Action: Complete Phase 3 (Sahadeva)
|
|
263
|
+
|
|
264
|
+
💭 Average API elegance is 65%
|
|
265
|
+
Action: Review API design in Phase 4
|
|
266
|
+
|
|
267
|
+
✅ Design looks good! No critical improvements needed.
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## 🎯 **AI-Assisted Workflow**
|
|
273
|
+
|
|
274
|
+
### **Typical Usage Pattern**
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# 1. Start project with AI suggestions
|
|
278
|
+
dhurandhar init
|
|
279
|
+
dhurandhar yudhishthira
|
|
280
|
+
# → AI suggests features (optional)
|
|
281
|
+
|
|
282
|
+
# 2. Generate requirements
|
|
283
|
+
dhurandhar ai -a requirements
|
|
284
|
+
# → Use suggestions in Phase 2
|
|
285
|
+
|
|
286
|
+
# 3. Extract entities
|
|
287
|
+
dhurandhar ai -a entities
|
|
288
|
+
# → Use suggestions in Phase 3
|
|
289
|
+
|
|
290
|
+
# 4. Design APIs & Services
|
|
291
|
+
dhurandhar nakula
|
|
292
|
+
dhurandhar bheema
|
|
293
|
+
|
|
294
|
+
# 5. Design classes with pattern detection
|
|
295
|
+
dhurandhar arjuna
|
|
296
|
+
# → AI auto-detects patterns and anti-patterns
|
|
297
|
+
|
|
298
|
+
# 6. Final quality check
|
|
299
|
+
dhurandhar ai -a improve
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## ⚙️ **Configuration**
|
|
305
|
+
|
|
306
|
+
### **Using Mock Mode (No API Key)**
|
|
307
|
+
Default mode - works out of the box!
|
|
308
|
+
|
|
309
|
+
### **Using OpenAI**
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Set API key
|
|
313
|
+
export OPENAI_API_KEY=sk-...
|
|
314
|
+
|
|
315
|
+
# The AI engine will auto-detect and use GPT-4
|
|
316
|
+
dhurandhar ai -a features
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### **Using Anthropic Claude**
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Set API key
|
|
323
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
324
|
+
|
|
325
|
+
# The AI engine will use Claude 3.5 Sonnet
|
|
326
|
+
dhurandhar ai -a features
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### **Provider Selection**
|
|
330
|
+
|
|
331
|
+
The AI engine automatically selects provider:
|
|
332
|
+
1. If `ANTHROPIC_API_KEY` is set → Use Claude
|
|
333
|
+
2. Else if `OPENAI_API_KEY` is set → Use GPT-4
|
|
334
|
+
3. Else → Use Mock mode
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## 💡 **Best Practices**
|
|
339
|
+
|
|
340
|
+
1. **Use AI as a starting point** - Review and refine suggestions
|
|
341
|
+
2. **Don't blindly accept** - AI suggestions are helpful, not perfect
|
|
342
|
+
3. **Combine with expertise** - Your domain knowledge + AI = best results
|
|
343
|
+
4. **Mock mode is enough** - No API key? Mock mode works great!
|
|
344
|
+
5. **Pattern detection is automatic** - Runs during Arjuna phase
|
|
345
|
+
6. **Check improvements before blessing** - Run `ai -a improve` before Phase 8
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## 🚨 **Limitations**
|
|
350
|
+
|
|
351
|
+
- **Mock mode** is rule-based, not LLM-powered
|
|
352
|
+
- **Entity extraction** is simple noun detection
|
|
353
|
+
- **Pattern detection** is heuristic-based
|
|
354
|
+
- **Works offline** in mock mode
|
|
355
|
+
- **API costs** with OpenAI/Anthropic
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## 🔮 **Future Enhancements**
|
|
360
|
+
|
|
361
|
+
- More LLM providers (Gemini, Llama, etc.)
|
|
362
|
+
- Fine-tuned models for dharmic design
|
|
363
|
+
- Architecture recommendation
|
|
364
|
+
- Performance optimization suggestions
|
|
365
|
+
- Security vulnerability detection
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
**Next**: See [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for common issues
|
package/API_REFERENCE.md
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# Dhurandhar v2.0.0 - API Reference
|
|
2
|
+
|
|
3
|
+
Complete CLI command reference.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🎯 **Core Commands**
|
|
8
|
+
|
|
9
|
+
### **Initialize Project**
|
|
10
|
+
```bash
|
|
11
|
+
dhurandhar init
|
|
12
|
+
```
|
|
13
|
+
Creates `.dhurandhar/` directory and `SYSTEM_DESIGN_MAP.yaml`.
|
|
14
|
+
|
|
15
|
+
**Prompts**:
|
|
16
|
+
- Project name
|
|
17
|
+
- Description
|
|
18
|
+
- Project type (Web App, Mobile App, API Service, etc.)
|
|
19
|
+
- Team size
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### **Decision Registry**
|
|
24
|
+
```bash
|
|
25
|
+
dhurandhar decisions
|
|
26
|
+
```
|
|
27
|
+
View and edit Decision Registry (Ask-Once Persistence Pattern).
|
|
28
|
+
|
|
29
|
+
**Options**:
|
|
30
|
+
- View all decisions
|
|
31
|
+
- Edit naming conventions
|
|
32
|
+
- Edit error response standards
|
|
33
|
+
- Edit security standards
|
|
34
|
+
- Edit observability standards
|
|
35
|
+
|
|
36
|
+
**Categories**:
|
|
37
|
+
1. **Naming Conventions**: entities, api_endpoints, database_tables, variables, constants
|
|
38
|
+
2. **Error Response Standards**: envelope_format, status_codes
|
|
39
|
+
3. **Security Standards**: rate_limit, session_timeout, password requirements
|
|
40
|
+
4. **Observability Standards**: metrics_prefix, log_format, trace_enabled, alert_thresholds
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 👑 **Phase Commands (8 Master Agents)**
|
|
45
|
+
|
|
46
|
+
### **Phase 1: Yudhishthira (Features)**
|
|
47
|
+
```bash
|
|
48
|
+
dhurandhar yudhishthira
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Modes**:
|
|
52
|
+
1. **Brainstorming Mode** - Solo feature ideation with dharmic evaluation
|
|
53
|
+
2. **Party Mode** - Multi-stakeholder voting (6 personas)
|
|
54
|
+
3. **Manage Decision Registry** - Edit standards
|
|
55
|
+
|
|
56
|
+
**Dharmic Evaluation** (5 questions):
|
|
57
|
+
- Satya (Truth)
|
|
58
|
+
- Ahimsa (Non-harm)
|
|
59
|
+
- Artha (Value)
|
|
60
|
+
- Karma (Action)
|
|
61
|
+
- Moksha (Liberation)
|
|
62
|
+
|
|
63
|
+
**Output**: Features with dharmic scores and categories
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### **Phase 2: Bhishma (Requirements)**
|
|
68
|
+
```bash
|
|
69
|
+
dhurandhar bhishma
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Functions**:
|
|
73
|
+
1. Extract Functional Requirements (from features)
|
|
74
|
+
2. Define NFRs (Performance, Security, Reliability, Scalability, Maintainability)
|
|
75
|
+
3. Specify Constraints (Technical, Business, Security, Performance, Regulatory, Legacy)
|
|
76
|
+
4. Define Trade-offs
|
|
77
|
+
|
|
78
|
+
**Auto-population**: NFRs pre-filled from Decision Registry
|
|
79
|
+
|
|
80
|
+
**Output**: Complete requirements specification with constraints
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### **Phase 3: Sahadeva (Entities & Domain)**
|
|
85
|
+
```bash
|
|
86
|
+
dhurandhar sahadeva
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Functions**:
|
|
90
|
+
1. Model Entities (attributes, identity, lifecycle)
|
|
91
|
+
2. Define Relationships (one-to-one, one-to-many, many-to-many)
|
|
92
|
+
3. Define Aggregates (root, members, boundary)
|
|
93
|
+
4. Apply Cosmic Patterns (Duality, Lifecycle Orbit, Cosmic Invariant)
|
|
94
|
+
|
|
95
|
+
**Registry Enforcement**: Entity/table naming conventions
|
|
96
|
+
**Constraints**: Technical, Legacy constraints displayed
|
|
97
|
+
|
|
98
|
+
**Output**: Domain model with entities, relationships, aggregates, cosmic patterns
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### **Phase 4: Nakula (APIs)**
|
|
103
|
+
```bash
|
|
104
|
+
dhurandhar nakula
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Functions**:
|
|
108
|
+
1. Design API Endpoints (REST, GraphQL, gRPC)
|
|
109
|
+
2. Check Elegance Score (0-100%)
|
|
110
|
+
|
|
111
|
+
**Elegance Scoring**:
|
|
112
|
+
- Naming conventions (20 points)
|
|
113
|
+
- Hierarchy & versioning (20 points)
|
|
114
|
+
- HTTP verbs (20 points)
|
|
115
|
+
- Error handling (20 points)
|
|
116
|
+
- Consistency (20 points)
|
|
117
|
+
|
|
118
|
+
**Registry Enforcement**: API endpoint naming
|
|
119
|
+
**Constraints**: Technical, Security, Legacy constraints displayed
|
|
120
|
+
|
|
121
|
+
**Output**: API specifications with elegance scores
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### **Phase 5: Bheema (High-Level Design)**
|
|
126
|
+
```bash
|
|
127
|
+
dhurandhar bheema
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Functions**:
|
|
131
|
+
1. Service Decomposition
|
|
132
|
+
2. Define 7 Strategic Decisions:
|
|
133
|
+
- Persistence Strategy
|
|
134
|
+
- Communication Strategy
|
|
135
|
+
- Security Strategy
|
|
136
|
+
- Resilience Strategy
|
|
137
|
+
- Deployment Strategy
|
|
138
|
+
- Observability Strategy
|
|
139
|
+
- Scalability Strategy
|
|
140
|
+
3. Review all strategies
|
|
141
|
+
|
|
142
|
+
**Registry Validation**: Observability strategy vs registry
|
|
143
|
+
**Constraint Validation**: Real-time violation warnings with user confirmation
|
|
144
|
+
**Constraints**: ALL constraint types displayed
|
|
145
|
+
|
|
146
|
+
**Output**: Service architecture + 7 strategic decisions
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### **Phase 6: Arjuna (Low-Level Design)**
|
|
151
|
+
```bash
|
|
152
|
+
dhurandhar arjuna
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Functions**:
|
|
156
|
+
1. Class Design (name, type, methods, properties)
|
|
157
|
+
2. Sequence Diagrams (flows, actors, steps)
|
|
158
|
+
3. Database Schema Design (auto-generated from entities)
|
|
159
|
+
4. Algorithm Design
|
|
160
|
+
|
|
161
|
+
**Precision Scoring**:
|
|
162
|
+
- Class naming (20 points)
|
|
163
|
+
- Methods (20 points)
|
|
164
|
+
- Properties (15 points)
|
|
165
|
+
- Cohesion (25 points)
|
|
166
|
+
- SOLID principles (20 points)
|
|
167
|
+
|
|
168
|
+
**Registry Enforcement**: Class/method/variable naming
|
|
169
|
+
**Constraints**: Technical, Security, Performance, Legacy constraints
|
|
170
|
+
|
|
171
|
+
**Output**: Detailed class designs with precision scores, DB schemas
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### **Phase 7: Bheema (Implementation)**
|
|
176
|
+
```bash
|
|
177
|
+
dhurandhar bheema # Auto-detects Phase 7 mode
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Functions**:
|
|
181
|
+
1. Plan Backend Code Generation
|
|
182
|
+
2. Plan Frontend Code Generation
|
|
183
|
+
3. Plan Test Generation
|
|
184
|
+
4. Plan Infrastructure Setup
|
|
185
|
+
5. Handle Edge Cases
|
|
186
|
+
|
|
187
|
+
**Output**: Implementation roadmap with code generation plan
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### **Phase 8: Draupadi (Review & Audit)**
|
|
192
|
+
```bash
|
|
193
|
+
dhurandhar draupadi
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Modes**:
|
|
197
|
+
1. **Drift Detection** - Design vs implementation alignment
|
|
198
|
+
2. **Compliance Check** - Standards validation (including Decision Registry)
|
|
199
|
+
3. **Quality Scoring** - Overall quality assessment
|
|
200
|
+
4. **Dharmic Audit** - Dark patterns, privacy, user service
|
|
201
|
+
5. **Imperial Blessing** - Final approval from Yudhishthira
|
|
202
|
+
6. **Generate Report** - Comprehensive audit document
|
|
203
|
+
|
|
204
|
+
**Blessing Criteria**:
|
|
205
|
+
- Drift < 25%
|
|
206
|
+
- Quality >= 70%
|
|
207
|
+
- No dark patterns
|
|
208
|
+
- No privacy violations
|
|
209
|
+
- Decision Registry compliant
|
|
210
|
+
- Constraint satisfaction >= 80%
|
|
211
|
+
|
|
212
|
+
**Output**: Audit report + Imperial Blessing (if worthy)
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 🔍 **Review Command**
|
|
217
|
+
|
|
218
|
+
### **Cascading Review**
|
|
219
|
+
```bash
|
|
220
|
+
dhurandhar review -p <phase-name>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Phase Names**:
|
|
224
|
+
- `requirements-engineering` (Phase 2)
|
|
225
|
+
- `entities-and-domain` (Phase 3)
|
|
226
|
+
- `api-design` (Phase 4)
|
|
227
|
+
- `high-level-design` (Phase 5)
|
|
228
|
+
- `low-level-design` (Phase 6)
|
|
229
|
+
- `implementation` (Phase 7)
|
|
230
|
+
- `review-and-audit` (Phase 8)
|
|
231
|
+
|
|
232
|
+
**Output**: Review results with issues, recommendations, status (approved/advisory/needs_revision)
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 📁 **Output Files**
|
|
237
|
+
|
|
238
|
+
### **SYSTEM_DESIGN_MAP.yaml**
|
|
239
|
+
Complete system design in structured YAML:
|
|
240
|
+
- Project metadata
|
|
241
|
+
- Features with dharmic evaluation
|
|
242
|
+
- Requirements (FR, NFR, constraints)
|
|
243
|
+
- Entities, relationships, aggregates
|
|
244
|
+
- APIs with elegance scores
|
|
245
|
+
- Services with 7 strategic decisions
|
|
246
|
+
- Classes with precision scores
|
|
247
|
+
- Database schemas
|
|
248
|
+
- Implementation status
|
|
249
|
+
- Audit results
|
|
250
|
+
- Imperial blessing
|
|
251
|
+
- Reviews history
|
|
252
|
+
|
|
253
|
+
### **.dhurandhar/config.json**
|
|
254
|
+
Project configuration and Decision Registry.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## 🎨 **Examples**
|
|
259
|
+
|
|
260
|
+
### **Complete Workflow**
|
|
261
|
+
```bash
|
|
262
|
+
# 1. Initialize
|
|
263
|
+
dhurandhar init
|
|
264
|
+
|
|
265
|
+
# 2. Features (Party Mode)
|
|
266
|
+
dhurandhar yudhishthira
|
|
267
|
+
|
|
268
|
+
# 3. Requirements
|
|
269
|
+
dhurandhar bhishma
|
|
270
|
+
dhurandhar review -p requirements-engineering
|
|
271
|
+
|
|
272
|
+
# 4. Entities
|
|
273
|
+
dhurandhar sahadeva
|
|
274
|
+
dhurandhar review -p entities-and-domain
|
|
275
|
+
|
|
276
|
+
# 5. APIs
|
|
277
|
+
dhurandhar nakula
|
|
278
|
+
dhurandhar review -p api-design
|
|
279
|
+
|
|
280
|
+
# 6. HLD
|
|
281
|
+
dhurandhar bheema
|
|
282
|
+
dhurandhar review -p high-level-design
|
|
283
|
+
|
|
284
|
+
# 7. LLD
|
|
285
|
+
dhurandhar arjuna
|
|
286
|
+
dhurandhar review -p low-level-design
|
|
287
|
+
|
|
288
|
+
# 8. Implementation
|
|
289
|
+
dhurandhar bheema
|
|
290
|
+
dhurandhar review -p implementation
|
|
291
|
+
|
|
292
|
+
# 9. Audit + Blessing
|
|
293
|
+
dhurandhar draupadi
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Result**: Complete `SYSTEM_DESIGN_MAP.yaml` with Imperial Blessing!
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
**For detailed examples, see**: `DEMO_WALKTHROUGH.md`
|