dhurandhar 1.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.
Files changed (54) hide show
  1. package/.dhurandhar-session-start.md +242 -0
  2. package/LICENSE +21 -0
  3. package/README.md +416 -0
  4. package/docs/ARCHITECTURE_V2.md +249 -0
  5. package/docs/DECISION_REGISTRY.md +357 -0
  6. package/docs/IMPLEMENTATION_PERSONAS.md +406 -0
  7. package/docs/PLUGGABLE_STRATEGIES.md +439 -0
  8. package/docs/SYSTEM_OBSERVER.md +433 -0
  9. package/docs/TEST_FIRST_AGILE.md +359 -0
  10. package/docs/architecture.md +279 -0
  11. package/docs/engineering-first-philosophy.md +263 -0
  12. package/docs/getting-started.md +218 -0
  13. package/docs/module-development.md +323 -0
  14. package/docs/strategy-example.md +299 -0
  15. package/docs/test-first-example.md +392 -0
  16. package/package.json +79 -0
  17. package/src/core/README.md +92 -0
  18. package/src/core/agent-instructions/backend-developer.md +412 -0
  19. package/src/core/agent-instructions/devops-engineer.md +372 -0
  20. package/src/core/agent-instructions/dhurandhar-council.md +547 -0
  21. package/src/core/agent-instructions/edge-case-hunter.md +322 -0
  22. package/src/core/agent-instructions/frontend-developer.md +494 -0
  23. package/src/core/agent-instructions/lead-system-architect.md +631 -0
  24. package/src/core/agent-instructions/system-observer.md +319 -0
  25. package/src/core/agent-instructions/test-architect.md +284 -0
  26. package/src/core/module.yaml +54 -0
  27. package/src/core/schemas/design-module-schema.yaml +995 -0
  28. package/src/core/schemas/system-design-map-schema.yaml +324 -0
  29. package/src/modules/example/README.md +130 -0
  30. package/src/modules/example/module.yaml +252 -0
  31. package/tools/cli/commands/audit.js +267 -0
  32. package/tools/cli/commands/config.js +113 -0
  33. package/tools/cli/commands/context.js +170 -0
  34. package/tools/cli/commands/decisions.js +398 -0
  35. package/tools/cli/commands/entity.js +218 -0
  36. package/tools/cli/commands/epic.js +125 -0
  37. package/tools/cli/commands/install.js +172 -0
  38. package/tools/cli/commands/module.js +109 -0
  39. package/tools/cli/commands/service.js +167 -0
  40. package/tools/cli/commands/story.js +225 -0
  41. package/tools/cli/commands/strategy.js +294 -0
  42. package/tools/cli/commands/test.js +277 -0
  43. package/tools/cli/commands/validate.js +107 -0
  44. package/tools/cli/dhurandhar.js +212 -0
  45. package/tools/lib/config-manager.js +170 -0
  46. package/tools/lib/filesystem.js +126 -0
  47. package/tools/lib/module-installer.js +61 -0
  48. package/tools/lib/module-manager.js +149 -0
  49. package/tools/lib/sdm-manager.js +982 -0
  50. package/tools/lib/test-engine.js +255 -0
  51. package/tools/lib/test-templates/api-client.template.js +100 -0
  52. package/tools/lib/test-templates/vitest.config.template.js +37 -0
  53. package/tools/lib/validators/config-validator.js +113 -0
  54. package/tools/lib/validators/module-validator.js +137 -0
