@eldrforge/kodrdriv 0.0.9 → 0.0.10

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/README.md +65 -707
  2. package/dist/arguments.js +79 -55
  3. package/dist/arguments.js.map +1 -1
  4. package/dist/commands/commit.js +28 -16
  5. package/dist/commands/commit.js.map +1 -1
  6. package/dist/commands/link.js +18 -18
  7. package/dist/commands/link.js.map +1 -1
  8. package/dist/commands/publish.js +170 -93
  9. package/dist/commands/publish.js.map +1 -1
  10. package/dist/commands/release.js +8 -0
  11. package/dist/commands/release.js.map +1 -1
  12. package/dist/commands/unlink.js +20 -20
  13. package/dist/commands/unlink.js.map +1 -1
  14. package/dist/constants.js +4 -2
  15. package/dist/constants.js.map +1 -1
  16. package/dist/logging.js +35 -23
  17. package/dist/logging.js.map +1 -1
  18. package/dist/main.js +49 -3
  19. package/dist/main.js.map +1 -1
  20. package/dist/util/child.js +13 -1
  21. package/dist/util/child.js.map +1 -1
  22. package/docs/index.html +17 -0
  23. package/docs/package.json +36 -0
  24. package/docs/public/README.md +132 -0
  25. package/docs/public/advanced-usage.md +188 -0
  26. package/docs/public/code-icon.svg +4 -0
  27. package/docs/public/commands.md +116 -0
  28. package/docs/public/configuration.md +274 -0
  29. package/docs/public/examples.md +352 -0
  30. package/docs/public/kodrdriv-logo.svg +62 -0
  31. package/docs/src/App.css +387 -0
  32. package/docs/src/App.tsx +60 -0
  33. package/docs/src/components/DocumentPage.tsx +56 -0
  34. package/docs/src/components/ErrorMessage.tsx +15 -0
  35. package/docs/src/components/LoadingSpinner.tsx +14 -0
  36. package/docs/src/components/MarkdownRenderer.tsx +56 -0
  37. package/docs/src/components/Navigation.css +73 -0
  38. package/docs/src/components/Navigation.tsx +36 -0
  39. package/docs/src/index.css +61 -0
  40. package/docs/src/main.tsx +10 -0
  41. package/docs/src/test/setup.ts +1 -0
  42. package/docs/src/vite-env.d.ts +10 -0
  43. package/docs/tsconfig.node.json +13 -0
  44. package/docs/vite.config.ts +15 -0
  45. package/docs/vitest.config.ts +15 -0
  46. package/eslint.config.mjs +1 -0
  47. package/package.json +10 -5
  48. package/vitest.config.ts +3 -3
package/README.md CHANGED
@@ -1,769 +1,127 @@
1
1
  # KodrDriv
2
2
 
3
- KodrDriv is a powerful utility designed to automatically generate intelligent release notes and change logs from your Git repository. It analyzes commit history, pull requests, and related metadata to create comprehensive, well-structured documentation of your project's evolution. By leveraging advanced parsing and analysis techniques, it helps teams maintain clear visibility into their codebase's development history while reducing the manual effort typically required for changelog maintenance.
3
+ KodrDriv is a powerful utility designed to automatically generate intelligent release notes and commit messages from your Git repository. It analyzes commit history, pull requests, and related metadata to create comprehensive, well-structured documentation of your project's evolution. By leveraging advanced AI-powered analysis, it helps teams maintain clear visibility into their codebase's development history while reducing the manual effort typically required for changelog maintenance.
4
4
 
