@eldrforge/kodrdriv 1.2.131 → 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.
Files changed (48) hide show
  1. package/AI-GUIDE.md +834 -0
  2. package/README.md +35 -6
  3. package/agentic-reflection-commit-2025-12-27T22-56-06-143Z.md +50 -0
  4. package/agentic-reflection-commit-2025-12-27T23-01-57-294Z.md +50 -0
  5. package/agentic-reflection-commit-2025-12-27T23-11-57-811Z.md +50 -0
  6. package/agentic-reflection-commit-2025-12-27T23-12-50-645Z.md +50 -0
  7. package/agentic-reflection-commit-2025-12-27T23-13-59-347Z.md +52 -0
  8. package/agentic-reflection-commit-2025-12-27T23-14-36-001Z.md +50 -0
  9. package/agentic-reflection-commit-2025-12-27T23-18-59-832Z.md +50 -0
  10. package/agentic-reflection-commit-2025-12-27T23-25-20-667Z.md +62 -0
  11. package/dist/application.js +3 -0
  12. package/dist/application.js.map +1 -1
  13. package/dist/arguments.js +54 -21
  14. package/dist/arguments.js.map +1 -1
  15. package/dist/commands/audio-commit.js +2 -1
  16. package/dist/commands/audio-commit.js.map +1 -1
  17. package/dist/commands/audio-review.js +4 -2
  18. package/dist/commands/audio-review.js.map +1 -1
  19. package/dist/commands/commit.js +109 -288
  20. package/dist/commands/commit.js.map +1 -1
  21. package/dist/commands/publish.js +48 -6
  22. package/dist/commands/publish.js.map +1 -1
  23. package/dist/commands/release.js +79 -292
  24. package/dist/commands/release.js.map +1 -1
  25. package/dist/commands/review.js +1 -1
  26. package/dist/commands/review.js.map +1 -1
  27. package/dist/commands/tree.js +29 -33
  28. package/dist/commands/tree.js.map +1 -1
  29. package/dist/constants.js +3 -1
  30. package/dist/constants.js.map +1 -1
  31. package/dist/util/loggerAdapter.js +17 -0
  32. package/dist/util/loggerAdapter.js.map +1 -1
  33. package/dist/util/storageAdapter.js +9 -2
  34. package/dist/util/storageAdapter.js.map +1 -1
  35. package/guide/ai-system.md +519 -0
  36. package/guide/architecture.md +346 -0
  37. package/guide/commands.md +380 -0
  38. package/guide/configuration.md +513 -0
  39. package/guide/debugging.md +584 -0
  40. package/guide/development.md +629 -0
  41. package/guide/index.md +212 -0
  42. package/guide/integration.md +507 -0
  43. package/guide/monorepo.md +530 -0
  44. package/guide/quickstart.md +223 -0
  45. package/guide/testing.md +460 -0
  46. package/guide/tree-operations.md +618 -0
  47. package/guide/usage.md +575 -0
  48. package/package.json +9 -9
