@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,346 @@
1
+ # Architecture Guide
2
+
3
+ Understanding kodrdriv's system design.
4
+
5
+ For complete architecture documentation, see: [`docs/public/architecture.md`](../docs/public/architecture.md)
6
+
7
+ ## System Overview
8
+
9
+ ```
10
+ ┌─────────────────────────────────────────────────┐
11
+ │ kodrdriv CLI │
12
+ │ (Main entry point, argument parsing, routing) │
13
+ └─────────────────┬───────────────────────────────┘
14
+
15
+ ┌─────────┴──────────┬──────────────┐
16
+ │ │ │
17
+ ┌───────▼───────┐ ┌────────▼────────┐ │
18
+ │ Commands │ │ Utilities │ │
19
+ │ ─────────────│ │ ───────────────│ │
20
+ │ - commit │ │ - aiAdapter │ │
21
+ │ - release │ │ - storage │ │
22
+ │ - publish │ │ - git ops │ │
23
+ │ - review │ │ - logging │ │
24
+ │ - tree │ │ - interactive │ │
25
+ │ - audio-* │ │ - validation │ │
26
+ └───────┬───────┘ └────────┬────────┘ │
27
+ │ │ │
28
+ └──────┬─────────────┘ │
29
+ │ │
30
+ ┌──────────▼──────────┬─────────────────▼──────┐
31
+ │ │ │
32
+ ┌───▼───────────┐ ┌──────▼─────────┐ ┌──────────▼────────┐
33
+ │ ai-service │ │ git-tools │ │ github-tools │
34
+ │ ─────────────│ │ ──────────────│ │ ─────────────────│
35
+ │ - Agentic AI │ │ - Git ops │ │ - API wrapper │
36
+ │ - Prompts │ │ - Validation │ │ - PR management │
37
+ │ - Tools │ │ - History │ │ - Issues │
38
+ └───────────────┘ └────────────────┘ └───────────────────┘
39
+ ```
40
+
41
+ ## Package Structure
42
+
43
+ ### Core Packages
44
+
45
+ **@eldrforge/kodrdriv** (main package)
46
+ - CLI interface
47
+ - Command implementations
48
+ - Configuration management
49
+ - Workflow orchestration
50
+
51
+ **@eldrforge/ai-service** (AI integration)
52
+ - Agentic AI system with tool-calling
53
+ - Prompt engineering
54
+ - OpenAI API integration
55
+ - Interactive workflows
56
+
57
+ **@eldrforge/tree-core** (dependency analysis)
58
+ - Dependency graph algorithms
59
+ - Topological sorting
60
+ - Package discovery
61
+
62
+ **@eldrforge/tree-execution** (parallel execution)
63
+ - Parallel task execution
64
+ - Checkpoint/recovery system
65
+ - Progress monitoring
66
+
67
+ **@eldrforge/git-tools** (Git operations)
68
+ - Git command wrappers
69
+ - History parsing
70
+ - Diff processing
71
+
72
+ **@eldrforge/github-tools** (GitHub integration)
73
+ - GitHub API wrapper
74
+ - PR management
75
+ - Issue handling
76
+ - Release creation
77
+
78
+ **@eldrforge/audio-tools** (audio processing)
79
+ - Audio recording
80
+ - Device selection
81
+ - File processing
82
+
83
+ **@eldrforge/shared** (common utilities)
84
+ - Storage utilities
85
+ - Date/time functions
86
+ - Validation helpers
87
+ - Logging infrastructure
88
+
89
+ ## Data Flow
90
+
91
+ ### Commit Generation Flow
92
+
93
+ ```
94
+ 1. User runs: kodrdriv commit --sendit
95
+
96
+ 2. Argument Parsing
97
+ CLI args → Config loading → Validation
98
+
99
+ 3. Git Operations
100
+ Get diff → Get history → Get status
101
+
102
+ 4. Context Gathering
103
+ Read changed files → Check GitHub issues → Load context files
104
+
105
+ 5. AI Analysis (Agentic)
106
+ Initialize tools → AI investigates → Tools execute → AI writes message
107
+
108
+ 6. Post-Processing
109
+ Filter sensitive info → Save to output → Display to user
110
+
111
+ 7. Execution
112
+ Create commit → Push (if configured)
113
+ ```
114
+
115
+ ### Release Notes Flow
116
+
117
+ ```
118
+ 1. User runs: kodrdriv release
119
+
120
+ 2. Configuration & Setup
121
+ Load config → Determine refs (from/to) → Set up storage
122
+
123
+ 3. Git Analysis
124
+ Get commit log → Generate diff → Check tags
125
+
126
+ 4. GitHub Integration
127
+ Get milestone issues → Check closed PRs → Get release history
128
+
129
+ 5. Context Gathering
130
+ Load context files → Scan directories → Prepare prompts
131
+
132
+ 6. AI Analysis (Agentic)
133
+ Initialize 13 tools → AI investigates → Generate notes
134
+
135
+ 7. Output
136
+ Filter content → Save files → Display notes
137
+ ```
138
+
139
+ ### Publish Workflow
140
+
141
+ ```
142
+ 1. Pre-checks
143
+ Validate environment → Check working directory → Load config
144
+
145
+ 2. Generate Release Notes
146
+ Run release command → Review (if interactive)
147
+
148
+ 3. Create PR
149
+ Push branch → Create PR → Add labels
150
+
151
+ 4. Wait for Checks
152
+ Monitor CI status → Handle timeouts → User confirmation
153
+
154
+ 5. Merge
155
+ Merge PR → Checkout target → Pull latest
156
+
157
+ 6. Create Release
158
+ Create tag → Push tag → Create GitHub release → Close milestone
159
+
160
+ 7. Version Bump
161
+ Merge target to source → Bump version → Push changes
162
+ ```
163
+
164
+ ## Key Components
165
+
166
+ ### Agentic System
167
+
168
+ Located in `ai-service/src/agentic/`:
169
+ - `executor.ts` - Main agentic loop
170
+ - `commit.ts` - Commit message generation
171
+ - `release.ts` - Release notes generation
172
+ - `publish.ts` - Publish workflow automation
173
+
174
+ **How it works**:
175
+ 1. AI receives task and available tools
176
+ 2. AI decides which tools to use
177
+ 3. Tools execute and return results
178
+ 4. AI uses results to make next decision
179
+ 5. Repeats until AI has enough information
180
+ 6. AI generates final output
181
+
182
+ ### Tool System
183
+
184
+ Located in `ai-service/src/tools/`:
185
+ - `registry.ts` - Tool registration and management
186
+ - `commit-tools.ts` - 8 tools for commits
187
+ - `release-tools.ts` - 13 tools for releases
188
+
189
+ **Tool interface**:
190
+ ```typescript
191
+ {
192
+ name: "get_file_content",
193
+ description: "Read complete file contents",
194
+ parameters: {...},
195
+ execute: async (params) => { ... }
196
+ }
197
+ ```
198
+
199
+ ### Prompt System
200
+
201
+ Located in `ai-service/src/prompts/`:
202
+ - `commit.ts` - Commit prompt builder
203
+ - `release.ts` - Release prompt builder
204
+ - `review.ts` - Review prompt builder
205
+ - `instructions/*.md` - Instruction templates
206
+
207
+ Uses **RiotPrompt** for structured prompt engineering.
208
+
209
+ ### Configuration System
210
+
211
+ Located in `kodrdriv/src/`:
212
+ - `arguments.ts` - CLI argument parsing
213
+ - `types.ts` - TypeScript types & Zod schemas
214
+ - `constants.ts` - Default values
215
+
216
+ Uses **CardiganTime** for hierarchical configuration.
217
+
218
+ ## Design Principles
219
+
220
+ ### 1. AI-First
221
+
222
+ Every text generation operation uses AI with tools for investigation. No hard-coded templates or mechanical text generation.
223
+
224
+ ### 2. Fail-Safe
225
+
226
+ - Dry-run mode for all operations
227
+ - Comprehensive validation
228
+ - Graceful error handling
229
+ - Recovery from failures
230
+
231
+ ### 3. Modular
232
+
233
+ Each package has a single responsibility:
234
+ - `kodrdriv` - CLI and orchestration
235
+ - `ai-service` - AI intelligence
236
+ - `tree-*` - Multi-package operations
237
+ - `git-tools` - Git operations
238
+ - `github-tools` - GitHub operations
239
+
240
+ ### 4. Testable
241
+
242
+ - Mocked external APIs
243
+ - Dependency injection
244
+ - Isolated components
245
+ - Comprehensive test suites
246
+
247
+ ### 5. Configurable
248
+
249
+ - Hierarchical configuration
250
+ - Command-line overrides
251
+ - Environment-based settings
252
+ - Per-command customization
253
+
254
+ ## Performance Characteristics
255
+
256
+ ### Commit Generation
257
+
258
+ **Time**: 5-15 seconds
259
+ - Git operations: ~1s
260
+ - AI analysis: 3-10s (depends on iterations)
261
+ - Post-processing: <1s
262
+
263
+ **API Cost**: $0.01-0.05 per commit (gpt-4o-mini)
264
+
265
+ ### Release Notes Generation
266
+
267
+ **Time**: 15-45 seconds
268
+ - Git operations: ~2s
269
+ - GitHub API: 1-3s
270
+ - AI analysis: 10-35s (depends on iterations and tools)
271
+ - Post-processing: <1s
272
+
273
+ **API Cost**: $0.05-0.20 per release (gpt-4o-mini)
274
+
275
+ ### Tree Operations (10 packages)
276
+
277
+ **Sequential**: 5-20 minutes
278
+ **Parallel (4 concurrent)**: 2-8 minutes
279
+
280
+ Depends on command being executed.
281
+
282
+ ## Security Considerations
283
+
284
+ ### Secrets Management
285
+
286
+ - API keys via environment variables only
287
+ - No secrets in configuration files
288
+ - Stop-context filtering for output
289
+ - Validation of all external inputs
290
+
291
+ ### File System
292
+
293
+ - Operations scoped to project directory
294
+ - Validation of all file paths
295
+ - No arbitrary code execution
296
+ - Safe handling of symlinks
297
+
298
+ ### External APIs
299
+
300
+ - Validated API responses
301
+ - Error wrapping
302
+ - Rate limiting awareness
303
+ - Timeout protection
304
+
305
+ ## Extensibility
306
+
307
+ ### Adding Commands
308
+
309
+ 1. Create module in `src/commands/`
310
+ 2. Add type definitions in `src/types.ts`
311
+ 3. Register in `src/main.ts`
312
+ 4. Add CLI interface in `src/arguments.ts`
313
+
314
+ ### Adding AI Tools
315
+
316
+ 1. Define tool in `ai-service/src/tools/`
317
+ 2. Register in appropriate tool set
318
+ 3. Update prompts to reference new tool
319
+
320
+ ### Adding Integrations
321
+
322
+ 1. Create utility module
323
+ 2. Add configuration options
324
+ 3. Handle authentication
325
+ 4. Implement error handling
326
+
327
+ ## Implementation References
328
+
329
+ Detailed implementation documentation in root directory:
330
+
331
+ - **AI System**: `AI-SERVICE-INTEGRATION-COMPLETE.md`
332
+ - **Tree Operations**: `TREE-TOOLKIT-COMPLETE.md`
333
+ - **Parallel Execution**: `PARALLEL-PUBLISH-QUICK-REFERENCE.md`
334
+ - **Prompt Engineering**: `RIOTPROMPT-COMPLETE-SUMMARY.md`
335
+ - **Monorepo Workflows**: `MONOREPO-PUBLISH-IMPROVEMENTS.md`
336
+ - **Recovery System**: `CHECKPOINT-RECOVERY-FIX.md`
337
+
338
+ ## Next Steps
339
+
340
+ - **[Development Guide](./development.md)** - Build and extend kodrdriv
341
+ - **[Testing Guide](./testing.md)** - Test structure and execution
342
+ - **[AI System Guide](./ai-system.md)** - Deep dive into AI
343
+ - **[Full Architecture Docs](../docs/public/architecture.md)** - Complete details
344
+
345
+ This architecture enables kodrdriv to be powerful, reliable, and extensible while maintaining simplicity for end users.
346
+
@@ -0,0 +1,380 @@
1
+ # Commands Reference
2
+
3
+ Quick reference for all kodrdriv commands.
4
+
5
+ For complete documentation, see: [`docs/public/commands.md`](../docs/public/commands.md)
6
+
7
+ ## Core Commands
8
+
9
+ ### commit
10
+ Generate intelligent commit messages.
11
+
12
+ ```bash
13
+ kodrdriv commit [direction] [options]
14
+ ```
15
+
16
+ **Common options**:
17
+ - `--sendit` - Auto-commit without review
18
+ - `--interactive` - Review and edit before committing
19
+ - `--context-files FILES` - Pass context files
20
+ - `--self-reflection` - Generate analysis report
21
+ - `--add` - Stage all changes first
22
+ - `--cached` - Use staged changes
23
+ - `--amend` - Amend last commit
24
+ - `--push [remote]` - Push after committing
25
+
26
+ **Examples**:
27
+ ```bash
28
+ # Basic usage
29
+ kodrdriv commit --sendit
30
+
31
+ # With context
32
+ kodrdriv commit "fixing auth bug" --sendit
33
+
34
+ # With context files
35
+ kodrdriv commit --context-files IMPL.md --interactive
36
+
37
+ # Review first
38
+ kodrdriv commit --interactive
39
+ ```
40
+
41
+ [Full Documentation](../docs/public/commands/commit.md)
42
+
43
+ ### release
44
+ Generate comprehensive release notes.
45
+
46
+ ```bash
47
+ kodrdriv release [options]
48
+ ```
49
+
50
+ **Common options**:
51
+ - `--from REF` - Start reference (default: last tag)
52
+ - `--to REF` - End reference (default: HEAD)
53
+ - `--context-files FILES` - Pass context files
54
+ - `--self-reflection` - Generate analysis report
55
+ - `--interactive` - Review and edit notes
56
+ - `--no-milestones` - Disable milestone integration
57
+ - `--from-main` - Compare against main instead of tag
58
+
59
+ **Examples**:
60
+ ```bash
61
+ # Basic usage
62
+ kodrdriv release
63
+
64
+ # With context
65
+ kodrdriv release --context-files CHANGELOG.md
66
+
67
+ # Custom range
68
+ kodrdriv release --from v1.0.0 --to v1.1.0
69
+
70
+ # Interactive review
71
+ kodrdriv release --interactive --self-reflection
72
+ ```
73
+
74
+ [Full Documentation](../docs/public/commands/release.md)
75
+
76
+ ### publish
77
+ Automate complete release workflow.
78
+
79
+ ```bash
80
+ kodrdriv publish [options]
81
+ ```
82
+
83
+ **What it does**:
84
+ 1. Generates release notes
85
+ 2. Creates pull request
86
+ 3. Waits for CI checks
87
+ 4. Merges to target branch
88
+ 5. Creates GitHub release
89
+ 6. Bumps to next dev version
90
+
91
+ **Common options**:
92
+ - `--sendit` - Skip all confirmations
93
+ - `--target-version VERSION` - Override version
94
+ - `--context-files FILES` - Pass context files
95
+ - `--interactive` - Review release notes
96
+ - `--merge-method METHOD` - merge/squash/rebase
97
+ - `--from REF` - Start reference
98
+ - `--target-branch BRANCH` - Target branch (default: main)
99
+
100
+ **Examples**:
101
+ ```bash
102
+ # Interactive release
103
+ kodrdriv publish --interactive
104
+
105
+ # Automated release
106
+ kodrdriv publish --sendit
107
+
108
+ # With context
109
+ kodrdriv publish --context-files MIGRATION.md
110
+
111
+ # Patch release
112
+ kodrdriv publish --target-version patch
113
+
114
+ # From specific tag
115
+ kodrdriv publish --from v1.0.0
116
+ ```
117
+
118
+ [Full Documentation](../docs/public/commands/publish.md)
119
+
120
+ ## Audio Commands
121
+
122
+ ### audio-commit
123
+ Record audio for commit context.
124
+
125
+ ```bash
126
+ kodrdriv audio-commit [options]
127
+ ```
128
+
129
+ **Examples**:
130
+ ```bash
131
+ # Record and commit
132
+ kodrdriv audio-commit --sendit
133
+
134
+ # Use existing file
135
+ kodrdriv audio-commit --file recording.m4a
136
+ ```
137
+
138
+ [Full Documentation](../docs/public/commands/audio-commit.md)
139
+
140
+ ### audio-review
141
+ Record audio for code review.
142
+
143
+ ```bash
144
+ kodrdriv audio-review [options]
145
+ ```
146
+
147
+ **Examples**:
148
+ ```bash
149
+ # Record review
150
+ kodrdriv audio-review --sendit
151
+
152
+ # Process file
153
+ kodrdriv audio-review --file review.m4a
154
+ ```
155
+
156
+ [Full Documentation](../docs/public/commands/audio-review.md)
157
+
158
+ ### review
159
+ Analyze text for project issues.
160
+
161
+ ```bash
162
+ kodrdriv review [note] [options]
163
+ ```
164
+
165
+ **Examples**:
166
+ ```bash
167
+ # Inline note
168
+ kodrdriv review "Need to add error handling in API layer"
169
+
170
+ # From file
171
+ kodrdriv review --file notes.txt --sendit
172
+
173
+ # From stdin
174
+ cat review.txt | kodrdriv review --sendit
175
+ ```
176
+
177
+ [Full Documentation](../docs/public/commands/review.md)
178
+
179
+ ## Tree Commands
180
+
181
+ ### tree
182
+ Execute commands across multiple packages.
183
+
184
+ ```bash
185
+ kodrdriv tree [command] [options]
186
+ ```
187
+
188
+ **Built-in commands**:
189
+ - `commit` - Generate commits for all packages
190
+ - `publish` - Publish all packages in order
191
+ - `precommit` - Run checks across packages
192
+ - `link` - Create local development links
193
+ - `unlink` - Remove local links
194
+ - `run` - Custom command (use --cmd)
195
+
196
+ **Common options**:
197
+ - `--parallel` - Execute in parallel
198
+ - `--max-concurrency N` - Limit parallelism
199
+ - `--directories DIRS` - Target directories
200
+ - `--continue` - Resume after failure
201
+ - `--status` - Check execution status
202
+
203
+ **Examples**:
204
+ ```bash
205
+ # Sequential publish
206
+ kodrdriv tree publish
207
+
208
+ # Parallel publish
209
+ kodrdriv tree publish --parallel --max-concurrency 4
210
+
211
+ # Custom command
212
+ kodrdriv tree --cmd "npm test"
213
+
214
+ # Resume after failure
215
+ kodrdriv tree publish --continue
216
+
217
+ # Link for development
218
+ kodrdriv tree link
219
+ ```
220
+
221
+ ### link / unlink
222
+ Manage local package dependencies.
223
+
224
+ ```bash
225
+ kodrdriv link [package]
226
+ kodrdriv unlink [package]
227
+ ```
228
+
229
+ **Examples**:
230
+ ```bash
231
+ # Link all in tree
232
+ kodrdriv tree link
233
+
234
+ # Link specific scope
235
+ kodrdriv link @myorg
236
+
237
+ # Unlink all
238
+ kodrdriv tree unlink
239
+ ```
240
+
241
+ [Full Documentation](../docs/public/commands/link.md)
242
+
243
+ ## Utility Commands
244
+
245
+ ### precommit
246
+ Run lint + build + test.
247
+
248
+ ```bash
249
+ kodrdriv precommit
250
+ ```
251
+
252
+ Uses optimization to skip unchanged steps.
253
+
254
+ ### clean
255
+ Remove output directory.
256
+
257
+ ```bash
258
+ kodrdriv clean
259
+ ```
260
+
261
+ Removes all generated files.
262
+
263
+ ### select-audio
264
+ Configure audio recording device.
265
+
266
+ ```bash
267
+ kodrdriv select-audio
268
+ ```
269
+
270
+ One-time setup for audio commands.
271
+
272
+ ## Global Options
273
+
274
+ Available on all commands:
275
+
276
+ | Option | Purpose |
277
+ |--------|---------|
278
+ | `--dry-run` | Preview without changes |
279
+ | `--verbose` | Detailed logging |
280
+ | `--debug` | Maximum logging + debug files |
281
+ | `--model MODEL` | Override AI model |
282
+ | `--openai-reasoning LEVEL` | Set reasoning depth (low/medium/high) |
283
+ | `-d, --context-directories DIRS` | Add context directories |
284
+ | `--config-dir DIR` | Specify config directory |
285
+ | `--output-dir DIR` | Override output directory |
286
+
287
+ ## Command Combinations
288
+
289
+ ### Development Workflow
290
+
291
+ ```bash
292
+ # Daily work
293
+ kodrdriv commit --sendit
294
+
295
+ # Weekly release
296
+ kodrdriv release --context-files WEEKLY-NOTES.md
297
+ ```
298
+
299
+ ### Release Workflow
300
+
301
+ ```bash
302
+ # Test locally
303
+ kodrdriv release --dry-run --self-reflection
304
+
305
+ # Generate notes
306
+ kodrdriv release --context-files CHANGELOG.md
307
+
308
+ # Publish
309
+ kodrdriv publish --interactive
310
+ ```
311
+
312
+ ### Monorepo Workflow
313
+
314
+ ```bash
315
+ # Setup
316
+ kodrdriv tree link
317
+
318
+ # Develop
319
+ kodrdriv tree precommit
320
+
321
+ # Release
322
+ kodrdriv tree publish --parallel --context-files MIGRATION.md
323
+
324
+ # Cleanup
325
+ kodrdriv tree unlink
326
+ ```
327
+
328
+ ## Exit Codes
329
+
330
+ | Code | Meaning |
331
+ |------|---------|
332
+ | 0 | Success |
333
+ | 1 | General error |
334
+ | 2 | Configuration error |
335
+ | 130 | User cancellation (Ctrl+C) |
336
+
337
+ ## Environment Variables
338
+
339
+ | Variable | Purpose | Required |
340
+ |----------|---------|----------|
341
+ | `OPENAI_API_KEY` | OpenAI authentication | Yes |
342
+ | `GITHUB_TOKEN` | GitHub API authentication | For publish |
343
+ | `KODRDRIV_CONFIG` | Config file path | No |
344
+
345
+ ## Quick Command Reference
346
+
347
+ ```
348
+ ┌─ Generate ───────────────────────────┐
349
+ │ commit Commit messages │
350
+ │ release Release notes │
351
+ │ review Issue analysis │
352
+ └──────────────────────────────────────┘
353
+
354
+ ┌─ Automate ───────────────────────────┐
355
+ │ publish Complete release flow │
356
+ │ tree Multi-package operations│
357
+ └──────────────────────────────────────┘
358
+
359
+ ┌─ Audio ──────────────────────────────┐
360
+ │ audio-commit Voice-driven commits │
361
+ │ audio-review Voice-driven reviews │
362
+ │ select-audio Configure device │
363
+ └──────────────────────────────────────┘
364
+
365
+ ┌─ Utilities ──────────────────────────┐
366
+ │ precommit Lint + build + test │
367
+ │ link/unlink Package management │
368
+ │ clean Remove output files │
369
+ └──────────────────────────────────────┘
370
+ ```
371
+
372
+ ## Next Steps
373
+
374
+ - **[Usage Guide](./usage.md)** - Common patterns
375
+ - **[Configuration Guide](./configuration.md)** - All options
376
+ - **[AI System Guide](./ai-system.md)** - How AI works
377
+ - **[Integration Guide](./integration.md)** - Setup for your project
378
+
379
+ For detailed command documentation, see the [`docs/public/commands/`](../docs/public/commands/) directory.
380
+