5
- ## Installation
6
-
7
- Install KodrDriv globally using npm:
8
-
9
- ```bash
10
- npm install -g @eldrforge/kodrdriv
11
- ```
12
-
13
- This will make the `kodrdriv` command available globally on your system.
14
-
15
- ## Commands
16
-
17
- KodrDriv provides four main commands:
18
-
19
- ### Commit Command
20
-
21
- Generate intelligent commit messages:
22
-
23
- ```bash
24
- kodrdriv commit
25
- ```
26
-
27
- > [!TIP]
28
- > ### Working with Staged Changes
29
- >
30
- > When you have staged changes using `git add`, the `kodrdriv commit` command will automatically analyze the diff of your staged changes. This allows you to selectively stage files and generate a commit message that specifically addresses those changes, rather than all uncommitted changes in your working directory.
31
-
32
- > [!TIP]
33
- > ### Quick Commit with --sendit
34
- >
35
- > If you trust the quality of the generated commit messages, you can use the `--sendit` flag to automatically commit your changes with the generated message without review. This is useful for quick, routine changes where you want to streamline your workflow.
36
-
37
-
38
- ### Release Command
39
-
40
- Generate comprehensive release notes based on changes since the last release:
41
-
42
- ```bash
43
- kodrdriv release
44
- ```
45
-
46
- > [!TIP]
47
- > ### Custom Release Range
48
- >
49
- > The `kodrdriv release` command supports customizing the range of commits to analyze using the `--from` and `--to` options. By default, it compares changes between the `main` branch and `HEAD`, but you can specify any valid Git reference (branch, tag, or commit hash) for either endpoint. This flexibility allows you to generate release notes for specific version ranges or between different branches.
50
-
51
- > [!TIP]
52
- > ### Comparing Releases
53
- >
54
- > You can use the `--from` and `--to` options to generate release notes comparing two different releases. For example, to see what changed between v1.0.0 and v1.1.0, you could use `kodrdriv release --from v1.0.0 --to v1.1.0`. This is particularly useful for creating detailed changelogs when preparing release documentation.
55
-
56
- ### Publish Command
57
-
58
- Automate the entire release process, from dependency updates to GitHub release creation:
59
-
60
- ```bash
61
- kodrdriv publish
62
- ```
63
-
64
- The `publish` command orchestrates a comprehensive release workflow, designed to ensure a safe and consistent release process. Here's what it does:
65
-
66
- 1. **Dependency Management**: If a `pnpm-workspace.yaml` file is present, it's temporarily renamed to switch from workspace dependencies to registry versions. It then runs `pnpm update --latest` to ensure dependencies are up to date. You can configure specific dependency patterns to update instead of updating all dependencies using the `dependencyUpdatePatterns` configuration option.
67
-
68
- 2. **Pre-flight Checks**: Before committing any changes, it runs the `prepublishOnly` script from your `package.json`. This script should contain your project's pre-flight checks (e.g., `clean`, `lint`, `build`, `test`) to ensure the project is in a good state. **Note**: A `prepublishOnly` script is required in your `package.json` - the publish command will fail if this script is not present.
69
-
70
- 3. **Release Commit**: If there are changes to `package.json` or `pnpm-lock.yaml`, it creates an intelligent commit message for the dependency updates.
71
-
72
- 4. **Version Bump**: It automatically bumps the patch version of your project.
73
-
74
- 5. **Release Notes**: It generates release notes based on the recent changes and saves them to `RELEASE_NOTES.md`.
75
-
76
- 6. **Pull Request Automation**:
77
- * It pushes the changes and tags to the origin.
78
- * It creates a new pull request for the release.
79
- * It waits for all status checks on the pull request to pass.
80
- * Once checks are complete, it automatically merges the pull request using the configured merge method (default: squash).
81
-
82
- 7. **GitHub Release**: After the PR is merged, it checks out the `main` branch, pulls the latest changes, and creates a new GitHub release with the tag and release notes.
83
-
84
- 8. **New Release Branch**: Finally, it creates and pushes a new release branch for the next version (e.g., `release/0.0.5`).
85
-
86
- This command is designed for repositories that follow a pull-request-based release workflow with required status checks. It streamlines the process, reducing manual steps and potential for error.
87
-
88
- > [!TIP]
89
- > ### Choosing the Right Merge Method
90
- >
91
- > The merge method you choose affects your Git history and can impact your team's workflow:
92
- >
93
- > - **Squash** (default): Best for keeping a clean, linear history. All commits from the feature branch are combined into a single commit, making it easier to understand what was changed in each release.
94
- >
95
- > - **Merge**: Preserves the complete commit history from the feature branch. Use this when you want to maintain detailed development history and individual commit information.
96
- >
97
- > - **Rebase**: Creates a linear history without merge commits. The commits from the feature branch are replayed on top of the target branch. This keeps history clean while preserving individual commits.
98
- >
99
- > Consider your team's preferences and any branch protection rules when choosing a merge method.
100
-
101
- ### Link Command
102
-
103
- Manage pnpm workspace links for local development with sibling projects:
104
-
105
- ```bash
106
- kodrdriv link
107
- ```
108
-
109
- The `link` command automates the creation and management of pnpm workspace configurations for local development. It scans your project's dependencies and automatically discovers matching sibling packages in configured scope directories, then updates your `pnpm-workspace.yaml` file to link them for local development.
110
-
111
- This is particularly useful when working with monorepos or related packages where you want to use local versions of dependencies instead of published registry versions during development.
112
-
113
- **How it works:**
114
-
115
- 1. **Dependency Analysis**: Reads your `package.json` and examines all dependencies (including devDependencies and peerDependencies)
116
-
117
- 2. **Scope-based Scanning**: For each configured scope (e.g., `@company`, `@myorg`), it scans the specified root directory to find all available packages by reading their `package.json` files
118
-
119
- 3. **Smart Matching**: Instead of relying on directory naming conventions, it matches dependencies by their actual package names from `package.json`, handling cases where directory names don't match package names
120
-
121
- 4. **Workspace Management**: Updates or creates a `pnpm-workspace.yaml` file with the discovered local packages, preserving any existing workspace configuration
122
-
123
- **Example Scenario:**
124
-
125
- Suppose you're working on `@company/api` and it depends on `@company/logging`. Your directory structure might look like:
126
-
127
- ```
128
- workspace/
129
- ├── company-api/ # Contains @company/api
130
- ├── company-logging-lib/ # Contains @company/logging (note: different directory name)
131
- └── other-project/
132
- ```
133
-
134
- The link command would:
135
- - Scan `../` for packages with scope `@company`
136
- - Find `@company/logging` in `../company-logging-lib/`
137
- - Update `pnpm-workspace.yaml` to include `../company-logging-lib`
138
-
139
- **Configuration Requirements:**
140
-
141
- The link command requires scope root mappings to be configured. You can provide these via:
142
-
143
- 1. **Command line**: `--scope-roots '{"@company": "../", "@myorg": "../../"}'`
144
- 2. **Configuration file**: Set `link.scopeRoots` in your `.kodrdriv/config.json`
145
-
146
- **Dry Run Support:**
147
-
148
- Use `--dry-run` to preview what packages would be linked without making changes:
149
-
150
- ```bash
151
- kodrdriv link --scope-roots '{"@company": "../"}' --dry-run
152
- ```
153
-
154
- > [!TIP]
155
- > ### Best Practices for Link Command
156
- >
157
- > - **Use relative paths**: Configure scope roots with relative paths (like `../` or `../../`) to ensure the workspace file works across different environments
158
- >
159
- > - **Scope organization**: Group related packages under the same scope (e.g., `@company/api`, `@company/logging`) for easier management
160
- >
161
- > - **Version with caution**: Consider whether to commit the generated `pnpm-workspace.yaml` file. You might want to add it to `.gitignore` if it's only for local development
162
- >
163
- > - **Multiple scopes**: You can configure multiple scope roots to handle packages from different organizations or teams in the same workspace
164
-
165
- ## Command Line Options
166
-
167
- KodrDriv provides several command line options to customize its behavior:
168
-
169
- ### Basic Options
170
-
171
- - `--dry-run`: Perform a dry run without saving files (default: false)
172
- - `--verbose`: Enable verbose logging (default: false)
173
- - `--debug`: Enable debug logging (default: false)
174
- - `--overrides`: Enable instruction overrides (allows custom instruction files to override defaults)
175
- - `--config-dir <configDir>`: Specify a custom configuration directory (default: '.kodrdriv')
176
- - `--excluded-paths [excludedPatterns...]`: Paths to exclude from the diff (can specify multiple patterns)
177
- - `--version`: Display version information
178
-
179
- ### Commit Command Options
180
-
181
- - `--cached`: Use cached diff for generating commit messages
182
- - `--sendit`: Commit with the generated message without review (default: false)
183
- - `--context <context>`: Provide additional context (as a string or file path) to guide the commit message generation. This context is included in the prompt sent to the AI and can be used to specify the purpose, theme, or any special considerations for the commit.
184
- - `--message-limit <messageLimit>`: Limit the number of recent commit messages (from git log) to include in the prompt for context (default: 10). This can help focus the AI on the most relevant recent changes.
185
-
186
- ### Publish Command Options
187
-
188
- - `--merge-method <method>`: Method to merge pull requests during the publish process (default: 'squash')
189
- - Available methods: 'merge', 'squash', 'rebase'
190
- - `merge`: Creates a merge commit that combines the feature branch into the target branch
191
- - `squash`: Combines all commits from the feature branch into a single commit on the target branch
192
- - `rebase`: Replays commits from the feature branch onto the target branch without creating a merge commit
193
-
194
- #### Dependency Update Configuration
195
-
196
- The publish command supports selective dependency updates through the `dependencyUpdatePatterns` configuration option. This allows you to specify which dependencies should be updated during the release process instead of updating all dependencies.
197
-
198
- **Configuration:**
199
- ```json
200
- {
201
- "publish": {
202
- "dependencyUpdatePatterns": ["@company/*", "@myorg/*", "specific-package"]
203
- }
204
- }
205
- ```
206
-
207
- **Behavior:**
208
- - When patterns are specified, only dependencies matching those patterns will be updated
209
- - Patterns can include npm scopes (e.g., `@company/*`) or specific package names
210
- - If no patterns are configured, all dependencies are updated (default behavior)
211
- - This is particularly useful when developing a set of related packages where you want to ensure you're using the latest versions of your organization's packages while keeping other dependencies stable
212
-
213
- #### Environment Variable Configuration
214
-
215
- The publish command includes comprehensive environment variable validation to ensure all required credentials and tokens are available before starting the release process. This prevents failures partway through the publication workflow.
216
-
217
- **Core Required Environment Variables:**
218
-
219
- The following environment variables are required by default for all publish operations:
220
-
221
- - `GITHUB_TOKEN`: Required for GitHub API operations (creating pull requests, releases, etc.)
222
- - `OPENAI_API_KEY`: Required for AI-powered commit message and release note generation
223
-
224
- **Configurable Additional Environment Variables:**
225
-
226
- You can specify additional required environment variables specific to your project or organization:
227
-
228
- **Configuration (config.yaml):**
229
- ```yaml
230
- publish:
231
- requiredEnvVars:
232
- - NODE_AUTH_TOKEN # Often needed for publishing to npm
233
- - DEPLOY_KEY # Custom deployment credentials
234
- - CUSTOM_API_TOKEN # Organization-specific tokens
235
- - CODECOV_TOKEN # Code coverage reporting
236
- ```
237
-
238
- **Configuration (config.json):**
239
- ```json
240
- {
241
- "publish": {
242
- "requiredEnvVars": [
243
- "NODE_AUTH_TOKEN",
244
- "DEPLOY_KEY",
245
- "CUSTOM_API_TOKEN",
246
- "CODECOV_TOKEN"
247
- ]
248
- }
249
- }
250
- ```
251
-
252
- **Automatic .npmrc Scanning:**
253
-
254
- The publish command automatically scans your `.npmrc` file for environment variable references and includes them in the validation. It detects common patterns like:
255
-
256
- - `${NODE_AUTH_TOKEN}` - Curly brace syntax
257
- - `$NODE_AUTH_TOKEN` - Direct variable reference
258
-
259
- Example `.npmrc` file:
260
- ```
261
- @myorg:registry=https://npm.pkg.github.com/
262
- //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
263
- ```
264
-
265
- In this case, `NODE_AUTH_TOKEN` would be automatically detected and validated.
266
-
267
- **Validation Behavior:**
268
- - All environment variable checks happen during the initial prechecks phase
269
- - If any required environment variables are missing, the publish command fails immediately with a clear error message
270
- - The error message lists all missing variables at once, making it easy to set them all before retrying
271
- - Variables from configuration, .npmrc scanning, and core requirements are combined and deduplicated
272
-
273
- **Example Error:**
274
- ```
275
- Missing required environment variables: NODE_AUTH_TOKEN, DEPLOY_KEY.
276
- Please set these environment variables before running publish.
277
- ```
278
-
279
- **Security Best Practices:**
280
- - Store sensitive environment variables in your CI/CD system's secure variable storage
281
- - Use tools like 1Password CLI, HashiCorp Vault, or similar for local development
282
- - Never commit environment variables or tokens to your repository
283
- - Consider using `.env` files (with proper .gitignore configuration) for local development
284
-
285
- #### Workspace Package Management
286
-
287
- The publish command provides options to control whether workspace packages should be linked or unlinked during the release process. Both operations are enabled by default for backward compatibility, but can be disabled if needed.
288
-
289
- **Configuration Options:**
290
-
291
- - `linkWorkspacePackages` (boolean, default: true): Controls whether to restore linked workspace packages after the publish process completes
292
- - `unlinkWorkspacePackages` (boolean, default: true): Controls whether to unlink workspace packages before starting the publish process
293
-
294
- **Configuration Example:**
295
- ```json
296
- {
297
- "publish": {
298
- "linkWorkspacePackages": false,
299
- "unlinkWorkspacePackages": false,
300
- "mergeMethod": "squash"
301
- }
302
- }
303
- ```
304
-
305
- **Use Cases:**
306
-
307
- - **Skip Unlinking**: Set `unlinkWorkspacePackages: false` if you want to publish using your current workspace configuration without switching to registry dependencies
308
- - **Skip Linking**: Set `linkWorkspacePackages: false` if you want to leave the project in a "release-ready" state after publishing, with registry dependencies instead of workspace links
309
- - **Skip Both**: Disable both options if you're managing workspace configuration manually or using a different dependency management strategy
310
-
311
- **Default Behavior:**
312
- When both options are enabled (default), the publish command will:
313
- 1. Unlink workspace packages before starting (switching to registry dependencies)
314
- 2. Perform the release process with registry dependencies
315
- 3. Restore workspace links after completion (returning to local development mode)
316
-
317
- This ensures that releases are published with proper registry dependencies while maintaining local development convenience.
5
+ ## What is KodrDriv?
318
6
 