@@ -0,0 +1,263 @@
1
+ # Engineering-First Philosophy
2
+
3
+ ## Problem Statement
4
+
5
+ Traditional system design frameworks suffer from:
6
+
7
+ 1. **Cognitive Fatigue**: Excessive philosophical prompting ("Why do you need this?")
8
+ 2. **Architectural Drift**: Lost context between sessions requires rediscovery
9
+ 3. **Justification Loops**: Endless "have you considered..." discussions
10
+ 4. **Business-Process Heavy**: Focus on stakeholders over technical implementation
11
+
12
+ ## Dhurandhar's Solution
13
+
14
+ ### 1. Engineering First, Not Business First
15
+
16
+ ❌ **Traditional Approach**:
17
+ ```
18
+ Agent: "Why do you need an authentication service?"
19
+ User: "For user login"
20
+ Agent: "What are your authentication requirements?"
21
+ User: "JWT tokens"
22
+ Agent: "Have you considered OAuth2?"
23
+ User: "No, I want JWT"
24
+ Agent: "What's the business value?"
25
+ User: "Just add JWT auth!"
26
+ Agent: "Let's explore the requirements together..."
27
+ ```
28
+
29
+ ✅ **Dhurandhar Approach**:
30
+ ```
31
+ User: "Add auth service"
32
+ Agent: [Checks SDM for primary language: Go]
33
+ Agent: "Framework: Echo, Gin, or Fiber?"
34
+ User: "Echo"
35
+ Agent: "Database: PostgreSQL or Redis?"
36
+ User: "PostgreSQL"
37
+ Agent: "✓ auth-service added: Go/Echo/PostgreSQL on port 8080"
38
+ ```
39
+
40
+ **3 questions. Done. No justifications.**
41
+
42
+ ### 2. Direct Action Over Discovery
43
+
44
+ **Principle**: When a user requests something, they've already made the decision.
45
+
46
+ Your job: Get technical specs and implement.
47
+ Not your job: Question the decision.
48
+
49
+ **Max 3 Technical Questions** per component:
50
+ 1. Technology choice (if not obvious from context)
51
+ 2. Integration point
52
+ 3. Configuration detail
53
+
54
+ Then implement. No further discussion unless explicitly requested.
55
+
56
+ ### 3. Persistent Context via SDM
57
+
58
+ **Problem**: Context loss between sessions
59
+
60
+ ```
61
+ Session 1:
62
+ User: "Add user service with PostgreSQL"
63
+ Agent: "Done"
64
+
65
+ [New session starts]
66
+
67
+ Session 2:
68
+ User: "Add posts that belong to users"
69
+ Agent: "What database are you using?" ← COGNITIVE FATIGUE
70
+ User: "I told you last time! PostgreSQL!"
71
+ ```
72
+
73
+ **Solution**: System Design Map
74
+
75
+ ```
76
+ Session 1:
77
+ User: "Add user service with PostgreSQL"
78
+ Agent: "✓ Updated SYSTEM_DESIGN_MAP.yaml"
79
+
80
+ [New session starts]
81
+
82
+ Session 2:
83
+ Agent: [Reads SDM - sees PostgreSQL, User entity exists]
84
+ User: "Add posts that belong to users"
85
+ Agent: "✓ Post entity added with user_id foreign key"
86
+ ```
87
+
88
+ No rediscovery. No cognitive fatigue.
89
+
90
+ ### 4. Implementation Focus
91
+
92
+ Focus on:
93
+ - **What**: Component name and purpose
94
+ - **How**: Tech stack, API, database
95
+ - **Where**: Integration points
96
+
97
+ Ignore:
98
+ - **Why**: Business justification
99
+ - **Who**: Stakeholders
100
+ - **When**: Timeline (not architecture concern)
101
+
102
+ ### 5. Tech Stack Mandated Upfront
103
+
104
+ On framework initialization (3 questions only):
105
+ 1. Architecture type: microservices/monolith/serverless
106
+ 2. Primary language: Go/TypeScript/Python/Rust/Java
107
+ 3. Done.
108
+
109
+ All subsequent services inherit sensible defaults:
110
+ - Go → Echo framework, PostgreSQL
111
+ - TypeScript → Express, PostgreSQL
112
+ - Python → FastAPI, PostgreSQL
113
+
114
+ No framework debates for every service.
115
+
116
+ ## Workflow Comparison
117
+
118
+ ### Traditional (Business-Heavy)
119
+
120
+ ```
121
+ 1. Discovery phase (30 minutes)
122
+ - What's the business problem?
123
+ - Who are the stakeholders?
124
+ - What are the requirements?
125
+ - Have you considered alternatives?
126
+
127
+ 2. Requirements documentation (1 hour)
128
+ - User stories
129
+ - Acceptance criteria
130
+ - Business value analysis
131
+
132
+ 3. Architecture discussion (1 hour)
133
+ - Explore options
134
+ - Pros/cons analysis
135
+ - Technology evaluation
136
+
137
+ 4. Finally: Add service (5 minutes)
138
+
139
+ Total: 2.5 hours for one service
140
+ ```
141
+
142
+ ### Dhurandhar (Engineering-First)
143
+
144
+ ```
145
+ 1. Check SDM for context (5 seconds)
146
+ 2. Ask 3 technical questions (30 seconds)
147
+ 3. Add service to SDM (10 seconds)
148
+ 4. Confirm (5 seconds)
149
+
150
+ Total: 50 seconds for one service
151
+ ```
152
+
153
+ **300x faster.**
154
+
155
+ ## Anti-Patterns to Avoid
156
+
157
+ ### ❌ Justification Loop
158
+ ```
159
+ Agent: "Why do you need Redis?"
160
+ User: "For caching"
161
+ Agent: "What's your caching strategy?"
162
+ User: "LRU with 1 hour TTL"
163
+ Agent: "Have you measured cache hit rates?"
164
+ User: "No, I just want caching!"
165
+ Agent: "Let's define metrics first..."
166
+ ```
167
+
168
+ ### ❌ Alternative Exploration
169
+ ```
170
+ User: "Use PostgreSQL"
171
+ Agent: "Have you considered MongoDB?"
172
+ User: "No"
173
+ Agent: "What about MySQL?"
174
+ User: "No, PostgreSQL"
175
+ Agent: "But MongoDB might be better for..."
176
+ ```
177
+
178
+ ### ❌ Requirements Gathering
179
+ ```
180
+ User: "Add user service"
181
+ Agent: "Let's gather requirements first.
182
+ What fields does a user have?
183
+ What operations are needed?
184
+ What's the expected load?
185
+ What's the data retention policy?..."
186
+ ```
187
+
188
+ ## Engineering-First Patterns
189
+
190
+ ### ✅ Direct Technical Questions
191
+ ```
192
+ User: "Add caching"
193
+ Agent: "Cache: Redis or Memcached?"
194
+ User: "Redis"
195
+ Agent: "✓ Redis added to infrastructure"
196
+ ```
197
+
198
+ ### ✅ Context-Aware Defaults
199
+ ```
200
+ User: "Add payment service"
201
+ Agent: [Checks SDM - primary language is Go, using Echo/PostgreSQL]
202
+ Agent: "✓ payment-service added: Go/Echo/PostgreSQL on port 8082"
203
+ Agent: [Auto-incremented port based on existing services]
204
+ ```
205
+
206
+ ### ✅ Minimal Confirmation
207
+ ```
208
+ User: "Add User entity"
209
+ Agent: "✓ User entity added (5 attributes)"
210
+ ```
211
+
212
+ ## Implementation Rules
213
+
214
+ 1. **Always read SDM first** before asking any questions
215
+ 2. **Max 3 questions** per architectural component
216
+ 3. **Technical questions only** (language/database/protocol)
217
+ 4. **Brief confirmations** (one line)
218
+ 5. **Update SDM immediately** after changes
219
+ 6. **No "why" questions** unless architectural conflict exists
220
+
221
+ ## Session Management
222
+
223
+ ### Starting New Session
224
+
225
+ ```
226
+ Agent initialization:
227
+ 1. Read SYSTEM_DESIGN_MAP.yaml
228
+ 2. Load architecture context
229
+ 3. Display brief summary
230
+ 4. Ready for commands
231
+
232
+ Agent: "Rehydrated from SDM:
233
+ - 3 services (Go/Echo stack)
234
+ - 5 entities
235
+ - Microservices architecture
236
+ Ready. What's next?"
237
+ ```
238
+
239
+ ### Ending Session
240
+
241
+ ```
242
+ Agent: "Session changes:
243
+ ✓ 2 services added
244
+ ✓ 1 entity modified
245
+ All persisted to SYSTEM_DESIGN_MAP.yaml"
246
+ ```
247
+
248
+ ## Benefits
249
+
250
+ 1. **Reduced Cognitive Load**: No justification overhead
251
+ 2. **Faster Decisions**: Technical specs only
252
+ 3. **Session Continuity**: Context persists via SDM
253
+ 4. **Predictable Interactions**: Always 3 questions max
254
+ 5. **Focus on Implementation**: Build, don't plan endlessly
255
+
256
+ ## Remember
257
+
258
+ > "Engineers make technical decisions.
259
+ > Agents implement them.
260
+ > SDM persists them.
261
+ > No ceremony required."
262
+
263
+ Dhurandhar: Engineering first, ceremony last.
@@ -0,0 +1,218 @@
1
+ # Getting Started with Dhurandhar
2
+
3
+ This guide will help you get started with Dhurandhar, a framework for system design and build processes.
4
+
5
+ ## Prerequisites
6
+
7
+ Before you begin, ensure you have:
8
+
9
+ - Node.js version 20.0.0 or higher
10
+ - npm (comes with Node.js) or yarn
11
+ - A text editor (VS Code, Sublime Text, etc.)
12
+ - Basic familiarity with YAML
13
+
14
+ ## Installation
15
+
16
+ ### Step 1: Clone or Install
17
+
18
+ If you're starting a new project:
19
+
20
+ ```bash
21
+ # Clone the repository
22
+ git clone https://github.com/rweb22/dhurandhar.git
23
+ cd dhurandhar
24
+
25
+ # Install dependencies
26
+ npm install
27
+ ```
28
+
29
+ ### Step 2: Initialize Framework
30
+
31
+ Run the installation command to set up Dhurandhar in your project:
32
+
33
+ ```bash
34
+ # Interactive installation (recommended for first time)
35
+ npm run install:framework
36
+ ```
37
+
38
+ You'll be prompted for:
39
+
40
+ 1. **Project Name**: A unique identifier for your project (lowercase, alphanumeric, hyphens)
41
+ 2. **User Name**: What the framework should call you (or your team name)
42
+ 3. **Output Folder**: Where generated files should be saved (default: `_dhurandhar-output`)
43
+ 4. **Modules**: Which modules to install (at minimum, select `core`)
44
+
45
+ ### Step 3: Verify Installation
46
+
47
+ Check that everything is set up correctly:
48
+
49
+ ```bash
50
+ # Show configuration
51
+ node tools/cli/dhurandhar.js config --show
52
+
53
+ # Validate installation
54
+ node tools/cli/dhurandhar.js validate
55
+ ```
56
+
57
+ You should see:
58
+ - Configuration details displayed
59
+ - All validations passing with green checkmarks
60
+
61
+ ## Your First Design
62
+
63
+ Let's create a simple three-tier web application design.
64
+
65
+ ### Step 1: Install Example Module
66
+
67
+ ```bash
68
+ node tools/cli/dhurandhar.js module --add example
69
+ ```
70
+
71
+ This installs the example module which demonstrates a web frontend, API service, and database.
72
+
73
+ ### Step 2: Explore the Module
74
+
75
+ View the module structure:
76
+
77
+ ```bash
78
+ node tools/cli/dhurandhar.js module --info example
79
+ ```
80
+
81
+ Check the installed files in `.dhurandhar/modules/example/`
82
+
83
+ ### Step 3: Customize
84
+
85
+ Copy the example module to create your own:
86
+
87
+ 1. Create a new directory: `src/modules/my-design/`
88
+ 2. Copy `module.yaml` from the example
89
+ 3. Modify the components and relationships
90
+ 4. Install your custom module
91
+
92
+ ## Understanding the Configuration
93
+
94
+ The configuration file is located at `.dhurandhar/config.yaml`:
95
+
96
+ ```yaml
97
+ version: "0.1.0"
98
+ projectName: my-system
99
+ userName: John Doe
100
+ outputFolder: _dhurandhar-output
101
+ modules:
102
+ - core
103
+ - example
104
+ settings:
105
+ created: "2024-01-01T00:00:00.000Z"
106
+ lastModified: "2024-01-01T00:00:00.000Z"
107
+ variables:
108
+ projectRoot: /path/to/project
109
+ configDir: /path/to/project/.dhurandhar
110
+ ```
111
+
112
+ ### Key Fields
113
+
114
+ - **version**: Framework version
115
+ - **projectName**: Your project identifier
116
+ - **userName**: User or team name
117
+ - **outputFolder**: Where outputs are saved
118
+ - **modules**: List of installed modules
119
+ - **variables**: Auto-populated runtime variables
120
+
121
+ ## Next Steps
122
+
123
+ Now that you have Dhurandhar set up:
124
+
125
+ 1. **Explore Modules**: Learn about available modules
126
+ ```bash
127
+ node tools/cli/dhurandhar.js module --list
128
+ ```
129
+
130
+ 2. **Read Module Documentation**: Check out module-specific guides
131
+ - [Module Development](module-development.md)
132
+ - [Core Module](../src/core/README.md)
133
+ - [Example Module](../src/modules/example/README.md)
134
+
135
+ 3. **Create Your Design**: Start building your system architecture
136
+ - Define components
137
+ - Map relationships
138
+ - Specify build processes
139
+
140
+ 4. **Validate Regularly**: Ensure your design is consistent
141
+ ```bash
142
+ node tools/cli/dhurandhar.js validate
143
+ ```
144
+
145
+ ## Common Tasks
146
+
147
+ ### Adding a Module
148
+
149
+ ```bash
150
+ node tools/cli/dhurandhar.js module --add <module-name>
151
+ ```
152
+
153
+ ### Removing a Module
154
+
155
+ ```bash
156
+ node tools/cli/dhurandhar.js module --remove <module-name>
157
+ ```
158
+
159
+ ### Updating Configuration
160
+
161
+ ```bash
162
+ node tools/cli/dhurandhar.js config --edit
163
+ ```
164
+
165
+ ### Resetting Configuration
166
+
167
+ ```bash
168
+ node tools/cli/dhurandhar.js config --reset
169
+ ```
170
+
171
+ ## Troubleshooting
172
+
173
+ ### Command Not Found
174
+
175
+ If you get "command not found" errors:
176
+
177
+ ```bash
178
+ # Use the full path
179
+ node tools/cli/dhurandhar.js <command>
180
+
181
+ # Or use npm scripts
182
+ npm run cli -- <command>
183
+ ```
184
+
185
+ ### Module Installation Fails
186
+
187
+ Check that:
188
+ - Module dependencies are met
189
+ - Module code is valid
190
+ - Configuration is correct
191
+
192
+ Run validation:
193
+ ```bash
194
+ node tools/cli/dhurandhar.js validate --strict
195
+ ```
196
+
197
+ ### Configuration Issues
198
+
199
+ Reset to defaults:
200
+ ```bash
201
+ node tools/cli/dhurandhar.js config --reset
202
+ ```
203
+
204
+ ## Getting Help
205
+
206
+ - **CLI Help**: Run commands with `--help` flag
207
+ - **Documentation**: See the `docs/` directory
208
+ - **Examples**: Check the `examples/` directory
209
+ - **Issues**: Report bugs on GitHub
210
+
211
+ ## What's Next?
212
+
213
+ Continue learning:
214
+
215
+ - [Module Development Guide](module-development.md) - Create custom modules
216
+ - [CLI Reference](cli-reference.md) - Complete command reference
217
+ - [Configuration Guide](configuration.md) - Advanced configuration options
218
+ - [API Documentation](api.md) - Programmatic usage