@eldrforge/kodrdriv 1.2.132 → 1.2.133

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,530 @@
1
+ # Monorepo Guide
2
+
3
+ Complete guide to using kodrdriv in monorepo projects.
4
+
5
+ ## Monorepo Support
6
+
7
+ Kodrdriv is designed for monorepos with:
8
+ - Multiple packages with interdependencies
9
+ - Shared configuration across packages
10
+ - Coordinated releases
11
+ - Parallel execution where possible
12
+
13
+ ## Quick Start for Monorepos
14
+
15
+ ### 1. Setup
16
+
17
+ ```bash
18
+ # Install kodrdriv in root
19
+ npm install -g @eldrforge/kodrdriv
20
+
21
+ # Configure for monorepo
22
+ kodrdriv --init-config
23
+ ```
24
+
25
+ ### 2. Configure Tree
26
+
27
+ ```yaml
28
+ # .kodrdriv/config.yaml
29
+ tree:
30
+ directories:
31
+ - packages/core
32
+ - packages/utils
33
+ - packages/api
34
+ - packages/ui
35
+ parallel: true
36
+ maxConcurrency: 4
37
+ ```
38
+
39
+ ### 3. Development Workflow
40
+
41
+ ```bash
42
+ # Link packages for local development
43
+ kodrdriv tree link
44
+
45
+ # Develop...
46
+
47
+ # Run checks
48
+ kodrdriv tree precommit --parallel
49
+
50
+ # Commit
51
+ kodrdriv tree commit
52
+
53
+ # Publish
54
+ kodrdriv tree publish --parallel
55
+ ```
56
+
57
+ ## Typical Monorepo Structure
58
+
59
+ ```
60
+ my-monorepo/
61
+ ├── package.json # Root package
62
+ ├── .kodrdriv/
63
+ │ └── config.yaml # Shared configuration
64
+ ├── packages/
65
+ │ ├── core/
66
+ │ │ ├── package.json # "@org/core"
67
+ │ │ └── src/
68
+ │ ├── utils/
69
+ │ │ ├── package.json # "@org/utils" (depends on core)
70
+ │ │ └── src/
71
+ │ ├── api/
72
+ │ │ ├── package.json # "@org/api" (depends on core, utils)
73
+ │ │ └── src/
74
+ │ └── ui/
75
+ │ ├── package.json # "@org/ui" (depends on all)
76
+ │ └── src/
77
+ └── output/ # Shared output directory
78
+ ```
79
+
80
+ ## Development Workflows
81
+
82
+ ### Daily Development with Linking
83
+
84
+ ```bash
85
+ # One-time setup: Link all packages
86
+ kodrdriv tree link
87
+
88
+ # Develop normally - changes reflected immediately
89
+ cd packages/core
90
+ # ... edit files ...
91
+ cd ../utils
92
+ # ... use updated core ...
93
+
94
+ # Run checks across all packages
95
+ kodrdriv tree precommit --parallel
96
+
97
+ # Commit when ready
98
+ kodrdriv tree commit --add --sendit
99
+
100
+ # When done with feature: Unlink
101
+ kodrdriv tree unlink
102
+ ```
103
+
104
+ **Benefits**:
105
+ - Instant updates across packages
106
+ - No build/publish cycle for testing
107
+ - Real-time integration testing
108
+
109
+ ### Coordinated Releases
110
+
111
+ ```bash
112
+ # Check what needs releasing
113
+ kodrdriv tree publish --dry-run
114
+
115
+ # Generate release notes for all
116
+ kodrdriv tree publish --context-files RELEASE-NOTES.md --dry-run
117
+
118
+ # Publish with review
119
+ kodrdriv tree publish --interactive
120
+
121
+ # Automated publish
122
+ kodrdriv tree publish --sendit --parallel
123
+ ```
124
+
125
+ ### Dependency Updates
126
+
127
+ ```bash
128
+ # Update inter-project dependencies
129
+ kodrdriv updates --inter-project @org
130
+
131
+ # Update external dependencies in all packages
132
+ kodrdriv tree --cmd "npm update"
133
+
134
+ # Update specific scope across all
135
+ kodrdriv updates @external-scope
136
+ ```
137
+
138
+ ## Package Dependency Patterns
139
+
140
+ ### Independent Packages
141
+
142
+ ```
143
+ core (v1.0.0) utils (v1.0.0)
144
+ ↓ ↓
145
+ No dependencies between them
146
+ → Can publish in parallel
147
+ ```
148
+
149
+ ```bash
150
+ kodrdriv tree publish --parallel --max-concurrency 2
151
+ # Both publish simultaneously
152
+ ```
153
+
154
+ ### Linear Dependencies
155
+
156
+ ```
157
+ core (v1.0.0)
158
+ ↓ depends on
159
+ utils (v1.0.0)
160
+ ↓ depends on
161
+ api (v1.0.0)
162
+ ```
163
+
164
+ ```bash
165
+ kodrdriv tree publish
166
+ # Publishes: core → utils → api (sequential)
167
+ ```
168
+
169
+ ### Diamond Dependencies
170
+
171
+ ```
172
+ core
173
+ ↙ ↘
174
+ utils api
175
+ ↘ ↙
176
+ ui
177
+ ```
178
+
179
+ ```bash
180
+ kodrdriv tree publish --parallel --max-concurrency 2
181
+ # Level 0: core
182
+ # Level 1: utils, api (parallel)
183
+ # Level 2: ui
184
+ ```
185
+
186
+ ## Version Management
187
+
188
+ ### Synchronized Versions
189
+
190
+ All packages share same version:
191
+
192
+ ```yaml
193
+ # Each package.json
194
+ {
195
+ "version": "1.0.0"
196
+ }
197
+ ```
198
+
199
+ ```bash
200
+ # Bump all together
201
+ kodrdriv tree --cmd "npm version patch"
202
+ ```
203
+
204
+ ### Independent Versions
205
+
206
+ Each package has its own version:
207
+
208
+ ```bash
209
+ # Publish updates only changed packages
210
+ kodrdriv tree publish --skip-already-published
211
+ ```
212
+
213
+ ### Inter-Project Dependencies
214
+
215
+ Update dependencies before publish:
216
+
217
+ ```bash
218
+ # Update all @org dependencies
219
+ kodrdriv tree publish --update-deps @org
220
+ ```
221
+
222
+ Automatically updates `package.json` dependencies to latest versions.
223
+
224
+ ## Configuration Strategies
225
+
226
+ ### Shared Configuration
227
+
228
+ Root `.kodrdriv/config.yaml` applies to all packages:
229
+
230
+ ```yaml
231
+ model: gpt-4o
232
+ outputDirectory: output
233
+
234
+ commit:
235
+ selfReflection: true
236
+
237
+ tree:
238
+ directories:
239
+ - packages/core
240
+ - packages/api
241
+ - packages/ui
242
+ parallel: true
243
+ ```
244
+
245
+ ### Per-Package Configuration
246
+
247
+ Override in individual packages:
248
+
249
+ ```yaml
250
+ # packages/core/.kodrdriv/config.yaml
251
+ commit:
252
+ maxAgenticIterations: 15 # More thorough for core
253
+
254
+ release:
255
+ focus: "API changes and breaking changes"
256
+ ```
257
+
258
+ ## Workflow Examples
259
+
260
+ ### Example 1: Feature Development
261
+
262
+ ```bash
263
+ # Day 1: Start feature
264
+ git checkout -b feature/new-auth
265
+ kodrdriv tree link
266
+
267
+ # Work on packages
268
+ cd packages/core
269
+ # ... implement core auth ...
270
+ cd ../api
271
+ # ... add API endpoints ...
272
+ cd ../ui
273
+ # ... add UI components ...
274
+
275
+ # Day 2: Testing
276
+ kodrdriv tree precommit --parallel
277
+
278
+ # Day 3: Commit
279
+ cd ../.. # Back to root
280
+ kodrdriv tree commit --context-files FEATURE-NOTES.md
281
+
282
+ # Day 4: PR
283
+ git push origin feature/new-auth
284
+ ```
285
+
286
+ ### Example 2: Release Cycle
287
+
288
+ ```bash
289
+ # Week 1-4: Development with commits
290
+ kodrdriv tree link
291
+ # ... develop ...
292
+ kodrdriv tree commit --add --sendit
293
+
294
+ # Week 5: Prepare release
295
+ kodrdriv tree unlink
296
+ kodrdriv tree precommit --parallel
297
+
298
+ # Generate notes
299
+ kodrdriv tree publish --dry-run --context-files CHANGELOG.md
300
+
301
+ # Publish
302
+ kodrdriv tree publish --parallel --interactive
303
+ ```
304
+
305
+ ### Example 3: Hotfix
306
+
307
+ ```bash
308
+ # Create hotfix branch
309
+ git checkout -b hotfix/security main
310
+
311
+ # Fix in affected package
312
+ cd packages/core
313
+ # ... fix security issue ...
314
+
315
+ # Quick commit
316
+ cd ../..
317
+ kodrdriv commit --sendit
318
+
319
+ # Publish just core
320
+ cd packages/core
321
+ kodrdriv publish --target-version patch --sendit
322
+
323
+ # Or publish tree with skip
324
+ cd ../..
325
+ kodrdriv tree publish --start-from @org/core --stop-at @org/api
326
+ ```
327
+
328
+ ## Dependency Scenarios
329
+
330
+ ### Scenario 1: New Package
331
+
332
+ ```bash
333
+ # Add new package
334
+ mkdir packages/new-package
335
+ cd packages/new-package
336
+ npm init -y
337
+
338
+ # Add dependencies
339
+ npm install @org/core
340
+
341
+ # Link in monorepo
342
+ cd ../..
343
+ kodrdriv tree link
344
+ ```
345
+
346
+ ### Scenario 2: Remove Package
347
+
348
+ ```bash
349
+ # Remove from tree config
350
+ # Edit .kodrdriv/config.yaml, remove from directories
351
+
352
+ # Unpublish from npm (careful!)
353
+ npm unpublish @org/removed-package
354
+
355
+ # Remove directory
356
+ rm -rf packages/removed-package
357
+ ```
358
+
359
+ ### Scenario 3: Circular Dependency
360
+
361
+ **Problem**:
362
+ ```
363
+ core → utils → core # Circular!
364
+ ```
365
+
366
+ **Solution**: Restructure to break cycle:
367
+ ```
368
+ core → utils
369
+ shared ← (both depend on shared)
370
+ ```
371
+
372
+ ## Best Practices
373
+
374
+ ### 1. Use Link for Development
375
+
376
+ ```bash
377
+ # Start of day
378
+ kodrdriv tree link
379
+
380
+ # End of day (before publish)
381
+ kodrdriv tree unlink
382
+ ```
383
+
384
+ ### 2. Run Precommit Often
385
+
386
+ ```bash
387
+ # Before commits
388
+ kodrdriv tree precommit --parallel
389
+
390
+ # Catches issues early
391
+ ```
392
+
393
+ ### 3. Use Parallel for Speed
394
+
395
+ ```bash
396
+ # For IO-bound operations
397
+ kodrdriv tree precommit --parallel --max-concurrency 4
398
+
399
+ # For CPU-bound
400
+ kodrdriv tree --cmd "npm run build" --parallel --max-concurrency 2
401
+ ```
402
+
403
+ ### 4. Enable Checkpoints
404
+
405
+ Automatic for `publish` and `run` commands. Use `--continue` to resume.
406
+
407
+ ### 5. Context Files for Releases
408
+
409
+ ```bash
410
+ # Provide migration context
411
+ kodrdriv tree publish --context-files MIGRATION.md BREAKING-CHANGES.md
412
+ ```
413
+
414
+ ## Monorepo Tools Comparison
415
+
416
+ | Feature | Lerna | nx | Rush | kodrdriv |
417
+ |---------|-------|----|----|----------|
418
+ | Dependency analysis | ✅ | ✅ | ✅ | ✅ |
419
+ | Parallel execution | ✅ | ✅ | ✅ | ✅ |
420
+ | AI commit messages | ❌ | ❌ | ❌ | ✅ |
421
+ | AI release notes | ❌ | ❌ | ❌ | ✅ |
422
+ | Full publish workflow | ❌ | ❌ | ❌ | ✅ |
423
+ | Recovery/checkpoints | ❌ | ❌ | ❌ | ✅ |
424
+
425
+ ## Advanced Patterns
426
+
427
+ ### Pattern 1: Staged Releases
428
+
429
+ ```bash
430
+ # Week 1: Release core
431
+ kodrdriv publish
432
+ cd packages/core
433
+ kodrdriv publish --sendit
434
+
435
+ # Week 2: Release dependents
436
+ kodrdriv tree publish --start-from @org/utils
437
+ ```
438
+
439
+ ### Pattern 2: Selective Updates
440
+
441
+ ```bash
442
+ # Update only changed packages
443
+ kodrdriv tree publish \
444
+ --skip-already-published \
445
+ --parallel
446
+ ```
447
+
448
+ ### Pattern 3: Branch-Based Versioning
449
+
450
+ ```yaml
451
+ branches:
452
+ develop:
453
+ targetBranch: main
454
+ version:
455
+ type: prerelease
456
+ tag: dev
457
+
458
+ staging:
459
+ targetBranch: main
460
+ version:
461
+ type: prerelease
462
+ tag: rc
463
+ ```
464
+
465
+ ```bash
466
+ # On develop: publishes 1.0.0-dev.0
467
+ kodrdriv tree publish
468
+
469
+ # On staging: publishes 1.0.0-rc.0
470
+ kodrdriv tree publish
471
+ ```
472
+
473
+ ## Troubleshooting Monorepos
474
+
475
+ ### Issue: Package Not Publishing
476
+
477
+ **Check**:
478
+ ```bash
479
+ # Verify package is in tree
480
+ kodrdriv tree publish --dry-run --verbose
481
+
482
+ # Check version
483
+ cd packages/problem-package
484
+ npm version
485
+
486
+ # Check if already published
487
+ npm view @org/problem-package versions
488
+ ```
489
+
490
+ ### Issue: Dependency Resolution
491
+
492
+ **Check**:
493
+ ```bash
494
+ # View dependency graph
495
+ kodrdriv tree publish --debug | grep -A 20 "Dependency"
496
+
497
+ # Verify package.json
498
+ cat packages/*/package.json | grep -A 3 dependencies
499
+ ```
500
+
501
+ ### Issue: Parallel Deadlock
502
+
503
+ **Symptoms**: Parallel execution hangs
504
+
505
+ **Solution**:
506
+ ```bash
507
+ # Check status
508
+ kodrdriv tree publish --status-parallel
509
+
510
+ # Kill and restart with sequential
511
+ kodrdriv tree publish
512
+ ```
513
+
514
+ ## Documentation References
515
+
516
+ Comprehensive guides in root directory:
517
+ - `TREE-TOOLKIT-COMPLETE.md` - Tree system implementation
518
+ - `MONOREPO-PUBLISH-IMPROVEMENTS.md` - Monorepo workflows
519
+ - `PARALLEL-PUBLISH-DEBUGGING-GUIDE.md` - Troubleshooting
520
+ - `CHECKPOINT-RECOVERY-FIX.md` - Recovery system
521
+
522
+ ## Next Steps
523
+
524
+ - **[Tree Operations Guide](./tree-operations.md)** - Tree command details
525
+ - **[Configuration Guide](./configuration.md)** - Tree configuration
526
+ - **[Debugging Guide](./debugging.md)** - Troubleshoot tree issues
527
+ - **[Architecture Guide](./architecture.md)** - System design
528
+
529
+ Kodrdriv makes monorepo management straightforward and automated!
530
+