319
- #### prepublishOnly Script Requirement
7
+ KodrDriv is an AI-powered Git workflow automation tool designed to solve the common problem of writing meaningful commit messages and release notes. It provides a unified way to:
320
8
 
321
- The publish command requires a `prepublishOnly` script to be defined in your `package.json`. This script should contain all the checks and builds necessary to verify your project is ready for release.
9
+ - **Generate intelligent commit messages** from your code changes
10
+ - **Create comprehensive release notes** automatically from Git history
11
+ - **Automate the entire release process** with pull request and GitHub integration
12
+ - **Manage workspace dependencies** for monorepo and multi-package development
13
+ - **Maintain consistent documentation** with minimal manual effort
322
14
 
323
- **Example package.json:**
324
- ```json
325
- {
326
- "scripts": {
327
- "prepublishOnly": "pnpm run clean && pnpm run lint && pnpm run build && pnpm run test",
328
- "clean": "rimraf dist",
329
- "lint": "eslint src/",
330
- "build": "tsc",
331
- "test": "vitest run"
332
- }
333
- }
334
- ```
335
-
336
- **Why prepublishOnly?**
337
- - The `prepublishOnly` script is an npm/pnpm standard that runs automatically before publishing packages
338
- - It ensures consistent pre-flight checks regardless of how the package is published
339
- - It allows projects to define their own specific validation pipeline
340
- - The publish command validates this script exists during the initial prechecks phase
341
-
342
- **Common prepublishOnly Patterns:**
343
- - `"prepublishOnly": "npm run test"` - Run tests only
344
- - `"prepublishOnly": "npm run build && npm run test"` - Build and test
345
- - `"prepublishOnly": "npm run lint && npm run build && npm run test"` - Full validation pipeline
346
- - `"prepublishOnly": "npm run ci"` - Delegate to a CI script that includes all checks
347
-
348
- If this script is missing, the publish command will fail immediately with a helpful error message explaining the requirement.
15
+ ## Why KodrDriv?
349
16
 
