@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,584 @@
1
+ # Debugging Guide
2
+
3
+ Troubleshooting common issues with kodrdriv.
4
+
5
+ ## Diagnostic Commands
6
+
7
+ ### Quick Checks
8
+
9
+ ```bash
10
+ # Verify installation
11
+ kodrdriv --version
12
+
13
+ # Check configuration
14
+ kodrdriv --check-config
15
+
16
+ # Test with dry-run
17
+ kodrdriv commit --dry-run
18
+
19
+ # Enable verbose logging
20
+ kodrdriv commit --verbose
21
+
22
+ # Maximum debugging detail
23
+ kodrdriv commit --debug
24
+ ```
25
+
26
+ ### Debug Output Locations
27
+
28
+ | File | Purpose |
29
+ |------|---------|
30
+ | `output/request-*.json` | AI requests sent (with --debug) |
31
+ | `output/response-*.json` | AI responses received (with --debug) |
32
+ | `output/agentic-reflection-*.md` | Analysis reports (with --self-reflection) |
33
+ | `output/*-commit-message.md` | Generated commit messages |
34
+ | `output/*-release-notes.md` | Generated release notes |
35
+ | `.kodrdriv-context` | Tree execution state |
36
+
37
+ ## Common Issues
38
+
39
+ ### 1. "OpenAI API key is required"
40
+
41
+ **Symptom**: Error on any command
42
+
43
+ **Solution**:
44
+ ```bash
45
+ # Check if set
46
+ echo $OPENAI_API_KEY
47
+
48
+ # Set temporarily
49
+ export OPENAI_API_KEY="sk-your-key"
50
+
51
+ # Set permanently (add to ~/.zshrc or ~/.bashrc)
52
+ echo 'export OPENAI_API_KEY="sk-your-key"' >> ~/.zshrc
53
+ source ~/.zshrc
54
+ ```
55
+
56
+ ### 2. "No changes to commit"
57
+
58
+ **Symptom**: Command runs but says no changes
59
+
60
+ **Diagnosis**:
61
+ ```bash
62
+ # Check git status
63
+ git status
64
+
65
+ # Check staged changes
66
+ git diff --cached
67
+
68
+ # Check unstaged changes
69
+ git diff
70
+ ```
71
+
72
+ **Solutions**:
73
+ ```bash
74
+ # Stage changes first
75
+ git add .
76
+ kodrdriv commit
77
+
78
+ # Or use --add to auto-stage
79
+ kodrdriv commit --add --sendit
80
+
81
+ # For specific files
82
+ git add file1.ts file2.ts
83
+ kodrdriv commit
84
+ ```
85
+
86
+ ### 3. Command Hangs or Times Out
87
+
88
+ **Symptom**: Command runs but never completes
89
+
90
+ **Diagnosis**:
91
+ ```bash
92
+ # Run with verbose
93
+ kodrdriv commit --verbose
94
+
95
+ # Check iteration count
96
+ kodrdriv commit --debug 2>&1 | grep "iteration"
97
+ ```
98
+
99
+ **Solutions**:
100
+ ```bash
101
+ # Reduce iterations
102
+ kodrdriv commit --max-agentic-iterations 5
103
+
104
+ # Use faster model
105
+ kodrdriv commit --model gpt-4o-mini
106
+
107
+ # Reduce diff size
108
+ kodrdriv commit --max-diff-bytes 5120
109
+
110
+ # Set tool timeout
111
+ kodrdriv commit --tool-timeout 5000
112
+ ```
113
+
114
+ ### 4. "file: dependencies found"
115
+
116
+ **Symptom**: Commit blocked due to `file:` dependencies in package.json
117
+
118
+ **Why**: Protection against committing local dev links
119
+
120
+ **Solutions**:
121
+ ```bash
122
+ # Unlink before committing
123
+ kodrdriv unlink
124
+ kodrdriv commit --sendit
125
+
126
+ # Or bypass check (not recommended)
127
+ kodrdriv commit --skip-file-check --sendit
128
+
129
+ # Or configure to skip
130
+ # In .kodrdriv/config.yaml:
131
+ commit:
132
+ skipFileCheck: true
133
+ ```
134
+
135
+ ### 5. "Cannot find module @eldrforge/..."
136
+
137
+ **Symptom**: Module not found errors
138
+
139
+ **Solutions**:
140
+ ```bash
141
+ # For global install
142
+ npm install -g @eldrforge/kodrdriv
143
+
144
+ # For local install
145
+ cd /path/to/kodrdriv
146
+ npm install
147
+ npm link
148
+
149
+ # Check installation
150
+ which kodrdriv
151
+ npm list -g @eldrforge/kodrdriv
152
+ ```
153
+
154
+ ### 6. AI Output is Poor Quality
155
+
156
+ **Symptoms**:
157
+ - Generic messages
158
+ - Missing context
159
+ - Incorrect understanding
160
+
161
+ **Diagnosis**:
162
+ ```bash
163
+ # Generate with self-reflection
164
+ kodrdriv commit --self-reflection
165
+
166
+ # Check the report
167
+ cat output/agentic-reflection-commit-*.md
168
+
169
+ # Look for:
170
+ # - Low tool usage (< 3 tools)
171
+ # - Tool failures
172
+ # - Short iteration count
173
+ ```
174
+
175
+ **Solutions**:
176
+ ```bash
177
+ # Provide more context
178
+ kodrdriv commit --context "Refactoring for testability"
179
+
180
+ # Pass context files
181
+ kodrdriv commit --context-files docs/IMPL.md
182
+
183
+ # Increase iterations
184
+ kodrdriv commit --max-agentic-iterations 12
185
+
186
+ # Use better model
187
+ kodrdriv commit --model gpt-4o
188
+ ```
189
+
190
+ ### 7. GitHub API Errors
191
+
192
+ **Symptoms**:
193
+ - "Resource not accessible"
194
+ - "Bad credentials"
195
+ - "Not found"
196
+
197
+ **Diagnosis**:
198
+ ```bash
199
+ # Check token
200
+ echo $GITHUB_TOKEN
201
+
202
+ # Test token
203
+ curl -H "Authorization: token $GITHUB_TOKEN" \
204
+ https://api.github.com/user
205
+
206
+ # Check repository
207
+ git remote -v
208
+ ```
209
+
210
+ **Solutions**:
211
+ ```bash
212
+ # Set token
213
+ export GITHUB_TOKEN="ghp-your-token"
214
+
215
+ # Verify repository remote
216
+ git remote get-url origin
217
+
218
+ # Test without GitHub
219
+ kodrdriv commit --dry-run # Doesn't need GitHub
220
+ ```
221
+
222
+ ### 8. Tree Command Failures
223
+
224
+ **Symptom**: Tree publish fails mid-execution
225
+
226
+ **Diagnosis**:
227
+ ```bash
228
+ # Check status
229
+ kodrdriv tree publish --status
230
+
231
+ # Check detailed state
232
+ cat .kodrdriv-context
233
+ ```
234
+
235
+ **Solutions**:
236
+ ```bash
237
+ # Resume from checkpoint
238
+ kodrdriv tree publish --continue
239
+
240
+ # Skip failed package
241
+ kodrdriv tree publish --skip @org/failing-package
242
+
243
+ # Mark as completed manually
244
+ kodrdriv tree publish --promote @org/completed-package
245
+
246
+ # Retry failed packages
247
+ kodrdriv tree publish --retry-failed
248
+
249
+ # Start fresh
250
+ rm .kodrdriv-context
251
+ kodrdriv tree publish
252
+ ```
253
+
254
+ ### 9. Configuration Not Loading
255
+
256
+ **Symptom**: Settings in config file ignored
257
+
258
+ **Diagnosis**:
259
+ ```bash
260
+ # Check what config is loaded
261
+ kodrdriv --check-config
262
+
263
+ # Check config file syntax
264
+ cat .kodrdriv/config.yaml
265
+ ```
266
+
267
+ **Solutions**:
268
+ ```bash
269
+ # Verify YAML syntax
270
+ # Use proper indentation (spaces, not tabs)
271
+
272
+ # Verify file location
273
+ ls -la .kodrdriv/
274
+
275
+ # Test with explicit config
276
+ kodrdriv commit --config-dir .kodrdriv
277
+
278
+ # Check for typos in keys
279
+ kodrdriv --check-config | grep commit
280
+ ```
281
+
282
+ ### 10. Parallel Execution Issues
283
+
284
+ **Symptom**: Tree publish fails in parallel mode
285
+
286
+ **Diagnosis**:
287
+ ```bash
288
+ # Check parallel status
289
+ kodrdriv tree publish --status-parallel
290
+
291
+ # Run with verbose
292
+ kodrdriv tree publish --parallel --verbose
293
+ ```
294
+
295
+ **Solutions**:
296
+ ```bash
297
+ # Reduce concurrency
298
+ kodrdriv tree publish --parallel --max-concurrency 2
299
+
300
+ # Disable parallel
301
+ kodrdriv tree publish # Sequential
302
+
303
+ # Check logs for specific package
304
+ ls output/*.log
305
+ cat output/package-name-*.log
306
+ ```
307
+
308
+ ## Debugging Workflows
309
+
310
+ ### Debug Workflow 1: AI Investigation
311
+
312
+ ```bash
313
+ # Run with self-reflection
314
+ kodrdriv commit --self-reflection --verbose
315
+
316
+ # Examine report
317
+ cat output/agentic-reflection-commit-*.md
318
+
319
+ # Check:
320
+ # - How many tools were used?
321
+ # - Were there tool failures?
322
+ # - What was the conversation flow?
323
+ # - Did it reach max iterations?
324
+ ```
325
+
326
+ ### Debug Workflow 2: Configuration Issues
327
+
328
+ ```bash
329
+ # Step 1: Check config loading
330
+ kodrdriv --check-config --verbose
331
+
332
+ # Step 2: Check specific command config
333
+ kodrdriv commit --dry-run --verbose
334
+
335
+ # Step 3: Test with CLI override
336
+ kodrdriv commit --model gpt-4o --dry-run
337
+
338
+ # Step 4: Verify precedence
339
+ # CLI args > config file > defaults
340
+ ```
341
+
342
+ ### Debug Workflow 3: Integration Problems
343
+
344
+ ```bash
345
+ # Test each component separately
346
+
347
+ # 1. Git integration
348
+ git status
349
+ git diff --cached
350
+
351
+ # 2. OpenAI integration
352
+ kodrdriv commit --dry-run --debug
353
+ # Check output/request-*.json
354
+
355
+ # 3. GitHub integration
356
+ kodrdriv release --no-milestones --dry-run
357
+
358
+ # 4. File system
359
+ ls -la output/
360
+ cat output/RELEASE_NOTES.md
361
+ ```
362
+
363
+ ## Debug Flags
364
+
365
+ ### --dry-run
366
+
367
+ Preview without making changes:
368
+ ```bash
369
+ kodrdriv commit --dry-run
370
+ kodrdriv publish --dry-run
371
+ ```
372
+
373
+ Shows exactly what would happen.
374
+
375
+ ### --verbose
376
+
377
+ Detailed logging:
378
+ ```bash
379
+ kodrdriv commit --verbose
380
+ ```
381
+
382
+ Shows:
383
+ - Configuration loading
384
+ - Git operations
385
+ - AI requests
386
+ - Tool executions
387
+
388
+ ### --debug
389
+
390
+ Maximum detail:
391
+ ```bash
392
+ kodrdriv commit --debug
393
+ ```
394
+
395
+ Shows everything plus:
396
+ - Full prompts
397
+ - API request/response
398
+ - Token counts
399
+ - Timing information
400
+
401
+ Saves:
402
+ - `output/request-*.json`
403
+ - `output/response-*.json`
404
+
405
+ ### --self-reflection
406
+
407
+ Analysis reports:
408
+ ```bash
409
+ kodrdriv commit --self-reflection
410
+ ```
411
+
412
+ Generates:
413
+ - Tool effectiveness metrics
414
+ - Execution timeline
415
+ - Conversation history
416
+ - Recommendations
417
+
418
+ ## Performance Debugging
419
+
420
+ ### Slow Commands
421
+
422
+ **Diagnosis**:
423
+ ```bash
424
+ # Run with timing
425
+ time kodrdriv commit --verbose
426
+
427
+ # Check self-reflection
428
+ kodrdriv commit --self-reflection
429
+ # Look for slow tools in report
430
+ ```
431
+
432
+ **Solutions**:
433
+ ```bash
434
+ # Reduce iterations
435
+ kodrdriv commit --max-agentic-iterations 6
436
+
437
+ # Smaller diffs
438
+ kodrdriv commit --max-diff-bytes 8192
439
+
440
+ # Faster model
441
+ kodrdriv commit --model gpt-4o-mini
442
+
443
+ # Set tool timeouts
444
+ kodrdriv commit --tool-timeout 3000
445
+ ```
446
+
447
+ ### High API Costs
448
+
449
+ **Diagnosis**:
450
+ ```bash
451
+ # Check which model is used
452
+ kodrdriv --check-config | grep model
453
+
454
+ # Check iteration counts
455
+ # View self-reflection reports
456
+ ```
457
+
458
+ **Solutions**:
459
+ ```yaml
460
+ # Use cheaper model
461
+ model: gpt-4o-mini
462
+
463
+ # Reduce iterations
464
+ commit:
465
+ maxAgenticIterations: 6
466
+
467
+ release:
468
+ maxAgenticIterations: 20
469
+
470
+ # Limit history
471
+ commit:
472
+ messageLimit: 5
473
+ ```
474
+
475
+ ## Logging Levels
476
+
477
+ Control verbosity in config or CLI:
478
+
479
+ ```yaml
480
+ # Minimal output
481
+ verbose: false
482
+ debug: false
483
+
484
+ # Standard output
485
+ verbose: true
486
+ debug: false
487
+
488
+ # Maximum output
489
+ verbose: true
490
+ debug: true
491
+ ```
492
+
493
+ Or via CLI:
494
+ ```bash
495
+ kodrdriv commit # Standard
496
+ kodrdriv commit --verbose # Detailed
497
+ kodrdriv commit --debug # Everything
498
+ ```
499
+
500
+ ## Error Messages
501
+
502
+ ### Common Errors and Solutions
503
+
504
+ | Error | Cause | Solution |
505
+ |-------|-------|----------|
506
+ | "API key required" | Missing env var | Set OPENAI_API_KEY |
507
+ | "No changes" | Nothing staged | Run git add first |
508
+ | "file: dependencies" | Local symlinks | Run kodrdriv unlink |
509
+ | "Not a git repository" | Wrong directory | cd to git repo |
510
+ | "Rate limit exceeded" | Too many requests | Wait or reduce usage |
511
+ | "Context length exceeded" | Diff too large | Use --max-diff-bytes |
512
+ | "Module not found" | Installation issue | npm install -g kodrdriv |
513
+ | "Permission denied" | File access | Check file permissions |
514
+ | "Network error" | Connection issue | Check internet/firewall |
515
+
516
+ ## Getting Help
517
+
518
+ ### Self-Diagnosis
519
+
520
+ 1. **Check environment**:
521
+ ```bash
522
+ node --version # Need 18+
523
+ git --version
524
+ which kodrdriv
525
+ ```
526
+
527
+ 2. **Check configuration**:
528
+ ```bash
529
+ kodrdriv --check-config
530
+ ```
531
+
532
+ 3. **Run diagnostics**:
533
+ ```bash
534
+ kodrdriv commit --dry-run --verbose
535
+ ```
536
+
537
+ ### Collect Debug Information
538
+
539
+ When reporting issues:
540
+
541
+ ```bash
542
+ # Generate debug bundle
543
+ kodrdriv commit --debug --dry-run 2>&1 | tee debug-output.txt
544
+
545
+ # Include:
546
+ # - debug-output.txt
547
+ # - output/request-*.json
548
+ # - output/response-*.json
549
+ # - output/agentic-reflection-*.md
550
+ # - .kodrdriv/config.yaml
551
+ # - kodrdriv --version output
552
+ ```
553
+
554
+ ### Review Implementation Docs
555
+
556
+ Check `/Users/tobrien/gitw/calenvarek/` for detailed guides:
557
+ - `PARALLEL-PUBLISH-DEBUGGING-GUIDE.md` - Parallel execution issues
558
+ - `RECOVERY-FIXES.md` - Recovery mechanisms
559
+ - `AI-SERVICE-INTEGRATION-COMPLETE.md` - AI system details
560
+
561
+ ## Debug Checklist
562
+
563
+ When something doesn't work:
564
+
565
+ - [ ] Check environment variables are set
566
+ - [ ] Verify git repository state
567
+ - [ ] Test with --dry-run first
568
+ - [ ] Enable --verbose logging
569
+ - [ ] Check output directory for files
570
+ - [ ] Review configuration with --check-config
571
+ - [ ] Try --debug for maximum detail
572
+ - [ ] Generate self-reflection report
573
+ - [ ] Check error message carefully
574
+ - [ ] Review relevant implementation docs
575
+
576
+ Most issues can be diagnosed with `--verbose` and resolved with proper configuration.
577
+
578
+ ## Next Steps
579
+
580
+ - **[Configuration Guide](./configuration.md)** - Fix config issues
581
+ - **[AI System Guide](./ai-system.md)** - Understand AI behavior
582
+ - **[Commands Reference](./commands.md)** - Command-specific help
583
+ - **[Development Guide](./development.md)** - Extend or modify kodrdriv
584
+