@@ -0,0 +1,618 @@
1
+ # Tree Operations Guide
2
+
3
+ Multi-package workflow automation.
4
+
5
+ ## Overview
6
+
7
+ Tree operations execute commands across multiple packages in a workspace, respecting dependency order. Essential for monorepos and multi-package projects.
8
+
9
+ ## Core Concept
10
+
11
+ ```
12
+ Workspace
13
+ ├── packages/core (no dependencies)
14
+ ├── packages/utils (depends on core)
15
+ └── packages/ui (depends on core, utils)
16
+
17
+ Execution order: core → utils → ui
18
+ ```
19
+
20
+ Kodrdriv automatically:
21
+ 1. Discovers packages
22
+ 2. Analyzes dependencies
23
+ 3. Determines execution order
24
+ 4. Executes in topologically sorted order
25
+
26
+ ## Basic Usage
27
+
28
+ ### Sequential Execution
29
+
30
+ ```bash
31
+ # Run command in all packages
32
+ kodrdriv tree --cmd "npm test"
33
+
34
+ # Built-in commands
35
+ kodrdriv tree commit
36
+ kodrdriv tree publish
37
+ kodrdriv tree precommit
38
+ kodrdriv tree link
39
+ kodrdriv tree unlink
40
+ ```
41
+
42
+ ### Parallel Execution
43
+
44
+ ```bash
45
+ # Enable parallel mode
46
+ kodrdriv tree publish --parallel
47
+
48
+ # Control concurrency
49
+ kodrdriv tree publish --parallel --max-concurrency 3
50
+
51
+ # Parallel with options
52
+ kodrdriv tree precommit --parallel --max-concurrency 4
53
+ ```
54
+
55
+ **Benefits**:
56
+ - Packages with no dependencies run simultaneously
57
+ - Respects dependency order
58
+ - Faster execution (2-4x speedup typical)
59
+
60
+ ## Built-In Commands
61
+
62
+ ### tree commit
63
+
64
+ Generate commits for all packages:
65
+
66
+ ```bash
67
+ kodrdriv tree commit
68
+
69
+ # With options
70
+ kodrdriv tree commit --add --sendit
71
+
72
+ # With context
73
+ kodrdriv tree commit --context-files MIGRATION.md
74
+ ```
75
+
76
+ ### tree publish
77
+
78
+ Publish all packages in dependency order:
79
+
80
+ ```bash
81
+ # Sequential
82
+ kodrdriv tree publish
83
+
84
+ # Parallel
85
+ kodrdriv tree publish --parallel
86
+
87
+ # With self-reflection
88
+ kodrdriv tree publish --self-reflection --context-files RELEASE.md
89
+
90
+ # Skip confirmations
91
+ kodrdriv tree publish --sendit --parallel
92
+ ```
93
+
94
+ ### tree precommit
95
+
96
+ Run lint + build + test across packages:
97
+
98
+ ```bash
99
+ kodrdriv tree precommit
100
+
101
+ # Parallel for speed
102
+ kodrdriv tree precommit --parallel --max-concurrency 4
103
+ ```
104
+
105
+ ### tree link
106
+
107
+ Create local development dependencies:
108
+
109
+ ```bash
110
+ # Link all packages
111
+ kodrdriv tree link
112
+
113
+ # Link specific scope
114
+ kodrdriv tree link @myorg
115
+
116
+ # With external patterns
117
+ kodrdriv tree link --externals "../external-dep"
118
+ ```
119
+
120
+ ### tree unlink
121
+
122
+ Restore npm dependencies:
123
+
124
+ ```bash
125
+ # Unlink all
126
+ kodrdriv tree unlink
127
+
128
+ # Clean and reinstall
129
+ kodrdriv tree unlink --clean-node-modules
130
+ ```
131
+
132
+ ## Advanced Features
133
+
134
+ ### Recovery from Failures
135
+
136
+ **If execution fails mid-way**:
137
+
138
+ ```bash
139
+ # Check status
140
+ kodrdriv tree publish --status
141
+
142
+ # Resume from checkpoint
143
+ kodrdriv tree publish --continue
144
+
145
+ # Retry failed packages only
146
+ kodrdriv tree publish --retry-failed
147
+
148
+ # Skip failed packages
149
+ kodrdriv tree publish --skip-failed
150
+ ```
151
+
152
+ ### Manual Recovery
153
+
154
+ ```bash
155
+ # Mark package as completed
156
+ kodrdriv tree publish --promote @myorg/completed-package
157
+
158
+ # Skip specific packages
159
+ kodrdriv tree publish --skip @myorg/skip-this,@myorg/and-this
160
+
161
+ # Mark multiple as completed
162
+ kodrdriv tree publish --mark-completed pkg1,pkg2,pkg3
163
+ ```
164
+
165
+ ### Execution Control
166
+
167
+ ```bash
168
+ # Start from specific package
169
+ kodrdriv tree publish --start-from @myorg/mid-package
170
+
171
+ # Stop before specific package
172
+ kodrdriv tree publish --stop-at @myorg/last-package
173
+
174
+ # Exclude patterns
175
+ kodrdriv tree publish --exclude "**/test-*"
176
+ ```
177
+
178
+ ### Monitoring
179
+
180
+ ```bash
181
+ # Check detailed status
182
+ kodrdriv tree publish --status-parallel
183
+
184
+ # Shows:
185
+ # - Package states (pending/running/completed/failed)
186
+ # - Timing information
187
+ # - Error details
188
+ # - Dependency relationships
189
+ ```
190
+
191
+ ## Parallel Execution
192
+
193
+ ### How It Works
194
+
195
+ 1. **Analyze Dependencies**:
196
+ ```
197
+ Level 0: core, utils-a (no deps) → Run in parallel
198
+ Level 1: api (needs core) → Wait for level 0
199
+ Level 2: ui (needs api) → Wait for level 1
200
+ ```
201
+
202
+ 2. **Execute in Batches**:
203
+ - All packages at same level run together
204
+ - Respects maxConcurrency limit
205
+ - Proceeds to next level when ready
206
+
207
+ 3. **Handle Failures**:
208
+ - Failed package stops its dependents
209
+ - Other branches continue
210
+ - Checkpoint saved for recovery
211
+
212
+ ### Parallel Configuration
213
+
214
+ ```yaml
215
+ tree:
216
+ parallel: true
217
+ maxConcurrency: 4
218
+ retry:
219
+ maxAttempts: 3
220
+ initialDelayMs: 5000
221
+ maxDelayMs: 60000
222
+ backoffMultiplier: 2
223
+ monitoring:
224
+ showProgress: true
225
+ showMetrics: true
226
+ ```
227
+
228
+ ### Parallel Best Practices
229
+
230
+ ```bash
231
+ # Start conservative
232
+ kodrdriv tree publish --parallel --max-concurrency 2
233
+
234
+ # Increase based on system
235
+ # CPU-bound tasks: maxConcurrency = cores
236
+ # IO-bound tasks: maxConcurrency = cores * 2
237
+ # Network-bound: maxConcurrency = cores * 4
238
+
239
+ # Monitor first run
240
+ kodrdriv tree publish --parallel --max-concurrency 4 --verbose
241
+ ```
242
+
243
+ ## Custom Commands
244
+
245
+ ### Run Arbitrary Commands
246
+
247
+ ```bash
248
+ # Run npm script
249
+ kodrdriv tree --cmd "npm run build"
250
+
251
+ # Run shell command
252
+ kodrdriv tree --cmd "git status"
253
+
254
+ # Complex command
255
+ kodrdriv tree --cmd "npm test && npm run lint"
256
+ ```
257
+
258
+ ### Validation
259
+
260
+ Commands are validated for parallel safety:
261
+ - `commit`, `precommit`, `run` → Safe
262
+ - `publish` → Requires sequential execution per branch
263
+ - Custom → Validation performed
264
+
265
+ ## Dependency Management
266
+
267
+ ### Understanding Dependencies
268
+
269
+ Kodrdriv detects dependencies from:
270
+ - `package.json` dependencies
271
+ - `package.json` devDependencies
272
+ - `file:` references
273
+
274
+ ### Dependency Graph
275
+
276
+ View with debug mode:
277
+ ```bash
278
+ kodrdriv tree publish --debug
279
+
280
+ # Shows:
281
+ # - Package discovery
282
+ # - Dependency relationships
283
+ # - Execution order
284
+ # - Depth levels
285
+ ```
286
+
287
+ ### Handling Circular Dependencies
288
+
289
+ If detected:
290
+ ```
291
+ Error: Circular dependency detected: A → B → C → A
292
+ ```
293
+
294
+ **Solution**: Fix package.json to remove cycle.
295
+
296
+ ## Checkpoint System
297
+
298
+ ### How Checkpoints Work
299
+
300
+ 1. **Save State**: After each package completes
301
+ 2. **Store Location**: `.kodrdriv-context` file
302
+ 3. **Resume**: `--continue` flag reads checkpoint
303
+
304
+ ### Checkpoint Contents
305
+
306
+ ```json
307
+ {
308
+ "command": "kodrdriv publish",
309
+ "completedPackages": ["@org/core", "@org/utils"],
310
+ "publishedVersions": [...],
311
+ "startTime": "2025-12-31T...",
312
+ "lastUpdateTime": "2025-12-31T..."
313
+ }
314
+ ```
315
+
316
+ ### Managing Checkpoints
317
+
318
+ ```bash
319
+ # View checkpoint
320
+ cat .kodrdriv-context
321
+
322
+ # Continue from checkpoint
323
+ kodrdriv tree publish --continue
324
+
325
+ # Modify checkpoint manually
326
+ # Edit .kodrdriv-context
327
+
328
+ # Clear checkpoint
329
+ rm .kodrdriv-context
330
+ ```
331
+
332
+ ## Filtering Packages
333
+
334
+ ### By Pattern
335
+
336
+ ```bash
337
+ # Exclude test packages
338
+ kodrdriv tree publish --exclude "**/test-*"
339
+
340
+ # Multiple patterns
341
+ kodrdriv tree publish --exclude "**/test-*" --exclude "**/temp-*"
342
+ ```
343
+
344
+ ### By Name
345
+
346
+ ```bash
347
+ # Skip specific packages
348
+ kodrdriv tree publish --skip @org/experimental,@org/deprecated
349
+ ```
350
+
351
+ ### By Directory
352
+
353
+ ```bash
354
+ # Specific directories only
355
+ kodrdriv tree publish --directories packages/core packages/ui
356
+ ```
357
+
358
+ ## Package Discovery
359
+
360
+ ### Automatic Discovery
361
+
362
+ Kodrdriv finds packages by scanning for `package.json`:
363
+ ```bash
364
+ # Default: current directory and subdirectories
365
+ kodrdriv tree publish
366
+
367
+ # Custom directories
368
+ kodrdriv tree publish --directories packages libs
369
+ ```
370
+
371
+ ### Package Metadata
372
+
373
+ For each package, kodrdriv tracks:
374
+ - Name (from package.json)
375
+ - Version (from package.json)
376
+ - Path (directory location)
377
+ - Dependencies (from package.json)
378
+ - Dependents (computed)
379
+
380
+ ## Error Handling
381
+
382
+ ### Failure Strategies
383
+
384
+ **Default (stop on error)**:
385
+ ```bash
386
+ kodrdriv tree publish
387
+ # Stops at first failure
388
+ ```
389
+
390
+ **Continue on error**:
391
+ ```bash
392
+ kodrdriv tree publish --continue
393
+ # Continues after failure (via checkpoint)
394
+ ```
395
+
396
+ **Skip failed**:
397
+ ```bash
398
+ kodrdriv tree publish --skip-failed
399
+ # Marks as failed and continues
400
+ ```
401
+
402
+ ### Timeout Handling
403
+
404
+ For long-running operations:
405
+ ```bash
406
+ kodrdriv tree publish --checks-timeout 7200000 # 2 hours
407
+ ```
408
+
409
+ If timeout occurs:
410
+ 1. Checkpoint saved
411
+ 2. Recovery instructions provided
412
+ 3. Can resume with `--continue`
413
+
414
+ ## Performance Optimization
415
+
416
+ ### Sequential vs Parallel
417
+
418
+ **Sequential** (safe, slower):
419
+ ```bash
420
+ kodrdriv tree publish
421
+ # Time: N packages × time per package
422
+ ```
423
+
424
+ **Parallel** (faster, more complex):
425
+ ```bash
426
+ kodrdriv tree publish --parallel
427
+ # Time: Depth × time per batch
428
+ ```
429
+
430
+ **Speedup example** (10 packages, 3 levels):
431
+ - Sequential: 10 × 5min = 50min
432
+ - Parallel (4 concurrent): 3 × 7min = 21min
433
+ - **Speedup**: 2.4x
434
+
435
+ ### Concurrency Tuning
436
+
437
+ ```bash
438
+ # Conservative (safe)
439
+ --max-concurrency 2
440
+
441
+ # Balanced
442
+ --max-concurrency 4
443
+
444
+ # Aggressive (fast, riskier)
445
+ --max-concurrency 8
446
+ ```
447
+
448
+ Choose based on:
449
+ - System resources (CPU, memory)
450
+ - External dependencies (API rate limits)
451
+ - Command characteristics (CPU vs IO bound)
452
+
453
+ ## Troubleshooting
454
+
455
+ ### Package Not Found
456
+
457
+ ```bash
458
+ # Check discovery
459
+ kodrdriv tree publish --debug | grep "Discovered"
460
+
461
+ # Verify package.json exists
462
+ find . -name "package.json" -not -path "*/node_modules/*"
463
+
464
+ # Check directories
465
+ kodrdriv tree publish --directories packages
466
+ ```
467
+
468
+ ### Wrong Execution Order
469
+
470
+ ```bash
471
+ # View dependency graph
472
+ kodrdriv tree publish --debug
473
+
474
+ # Check package.json dependencies
475
+ # Ensure file: deps are correct
476
+ ```
477
+
478
+ ### Parallel Execution Fails
479
+
480
+ ```bash
481
+ # Check detailed status
482
+ kodrdriv tree publish --status-parallel
483
+
484
+ # Reduce concurrency
485
+ kodrdriv tree publish --parallel --max-concurrency 2
486
+
487
+ # Use sequential
488
+ kodrdriv tree publish
489
+ ```
490
+
491
+ ### Recovery Issues
492
+
493
+ ```bash
494
+ # Check checkpoint
495
+ cat .kodrdriv-context
496
+
497
+ # Validate state
498
+ kodrdriv tree publish --validate-state
499
+
500
+ # Reset if corrupted
501
+ rm .kodrdriv-context
502
+ kodrdriv tree publish
503
+ ```
504
+
505
+ ## Real-World Examples
506
+
507
+ ### Example 1: Full Monorepo Publish
508
+
509
+ ```bash
510
+ # 1. Link for development
511
+ kodrdriv tree link
512
+
513
+ # 2. Make changes across packages
514
+
515
+ # 3. Run checks
516
+ kodrdriv tree precommit --parallel
517
+
518
+ # 4. Commit all
519
+ kodrdriv tree commit --add
520
+
521
+ # 5. Publish with context
522
+ kodrdriv tree publish \
523
+ --parallel \
524
+ --context-files MIGRATION.md \
525
+ --self-reflection
526
+
527
+ # 6. Unlink after publish
528
+ kodrdriv tree unlink
529
+ ```
530
+
531
+ ### Example 2: Selective Publish
532
+
533
+ ```bash
534
+ # Publish core and utils only
535
+ kodrdriv tree publish \
536
+ --start-from @org/core \
537
+ --stop-at @org/api \
538
+ --parallel
539
+ ```
540
+
541
+ ### Example 3: Recovery from Timeout
542
+
543
+ ```bash
544
+ # Publish starts
545
+ kodrdriv tree publish --parallel
546
+
547
+ # Timeout occurs at package 5
548
+
549
+ # Check status
550
+ kodrdriv tree publish --status-parallel
551
+
552
+ # Manual intervention
553
+ cd packages/package-5
554
+ kodrdriv publish --sendit
555
+ cd ../..
556
+
557
+ # Resume tree
558
+ kodrdriv tree publish --continue
559
+ ```
560
+
561
+ ## Advanced Configuration
562
+
563
+ ```yaml
564
+ tree:
565
+ # Target specific packages
566
+ directories:
567
+ - packages/core
568
+ - packages/api
569
+
570
+ # Parallel execution
571
+ parallel: true
572
+ maxConcurrency: 3
573
+
574
+ # Exclude patterns
575
+ exclude:
576
+ - "**/deprecated-*"
577
+ - "**/experimental-*"
578
+
579
+ # Retry configuration
580
+ retry:
581
+ maxAttempts: 3
582
+ initialDelayMs: 5000
583
+ maxDelayMs: 60000
584
+ backoffMultiplier: 2
585
+ retriableErrors:
586
+ - "ETIMEDOUT"
587
+ - "ECONNRESET"
588
+
589
+ # Recovery
590
+ recovery:
591
+ checkpointInterval: package
592
+ autoRetry: true
593
+ continueOnError: false
594
+
595
+ # Monitoring
596
+ monitoring:
597
+ showProgress: true
598
+ showMetrics: true
599
+ logLevel: normal
600
+ ```
601
+
602
+ ## Implementation Details
603
+
604
+ See comprehensive documentation:
605
+ - `TREE-TOOLKIT-COMPLETE.md` - Complete extraction story
606
+ - `PARALLEL-PUBLISH-QUICK-REFERENCE.md` - Parallel execution
607
+ - `CHECKPOINT-RECOVERY-FIX.md` - Recovery mechanisms
608
+ - `PARALLEL-PUBLISH-DEBUGGING-GUIDE.md` - Troubleshooting
609
+
610
+ ## Next Steps
611
+
612
+ - **[Monorepo Guide](./monorepo.md)** - Monorepo-specific patterns
613
+ - **[Commands Reference](./commands.md)** - Tree command details
614
+ - **[Debugging Guide](./debugging.md)** - Troubleshoot tree issues
615
+ - **[Architecture Guide](./architecture.md)** - Tree system design
616
+
617
+ Tree operations make managing multi-package projects simple and efficient!
618
+