350
- ### Link Command Options
17
+ Writing good commit messages and release notes is time-consuming and often done when you're least in the mood for reflection. **KodrDriv was created specifically to solve the "context switch" problem that happens when you've been deep in code and Git asks you to summarize what you've done.**
351
18
 
352
- - `--scope-roots <scopeRoots>`: JSON mapping of scopes to root directories for package discovery
353
- - **Format**: `'{"@scope": "path", "@another": "path"}'`
354
- - **Example**: `'{"@company": "../", "@myorg": "../../packages/"}'`
355
- - **Required**: At least one scope mapping must be provided
356
- - `--workspace-file <workspaceFile>`: Path to the workspace file to create/update (default: 'pnpm-workspace.yaml')
357
- - Can specify custom workspace file names or paths
358
- - Useful if your project uses non-standard workspace file naming
19
+ Without KodrDriv, you need to manually:
20
+ - Stop your flow to write commit messages
21
+ - Remember all the changes you made across multiple files
22
+ - Craft meaningful release notes from scattered commit messages
23
+ - Coordinate complex release workflows with multiple steps
359
24
 
360
- #### Scope Root Configuration
25
+ KodrDriv reads your code changes and Git history to automatically generate contextual, meaningful documentation that reflects your actual work.
361
26
 
362
- The `--scope-roots` option accepts a JSON object mapping package scopes to their corresponding root directories. Each entry tells the link command where to look for packages with that scope.
27
+ ## Installation
363
28
 
364
- **Configuration Examples:**
29
+ Install KodrDriv globally using npm:
365
30
 
