@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,519 @@
1
+ # AI System Guide
2
+
3
+ Understanding how kodrdriv's AI analysis works.
4
+
5
+ ## Overview
6
+
7
+ Kodrdriv uses an **agentic AI system** - the AI doesn't just generate text, it actively investigates your code changes using specialized tools before writing commit messages or release notes.
8
+
9
+ **Key Concept**: Instead of blindly describing diffs, the AI asks questions like "what files depend on this?" and "what tests cover this?" to understand your changes deeply.
10
+
11
+ ## Always-On Agentic Mode
12
+
13
+ As of recent updates, **agentic mode is always enabled**. The AI always uses tools to investigate changes.
14
+
15
+ ### What This Means
16
+
17
+ **Old way** (single-shot):
18
+ ```
19
+ Diff → AI → Commit Message
20
+ ```
21
+
22
+ **New way** (agentic):
23
+ ```
24
+ Diff → AI analyzes → Uses tools → Gathers context → AI writes message
25
+ ```
26
+
27
+ The AI can:
28
+ - Read file contents
29
+ - Check file history
30
+ - Find dependencies
31
+ - Search codebase
32
+ - Review tests
33
+ - Check recent commits
34
+
35
+ ## AI Tools
36
+
37
+ ### Commit Message Tools (8 tools)
38
+
39
+ | Tool | Purpose | Example Use Case |
40
+ |------|---------|------------------|
41
+ | `get_file_history` | View file's commit history | Understand evolution of changed file |
42
+ | `get_file_content` | Read complete file | See context around diff |
43
+ | `get_related_tests` | Find test files | Understand behavior changes |
44
+ | `analyze_diff_section` | Expand context around lines | Clarify cryptic changes |
45
+ | `get_recent_commits` | Check recent commits | Avoid duplicate messages |
46
+ | `search_codebase` | Find patterns/usage | Assess impact of changes |
47
+ | `get_file_dependencies` | Find what depends on file | Understand impact scope |
48
+ | `group_files_by_concern` | Organize files logically | Suggest commit splits |
49
+
50
+ ### Release Notes Tools (13 tools)
51
+
52
+ **All commit tools** plus:
53
+
54
+ | Tool | Purpose | Example Use Case |
55
+ |------|---------|------------------|
56
+ | `get_tag_history` | View past tags | Understand release patterns |
57
+ | `get_release_stats` | Quantify changes | Get metrics on scope |
58
+ | `analyze_commit_patterns` | Detect themes | Identify focus areas |
59
+ | `compare_previous_release` | Compare releases | Contextualize changes |
60
+ | `get_breaking_changes` | Identify breaking changes | Alert users to issues |
61
+
62
+ ## How the AI Decides
63
+
64
+ ### Investigation Strategy
65
+
66
+ The AI decides which tools to use based on:
67
+
68
+ 1. **Change Complexity**
69
+ - 1-3 files → Use 1-2 tools (simple)
70
+ - 4-10 files → Use 2-4 tools (moderate)
71
+ - 10+ files → Use 4-6 tools (complex)
72
+
73
+ 2. **Change Type**
74
+ - New feature → Check tests, dependencies
75
+ - Bug fix → Review file history, related changes
76
+ - Refactor → Check dependencies, search usage
77
+ - Documentation → Group by concern
78
+
79
+ 3. **Clarity**
80
+ - Clear diff → Fewer tools needed
81
+ - Cryptic diff → Read full files, expand context
82
+ - Multiple concerns → Group files, suggest splits
83
+
84
+ ### Example: AI Investigating a Change
85
+
86
+ ```
87
+ User: Generate commit message for auth.ts changes
88
+
89
+ AI: Let me investigate...
90
+ 1. get_file_content(auth.ts) → See full context
91
+ 2. get_related_tests(auth.ts) → Find auth.test.ts
92
+ 3. get_file_dependencies(auth.ts) → Used by user.ts, api.ts
93
+ 4. get_recent_commits(auth.ts) → Last changed 2 days ago
94
+ "refactor: simplify auth flow"
95
+
96
+ AI: Based on investigation, this adds JWT support to
97
+ existing auth system, affecting user and API modules.
98
+ Tests updated to cover new token validation.
99
+
100
+ Output: "feat(auth): add JWT token support
101
+
102
+ Adds JWT-based authentication alongside existing session auth.
103
+ Updates user and API modules to handle tokens.
104
+ Includes tests for token validation and refresh."
105
+ ```
106
+
107
+ ## Prompt Engineering
108
+
109
+ ### Commit Message Prompts
110
+
111
+ **System Prompt** (abbreviated):
112
+ ```
113
+ You are a professional software engineer writing commit messages for your team.
114
+
115
+ Write naturally and directly:
116
+ - Use plain language, not corporate speak
117
+ - Be specific and concrete
118
+ - Avoid buzzwords and jargon
119
+ - No emojis or excessive punctuation
120
+ - No phrases like "this commit"
121
+ ```
122
+
123
+ **User Prompt**:
124
+ ```
125
+ I have staged changes that need a commit message.
126
+
127
+ Changed files (3):
128
+ - src/auth.ts
129
+ - src/user.ts
130
+ - tests/auth.test.ts
131
+
132
+ Diff: [full diff]
133
+
134
+ Analyze these changes and write a clear commit message.
135
+ ```
136
+
137
+ ### Release Notes Prompts
138
+
139
+ **System Prompt** (abbreviated):
140
+ ```
141
+ You are a professional software engineer writing release notes for your team and users.
142
+
143
+ Focus on:
144
+ - What problems does this release solve?
145
+ - What new capabilities does it add?
146
+ - What's the impact on users?
147
+ - Are there breaking changes?
148
+
149
+ Write naturally and directly:
150
+ - Use plain language
151
+ - Be specific about what changed and why
152
+ - No marketing speak
153
+ - No emojis
154
+ - Focus on facts, not enthusiasm
155
+ ```
156
+
157
+ **User Prompt**:
158
+ ```
159
+ I need release notes for changes from v1.0.0 to v1.1.0.
160
+
161
+ Commit Log: [commits]
162
+ Diff Summary: [diffs]
163
+ Milestone Issues: [resolved issues]
164
+
165
+ Consider:
166
+ - What's the main story?
167
+ - What problems does it solve?
168
+ - Are there breaking changes?
169
+ ```
170
+
171
+ ## Quality Standards
172
+
173
+ ### Anti-Slop Guidelines
174
+
175
+ The AI is explicitly instructed to avoid:
176
+ - ✗ Emojis (🎉, ✨, 🚀)
177
+ - ✗ Marketing language ("excited to announce")
178
+ - ✗ Meta-commentary ("this commit", "this PR")
179
+ - ✗ Buzzwords ("leverage", "synergy")
180
+ - ✗ Excessive punctuation (!!!, ???)
181
+ - ✗ Conversational closings ("Let me know")
182
+
183
+ ### What Good Output Looks Like
184
+
185
+ **Commit Message**:
186
+ ```
187
+ feat(auth): add JWT token support
188
+
189
+ Adds JWT-based authentication alongside existing session auth. Token
190
+ validation happens in middleware, with automatic refresh handling.
191
+
192
+ Updates user and API modules to accept both auth methods. Backward
193
+ compatible - existing session auth continues to work.
194
+
195
+ Includes tests for token validation, refresh, and mixed auth scenarios.
196
+ ```
197
+
198
+ **Release Notes**:
199
+ ```
200
+ ## Authentication Improvements
201
+
202
+ Added JWT token support alongside existing session-based authentication.
203
+ Tokens are validated in middleware with automatic refresh handling.
204
+
205
+ Both authentication methods work simultaneously, allowing gradual migration.
206
+ Session-based auth continues to work without changes.
207
+
208
+ ## Breaking Changes
209
+
210
+ None. This release is fully backward compatible.
211
+
212
+ ## Testing
213
+
214
+ Added comprehensive tests for token validation, refresh logic, and
215
+ compatibility with existing session auth.
216
+ ```
217
+
218
+ ## Iteration Control
219
+
220
+ ### What Are Iterations?
221
+
222
+ Each iteration is one loop of AI → Tool Calls → Response.
223
+
224
+ **Example**:
225
+ ```
226
+ Iteration 1: AI requests get_file_content(auth.ts)
227
+ Iteration 2: AI requests get_related_tests(auth.ts)
228
+ Iteration 3: AI writes commit message
229
+ ```
230
+
231
+ ### Controlling Iterations
232
+
233
+ ```bash
234
+ # More iterations = more investigation
235
+ kodrdriv commit --max-agentic-iterations 15
236
+
237
+ # Fewer for speed
238
+ kodrdriv commit --max-agentic-iterations 5
239
+
240
+ # Default is 10 for commits, 30 for releases
241
+ ```
242
+
243
+ **When to adjust**:
244
+ - Simple changes → Use 5-8 iterations
245
+ - Complex changes → Use 12-20 iterations
246
+ - Large releases → Use 40-50 iterations
247
+
248
+ ### Monitoring Iterations
249
+
250
+ Enable self-reflection to see iteration details:
251
+
252
+ ```bash
253
+ kodrdriv commit --self-reflection
254
+ cat output/agentic-reflection-commit-*.md
255
+ ```
256
+
257
+ Report shows:
258
+ - Number of iterations used
259
+ - Tools called per iteration
260
+ - Time spent per tool
261
+ - Success/failure rates
262
+
263
+ ## Token Budgets
264
+
265
+ ### Understanding Token Limits
266
+
267
+ Each AI request has a token budget:
268
+ - **Commit messages**: ~150K tokens max
269
+ - **Release notes**: ~200K tokens max
270
+
271
+ Includes:
272
+ - Your code diffs
273
+ - Git history
274
+ - Tool outputs
275
+ - AI responses
276
+
277
+ ### When Budgets Are Exceeded
278
+
279
+ Kodrdriv automatically:
280
+ 1. Compresses oldest messages
281
+ 2. Removes low-priority context
282
+ 3. Truncates large diffs
283
+ 4. Retries with smaller input
284
+
285
+ You can:
286
+ ```bash
287
+ # Reduce diff size
288
+ kodrdriv commit --max-diff-bytes 5120
289
+
290
+ # Limit commit history
291
+ kodrdriv commit --message-limit 5
292
+
293
+ # Reduce iterations
294
+ kodrdriv commit --max-agentic-iterations 8
295
+ ```
296
+
297
+ ## Reasoning Levels
298
+
299
+ OpenAI reasoning models support different effort levels:
300
+
301
+ ```yaml
302
+ # Fast, less thorough
303
+ openaiReasoning: low
304
+
305
+ # Balanced (default)
306
+ openaiReasoning: medium
307
+
308
+ # Thorough, slower
309
+ openaiReasoning: high
310
+ ```
311
+
312
+ **When to use**:
313
+ - `low`: Simple changes, quick commits
314
+ - `medium`: Standard development (default)
315
+ - `high`: Complex releases, critical changes
316
+
317
+ ## Context Sources
318
+
319
+ ### Automatic Context
320
+
321
+ Always included:
322
+ - Git diff of changes
323
+ - Recent commit history
324
+ - File structure
325
+ - Repository metadata
326
+
327
+ ### Optional Context
328
+
329
+ Enable with options:
330
+ - `--context "text"` - Free-form context
331
+ - `--context-files FILES` - Documentation files
332
+ - `-d, --context-directories DIRS` - Code directories
333
+ - GitHub issues (automatic for commits)
334
+ - Milestone issues (automatic for releases)
335
+
336
+ ### Example: Rich Context
337
+
338
+ ```bash
339
+ kodrdriv release \
340
+ --context "This release focuses on performance" \
341
+ --context-files OPTIMIZATION-NOTES.md BENCHMARKS.md \
342
+ -d src/performance -d src/cache \
343
+ --self-reflection
344
+ ```
345
+
346
+ AI receives:
347
+ - Git diff
348
+ - Git history
349
+ - Your context text
350
+ - Contents of OPTIMIZATION-NOTES.md
351
+ - Contents of BENCHMARKS.md
352
+ - Directory trees for src/performance and src/cache
353
+ - Milestone issues
354
+ - Analysis from previous tools
355
+
356
+ ## Observability
357
+
358
+ ### Self-Reflection Reports
359
+
360
+ Enable with `--self-reflection`:
361
+
362
+ ```markdown
363
+ # Agentic Workflow - Self-Reflection Report
364
+
365
+ ## Execution Summary
366
+ - Iterations: 12
367
+ - Tool Calls: 18
368
+ - Unique Tools: 6
369
+
370
+ ## Tool Effectiveness
371
+ | Tool | Calls | Success | Duration |
372
+ |------|-------|---------|----------|
373
+ | get_file_content | 5 | 100% | 450ms |
374
+ | get_recent_commits | 3 | 100% | 230ms |
375
+ | get_related_tests | 2 | 100% | 180ms |
376
+
377
+ ## Conversation History
378
+ [Full AI interaction log]
379
+
380
+ ## Generated Output
381
+ [Final commit message]
382
+ ```
383
+
384
+ ### Debug Files
385
+
386
+ Enable with `--debug`:
387
+
388
+ **output/request-*.json**:
389
+ ```json
390
+ {
391
+ "model": "gpt-4o",
392
+ "messages": [...],
393
+ "tools": [...]
394
+ }
395
+ ```
396
+
397
+ **output/response-*.json**:
398
+ ```json
399
+ {
400
+ "choices": [...],
401
+ "usage": {
402
+ "prompt_tokens": 12450,
403
+ "completion_tokens": 235
404
+ }
405
+ }
406
+ ```
407
+
408
+ ## Best Practices
409
+
410
+ ### For Commit Messages
411
+
412
+ 1. **Enable self-reflection** to improve quality
413
+ 2. **Use context files** for complex features
414
+ 3. **Allow commit splitting** for mixed changes
415
+ 4. **Review interactive** for important commits
416
+ 5. **Check recent commits** to avoid duplicates
417
+
418
+ ### For Release Notes
419
+
420
+ 1. **Always use context files** for comprehensive notes
421
+ 2. **Set release focus** to guide framing
422
+ 3. **Enable self-reflection** to see analysis depth
423
+ 4. **Use interactive mode** to refine
424
+ 5. **Check breaking changes** are highlighted
425
+
426
+ ### For Team Use
427
+
428
+ 1. **Document guidelines** in `.kodrdriv/personas/`
429
+ 2. **Set consistent models** in config
430
+ 3. **Enable verbose** mode for transparency
431
+ 4. **Use dry-run** mode for training
432
+ 5. **Review self-reflection** reports regularly
433
+
434
+ ## Troubleshooting AI Issues
435
+
436
+ ### AI Output is Too Verbose
437
+
438
+ ```yaml
439
+ commit:
440
+ maxAgenticIterations: 6 # Reduce investigation depth
441
+ ```
442
+
443
+ ### AI Output is Too Shallow
444
+
445
+ ```yaml
446
+ commit:
447
+ maxAgenticIterations: 15 # More investigation
448
+ contextFiles: ["docs/IMPL.md"] # More context
449
+ ```
450
+
451
+ ### AI Misunderstands Changes
452
+
453
+ ```bash
454
+ # Pass explicit context
455
+ kodrdriv commit --context "This refactors auth for testability"
456
+
457
+ # Or context files
458
+ kodrdriv commit --context-files ARCHITECTURE.md
459
+ ```
460
+
461
+ ### AI Uses Wrong Tone
462
+
463
+ Customize persona in `.kodrdriv/personas/committer.md`:
464
+ ```markdown
465
+ You write terse, technical commit messages.
466
+ Focus on changed behavior, not implementation details.
467
+ ```
468
+
469
+ ### Tool Calls Fail
470
+
471
+ Check self-reflection report:
472
+ ```bash
473
+ kodrdriv commit --self-reflection --verbose
474
+ cat output/agentic-reflection-commit-*.md
475
+ # Look for tool failures
476
+ ```
477
+
478
+ ## Advanced: Understanding Tool Selection
479
+
480
+ The AI chooses tools based on what would help write better output:
481
+
482
+ **Scenario**: Large refactoring (15 files changed)
483
+
484
+ ```
485
+ AI thinking: "Many files changed. Let me group them first."
486
+ → group_files_by_concern(all files)
487
+ Returns: "Auth module (5 files), Database (3 files), Tests (7 files)"
488
+
489
+ AI: "This might be separate concerns. Let me check dependencies."
490
+ → get_file_dependencies(auth files)
491
+ Returns: "Used by api.ts, user.ts"
492
+
493
+ AI: "Significant changes. Let me check tests."
494
+ → get_related_tests(auth files)
495
+ Returns: "auth.test.ts, integration.test.ts"
496
+
497
+ AI: "I understand. This is a unified refactor with tests."
498
+ → Writes single commit message covering all changes
499
+ ```
500
+
501
+ ## Next Steps
502
+
503
+ - **[Debugging Guide](./debugging.md)** - Troubleshoot AI issues
504
+ - **[Configuration Guide](./configuration.md)** - Fine-tune AI behavior
505
+ - **[Development Guide](./development.md)** - Extend the AI system
506
+ - **[Commands Reference](./commands.md)** - All available commands
507
+
508
+ ## Quick Reference
509
+
510
+ | Setting | Purpose | Values |
511
+ |---------|---------|--------|
512
+ | `model` | AI model to use | gpt-4o, gpt-4o-mini |
513
+ | `openaiReasoning` | Reasoning depth | low, medium, high |
514
+ | `maxAgenticIterations` | Analysis depth | 5-50 (default: 10/30) |
515
+ | `selfReflection` | Generate reports | true/false |
516
+ | `contextFiles` | Additional context | File paths |
517
+
518
+ The AI system is designed to be transparent, controllable, and effective. Use self-reflection reports to understand and improve its decision-making over time.
519
+