366
31
  ```bash
367
- # Single scope
368
- kodrdriv link --scope-roots '{"@company": "../"}'
369
-
370
- # Multiple scopes with different paths
371
- kodrdriv link --scope-roots '{"@company": "../", "@tools": "../../tools/", "@shared": "../shared-packages/"}'
372
-
373
- # Absolute paths (not recommended for portability)
374
- kodrdriv link --scope-roots '{"@company": "/Users/dev/projects/company-packages/"}'
32
+ npm install -g @eldrforge/kodrdriv
375
33
  ```
376
34
 
377
- **Path Resolution:**
378
- - Relative paths are resolved from the current working directory
379
- - Use `../` to scan the parent directory
380
- - Use `../../` to scan two levels up
381
- - Multiple levels and subdirectories are supported: `../../company/packages/`
382
-
383
- **Package Discovery Process:**
384
- 1. For each scope root, the command lists all subdirectories
385
- 2. It reads each subdirectory's `package.json` to get the actual package name
386
- 3. It matches discovered package names against your project's dependencies
387
- 4. Matching packages are added to the workspace configuration
388
-
389
- This approach handles complex scenarios where:
390
- - Directory names don't match package names (e.g., `logging-lib` directory contains `@company/logging`)
391
- - Packages are organized in different directory structures
392
- - Multiple related packages exist in the same scope root
393
-
394
- ### OpenAI Configuration
395
-
396
- - `--openai-api-key <key>`: OpenAI API key (can also be set via OPENAI_API_KEY environment variable)
397
- - `--model <model>`: OpenAI model to use (default: 'gpt-4o-mini')
398
-
399
- > [!NOTE]
400
- > ### Security Considerations
401
- >
402
- > The OpenAI API key should be handled securely. While the `--openai-api-key` option is available, it's recommended to use environment variables instead. Git Intelligent Change automatically loads environment variables from a `.env` file in your current working directory.
403
- >
404
- > While environment variables are a common approach for configuration, they can still pose security risks if not properly managed. We strongly encourage users to utilize secure credential management solutions like 1Password, HashiCorp Vault, or other keystores to protect sensitive information. This helps prevent accidental exposure of API keys and other credentials in logs, process listings, or environment dumps.
405
-
406
- ### Content Configuration
407
-
408
- - `-c, --content-types [types...]`: Content types to include in the summary (default: ['diff'])
409
- - Available types: 'log', 'diff'
410
- - Can specify multiple types: `--content-types log diff`
35
+ This will make the `kodrdriv` command available globally on your system.
411
36
 
412
- ### Instructions
37
+ ## Quick Start
413
38
 
414
- - `-i, --instructions <file>`: Path to custom instructions file for the AI (default: './.kodrdriv/instructions.md')
39
+ Here's how to get started with KodrDriv:
415
40
 
416
- ### Examples
41
+ ### Generate a Commit Message
417
42
 
418
- Basic usage with default settings:
419
43
  ```bash
44
+ # Make some changes to your code
45
+ git add .
420
46
  kodrdriv commit
421
47
  ```
422
48
 
423
- Generate a commit message and automatically commit it:
424
- ```bash
425
- kodrdriv commit --sendit
426
- ```
49
+ ### Generate Release Notes
427
50
 
428
- Generate release notes:
429
51
  ```bash
52
+ # Generate release notes from your recent changes
430
53
  kodrdriv release
431
54
  ```
432
55
 
433
- Generate a summary including both git log and diff information:
434
- ```bash
435
- kodrdriv release --content-types log diff
436
- ```
437
-
438
- Run in verbose mode with a custom OpenAI model:
439
- ```bash
440
- kodrdriv commit --verbose --model gpt-4
441
- ```
442
-
443
- Use custom instructions from a file:
444
- ```bash
445
- kodrdriv release --instructions ./my-custom-instructions.md
446
- ```
447
-
448
- Use custom context and message limit:
449
- ```bash
450
- kodrdriv commit --context "Refactoring for performance" --message-limit 5
451
- kodrdriv release --context "Quarterly release, focus on stability" --message-limit 20
452
- ```
56
+ ### Automate Your Release Process
453
57
 
454
- Publish with different merge methods:
455
58
  ```bash
456
- # Use default squash merge
59
+ # Fully automated release with dependency updates, PR creation, and GitHub release
457
60
  kodrdriv publish
458
-
459
- # Use merge commit (preserves individual commits)
460
- kodrdriv publish --merge-method merge
461
-
462
- # Use rebase (clean linear history)
463
- kodrdriv publish --merge-method rebase
464
61
  ```
465
62
 
466
- Use excluded paths to filter diff content:
467
- ```bash
468
- # Exclude specific files or directories from diff analysis
469
- kodrdriv commit --excluded-paths "*.lock" "dist/" "node_modules/"
470
-
471
- # Exclude patterns from release notes
472
- kodrdriv release --excluded-paths "package-lock.json" "pnpm-lock.yaml"
473
- ```
63
+ ### Link Local Packages for Development
474
64
 
475
- Use overrides with custom instructions:
476
65
  ```bash
477
- # Enable instruction overrides (requires custom instruction files in .kodrdriv/instructions/)
478
- kodrdriv commit --overrides
479
-
480
- # Use custom config directory with overrides
481
- kodrdriv release --config-dir ~/my-kodrdriv-config --overrides
482
- ```
483
-
484
- Link local packages for development:
485
- ```bash
486
- # Basic linking with single scope
66
+ # Automatically link workspace packages for local development
487
67
  kodrdriv link --scope-roots '{"@company": "../"}'
488
-
489
- # Multiple scopes with different root directories
490
- kodrdriv link --scope-roots '{"@company": "../", "@tools": "../../tools/"}'
491
-
492
- # Dry run to preview changes
493
- kodrdriv link --scope-roots '{"@company": "../"}' --dry-run --verbose
494
-
495
- # Custom workspace file
496
- kodrdriv link --scope-roots '{"@company": "../"}' --workspace-file "workspace.yaml"
497
-
498
- # Real-world example: linking @company packages from company directory
499
- kodrdriv link --scope-roots '{"@company": "../../company/"}'
500
68
  ```
501
69
 
502
- ### Configuration Directory
503
-
504
- KodrDriv uses a configuration directory to store custom settings, instructions, and other configuration files. You can specify a custom location using the `--config-dir` option:
505
-
506
- ```bash
507
- kodrdriv --config-dir ~/custom-kodrdriv-config
508
- ```
509
-
510
- By default, the configuration directory is set to `.kodrdriv` in your current working directory. This directory is created automatically if it doesn't exist.
511
-
512
- The configuration directory structure is as follows:
513
-
514
- ```
515
- .kodrdriv/
516
- ├── instructions/
517
- │ ├── commit.md # Override for commit instructions
518
- │ ├── commit-pre.md # Content prepended to default commit instructions
519
- │ ├── commit-post.md # Content appended to default commit instructions
520
- │ ├── release.md # Override for release instructions
521
- │ ├── release-pre.md # Content prepended to default release instructions
522
- │ └── release-post.md # Content appended to default release instructions
523
- ├── config.json # Main configuration file
524
- └── ... # Other configuration files
525
- ```
526
-
527
- ### Configuration File
528
-
529
- You can create a `config.json` file in your `.kodrdriv` directory to set default options for all commands. This allows you to avoid repeating command-line options and ensures consistent behavior across your project.
530
-
531
- Example configuration file (`.kodrdriv/config.json`):
532
-
533
- ```json
534
- {
535
- "model": "gpt-4o-mini",
536
- "verbose": true,
537
- "contextDirectories": ["src", "docs"],
538
- "publish": {
539
- "mergeMethod": "merge",
540
- "dependencyUpdatePatterns": ["@company/*", "@myorg/*"],
541
- "requiredEnvVars": ["NODE_AUTH_TOKEN", "CUSTOM_TOKEN"],
542
- "linkWorkspacePackages": true,
543
- "unlinkWorkspacePackages": true
544
- },
545
- "commit": {
546
- "add": true,
547
- "messageLimit": 5
548
- },
549
- "release": {
550
- "from": "main",
551
- "to": "HEAD",
552
- "messageLimit": 10
553
- },
554
- "link": {
555
- "scopeRoots": {
556
- "@company": "../",
557
- "@myorg": "../../org-packages/",
558
- "@tools": "../shared-tools/"
559
- },
560
- "workspaceFile": "pnpm-workspace.yaml"
561
- },
562
- "excludedPatterns": [
563
- "node_modules",
564
- "dist",
565
- "*.log"
566
- ]
567
- }
568
- ```
569
-
570
- Configuration options set in the file can be overridden by command-line arguments. The precedence order is:
571
- 1. Command-line arguments (highest priority)
572
- 2. Configuration file
573
- 3. Default values (lowest priority)
574
-
575
- ## Default Instructions
576
-
577
- KodrDriv comes with default instructions that guide the AI in generating release notes or change logs. These instructions are defined in the source code:
70
+ ## Key Features
578
71
 
579
- - **Commit Instructions**: The default instructions for commit message generation are defined in [src/prompt/instructions/commit.ts](https://github.com/eldrforge/kodrdriv/blob/main/src/prompt/instructions/commit.ts).
72
+ ### AI-Powered Analysis
73
+ Uses OpenAI models to understand your code changes and generate contextual commit messages and release notes.
580
74
 
581
- - **Release Instructions**: The default instructions for release notes generation are defined in [src/prompt/instructions/release.ts](https://github.com/eldrforge/kodrdriv/blob/main/src/prompt/instructions/release.ts).
75
+ ### Comprehensive Release Automation
76
+ The `publish` command handles dependency updates, version bumping, PR creation, status checks, merging, and GitHub releases.
582
77
 
583
- These instruction files contain detailed guidelines for the AI on how to format and structure the output, including examples and specific requirements for different types of changes.
78
+ ### Intelligent Workspace Management
79
+ Automatically discovers and links related packages in monorepos and multi-package projects.
584
80
 
585
- ### Customizing Instructions
81
+ ### Flexible Configuration
82
+ Supports hierarchical configuration with command-line overrides, config files, and environment variables.
586
83
 
587
- You can override these default instructions in several ways:
84
+ ### Custom Instructions
85
+ Extend or replace default AI instructions to match your project's specific conventions and requirements.
588
86
 
589
- 1. **Command Line Option**: Use the `--instructions` flag to specify a custom instructions file:
590
- ```bash
591
- kodrdriv --instructions ./my-custom-instructions.txt
592
- ```
87
+ ## Documentation
593
88
 
594
- 2. **Default Location**: Even without specifying a command line option, Git Intelligent Change will automatically look for an instructions file at `./.kodrdriv/instructions.md` in your current working directory.
89
+ 📚 **Complete Documentation**
595
90
 
596
- 3. **File Format**: While the default file is named `instructions.md`, you can use any text file with any extension. The content doesn't have to be in Markdown format - any plain text content will work. This gives you flexibility to use your preferred text editor or format for writing instructions.
91
+ **Quick Links:**
92
+ - [Commands](docs/public/commands.md) - Detailed documentation of all commands (commit, release, publish, link)
93
+ - [Configuration](docs/public/configuration.md) - All configuration options, hierarchical config, and environment variables
94
+ - [Advanced Usage](docs/public/advanced-usage.md) - Custom instructions, context, prompt structure, and advanced features
95
+ - [Examples](docs/public/examples.md) - Practical usage examples and common workflows
597
96
 
598
- ## Prompt Structure
97
+ ## Basic Command Options
599
98
 
600
- When KodrDriv sends a request to the LLM, it structures the prompt using XML-like tags to organize different components of the input. The prompt is composed of three main sections:
601
-
602
- ```
603
- <instructions>
604
- [Your custom instructions or the default instructions]
605
- </instructions>
606
-
607
- <log>
608
- [Git log output if --content-types includes 'log']
609
- </log>
610
-
611
- <diff>
612
- [Git diff output if --content-types includes 'diff']
613
- </diff>
614
- ```
615
-
616
- Each section serves a specific purpose:
617
- - `<instructions>`: Contains the guidance for the LLM on how to format and structure the output
618
- - `<log>`: Contains the git log output, providing commit history and messages
619
- - `<diff>`: Contains the git diff output, showing the actual code changes
620
-
621
- ## Context
622
-
623
- KodrDriv can use contextual information about your project to generate more meaningful commit messages and release notes. Context is provided through Markdown files stored in a dedicated directory.
624
-
625
- ### Context Directory Structure
626
-
627
- The structure of your context directory is entirely up to you. There are no strict requirements for how you organize your context files - you can structure them in whatever way makes the most sense for your project and team.
628
-
629
- Here are two example approaches to organizing context files:
630
-
631
- #### Hierarchical Structure Example
632
-
633
- You can organize context in a hierarchical structure with subdirectories for different categories:
634
-
635
- ```
636
- .kodrdriv/context/
637
- ├── context.md # Main context file describing sections
638
- ├── people/ # Directory for information about people
639
- │ ├── context.md # Description of the people section
640
- │ ├── team-members.md # Information about team members
641
- │ └── contributors.md # Information about contributors
642
- ├── projects/ # Directory for project information
643
- │ ├── context.md # Description of the projects section
644
- │ └── project-details.md # Details about various projects
645
- └── technologies/ # Directory for technical information
646
- ├── context.md # Description of the technologies section
647
- ├── frameworks.md # Information about frameworks used
648
- └── libraries.md # Information about libraries used
649
- ```
650
-
651
- #### Individual Records Example
652
-
653
- Alternatively, you can use a flatter structure with individual files for each entity:
654
-
655
- ```
656
- .kodrdriv/context/
657
- ├── context.md # Main context file describing sections
658
- ├── people/ # Directory for individual people information
659
- │ ├── context.md # Description of the people section
660
- │ ├── john-doe.md # Information specific to John Doe
661
- │ ├── jane-smith.md # Information specific to Jane Smith
662
- │ └── alex-johnson.md # Information specific to Alex Johnson
663
- ```
664
-
665
- Choose the organization that works best for your needs. The system will process the context files regardless of the structure, as long as they follow the basic Markdown formatting guidelines.
666
-
667
- ### Main Context File
668
-
669
- The `context.md` file in each directory serves as an introduction to that section. The system loads this file first to understand the structure of the information. For example, a `context.md` file in the people directory might look like:
670
-
671
- ```markdown
672
- ## People
673
-
674
- This section contains subsections that have information about people.
675
- ```
676
-
677
- ### Context Files
678
-
679
- After loading the `context.md` file, the system reads all other Markdown files in the directory. It uses the first header in each file as the name of the section or subsection. For example:
680
-
681
- ```markdown
682
- ## Team Members
683
-
684
- - John Doe: Lead Developer, focuses on backend systems
685
- - Jane Smith: UX Designer, specializes in responsive interfaces
686
- - Alex Johnson: DevOps Engineer, manages deployment pipelines
687
- ```
688
-
689
- ### Context Location
690
-
691
- You can specify where to store your context files in two recommended ways:
692
-
693
- 1. **Project Directory**: Store context files in your project repository at `.kodrdriv/context/`. This is useful when the context is specific to the project and should be versioned with the code.
694
-
695
- 2. **gitignore Directory**: Alternatively, you can store context in your `.gitignore` directory if you want to keep it separate from your project files or if the context contains sensitive information that shouldn't be committed to the repository.
696
-
697
- To specify a custom context directory, use the `--context-dir` option:
698
-
699
- ```bash
700
- kodrdriv commit --context-dir ~/my-custom-context
701
- ```
702
-
703
- By default, KodrDriv looks for context in the `.kodrdriv/context` directory within your project.
704
-
705
- ## Configuration Directory
706
-
707
- The configuration directory (configDir) allows you to further customize both commit and release instructions by adding pre and post content to the default instructions. This is done by creating additional files in your `.kodrdriv/instructions` directory:
99
+ - `--dry-run`: Perform a dry run without saving files
100
+ - `--verbose`: Enable verbose logging
101
+ - `--debug`: Enable debug logging
102
+ - `--check-config`: Display current configuration hierarchy
103
+ - `--version`: Display version information
708
104
 
709
- ### Release Instructions
710
- 1. **Pre-Content**: Create a file named `release-pre.md` to add content that will be prepended to the default release instructions.
711
- 2. **Post-Content**: Create a file named `release-post.md` to add content that should be appended to the default release instructions.
105
+ For complete command-line options and detailed usage, see the [Configuration Documentation](docs/public/configuration.md).
712
106
 
713
- ### Commit Instructions
714
- 1. **Pre-Content**: Create a file named `commit-pre.md` to add content that will be prepended to the default commit instructions.
715
- 2. **Post-Content**: Create a file named `commit-post.md` to add content that should be appended to the default commit instructions.
107
+ ## Environment Variables
716
108
 
717
- For example, if you want to add specific formatting requirements before the default release instructions, you could create `.kodrdriv/instructions/release-pre.md`, and if you want to add instructions to the end of the commit instrucitons, you would have a file in `.kodrdriv/instructions/commit-post.md`.
109
+ KodrDriv requires OpenAI API credentials for AI-powered features:
718
110
 
719
- ### Overriding Default Instructions
111
+ - `OPENAI_API_KEY`: OpenAI API key (required)
112
+ - `GITHUB_TOKEN`: Required for publish command and GitHub operations
720
113
 
721
- While the pre and post content files provide a way to extend the default instructions, you can also completely replace them by creating either `commit.md` or `release.md` in your `.kodrdriv/instructions` directory. This gives you full control over the instruction content.
114
+ ## Contributing
722
115
 
723
- However, please note that completely replacing the default instructions should be done with caution. The default instructions are carefully crafted to:
724
- - Ensure consistent formatting
725
- - Maintain proper context awareness
726
- - Follow best practices for commit messages and release notes
727
- - Handle edge cases and special scenarios
116
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
728
117
 
729
- By replacing these instructions entirely, you may lose these benefits and potentially create inconsistencies in your documentation. It's recommended to use the pre and post content files to extend the default instructions rather than replacing them entirely, unless you have a specific need to do so.
118
+ ## License
730
119
 
731
- To enable instruction overrides, you'll need to use the `--overrides` flag when running the command.
120
+ Apache-2.0 - see [LICENSE](LICENSE) file for details.
732
121
 
733
122
  ## About the Name
734
123
 
735
- Ski carving and efficient software development have a lot in common. Carving uses edge control to follow a smooth, energy-efficient arc — just like automation uses clean, repeatable scripts to replace manual work. Both are about flow: linking turns or commits without hesitation. As carving unlocks speed and control, automation unlocks scalability and momentum. The result is clean tracks — razor-thin arcs on snow, or tidy diffs in code. And when you've mastered your craft, you don't stop to think about your last move. Your code leaves a clean trail — and your commit message can be automated straight from the diff. And — snowboarders carve too. Different board, same beauty. We won't hold it against you if you're dropping clean edges on a single plank.
736
-
737
- ## Origin Story: kodrdriv
738
-
739
- It always happened at the same moment.
740
-
741
- You've just spent the entire day in a flow state — the kind that only comes when everything clicks. Whether it was writing code for a critical feature or hammering out chapters of a Markdown or AsciiDoc book, you were locked in. Maybe you were racing the clock to hit a deadline. Maybe you were just up late trying to carve something beautiful out of nothing. Either way, you went right up to the wire, focused, dialed in, exhausted but satisfied.
742
-
743
- And then… Git hits you with the meta-question:
744
- "What did you do?"
745
-
746
- That one prompt — to sum it all up in a commit message — feels totally out of place. It asks you to stop, zoom out, and articulate everything you've just done, right when your brain is at its least reflective. You're not in summary mode. You're still in it. Still shaping. Still carving.
747
-
748
- And that's the thing: it sounds silly, like it shouldn't be a real problem. But every developer, every writer who lives in Git knows that exact moment. The friction is real. The context switch is jarring. It's like being asked to narrate your entire ski run after you've blasted through powder, dodged trees, hit the cliff drop — and now you're out of breath, standing at the bottom, being asked to give a PowerPoint.
749
-
750
- That's why I built kodrdriv.
751
-
752
- It's not just a tool — it's a mindset shift. The idea is simple: you've already carved your line in the snow. Your code is there. Your diffs are real. Instead of making you explain it, kodrdriv uses an LLM to read the trail you left behind and generate a clean, meaningful commit message. One that actually reflects your work — without breaking your flow or making you guess what mattered most.
753
-
754
- Whether you're merging branches or writing books, kodrdriv is built for that end-of-day moment when you want to commit and move on — not pause for existential reflection. It reads the line you've drawn, and it helps you push it forward.
755
-
756
- ### Release Command Options
757
-
758
- - `--from <from>`: Branch or reference to generate release notes from (default: 'main')
759
- - `--to <to>`: Branch or reference to generate release notes to (default: 'HEAD')
760
- - `--context <context>`: Provide additional context (as a string or file path) to guide the release notes generation. This context is included in the prompt sent to the AI and can be used to specify the purpose, theme, or any special considerations for the release.
761
- - `--message-limit <messageLimit>`: Limit the number of recent commit messages (from git log) to include in the release notes prompt (default: 10). Reducing this number can make the summary more focused, while increasing it provides broader historical context.
762
-
763
- ### Explanation
764
-
765
- - The `--context` option allows you to inject custom context into the AI prompt, which can help tailor the generated commit message or release notes to your specific needs or project conventions. You can provide a string directly or a path to a file containing the context.
766
- - The `--message-limit` option controls how many recent commit messages are included in the prompt. Reducing this number can make the summary more focused, while increasing it can provide broader historical context.
124
+ Ski carving and efficient software development have a lot in common. Carving uses edge control to follow a smooth, energy-efficient arc — just like automation uses clean, repeatable scripts to replace manual work. Both are about flow: linking turns or commits without hesitation. As carving unlocks speed and control, automation unlocks scalability and momentum. The result is clean tracks — razor-thin arcs on snow, or tidy diffs in code. And when you've mastered your craft, you don't stop to think about your last move. Your code leaves a clean trail — and your commit message can be automated straight from the diff.
767
125
 
768
126
 
769
127