@lenadweb/aicmt 0.1.1 → 0.1.3

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.
package/README.md CHANGED
@@ -5,6 +5,8 @@ AI-assisted git commits via OpenRouter. Designed for fast, consistent commit mes
5
5
  ## What it does
6
6
 
7
7
  - Generates 3 commit message options from the staged diff
8
+ - Splits changes into multiple logical commits with `--split`
9
+ - Adds custom prefixes to commit messages with `--prefix`
8
10
  - Supports global defaults with per-repo overrides
9
11
  - Can auto-stage and auto-commit with `-y`
10
12
  - Logs AI request/response with `--verbose` for troubleshooting
@@ -22,15 +24,17 @@ AI-assisted git commits via OpenRouter. Designed for fast, consistent commit mes
22
24
  - Node.js 16+
23
25
  - Git
24
26
 
25
- ## Install (local dev)
27
+ ## Install
26
28
 
27
29
  ```
28
- npm install
29
- npm run build
30
- npm link
30
+ npm install -g @lenadweb/aicmt
31
31
  ```
32
32
 
33
- After linking, the `aicmt` command is available globally.
33
+ Or run without installing:
34
+
35
+ ```
36
+ npx @lenadweb/aicmt
37
+ ```
34
38
 
35
39
  ## Global config
36
40
 
@@ -78,6 +82,97 @@ If there are unstaged changes, aicmt will ask to stage them. It always commits a
78
82
  - `--dry-run`: Show the chosen message without committing
79
83
  - `-v, --verbose`: Print AI request and response logs
80
84
  - `-y, --yes`: Skip prompts (stage all, pick first message, auto-confirm)
85
+ - `-s, --split`: Split changes into multiple logical commits (file-level)
86
+ - `--split-hunks`: Split changes at hunk level (experimental)
87
+ - `--prefix <string>`: Add a prefix before the commit message (e.g., ticket number)
88
+
89
+ ## Split mode
90
+
91
+ When you have multiple unrelated changes, use `--split` to automatically decompose them into separate commits:
92
+
93
+ ```
94
+ aicmt commit --split
95
+ ```
96
+
97
+ The AI analyzes your diff and groups files by logical changes:
98
+
99
+ ```
100
+ Analyzing 5 changed files...
101
+
102
+ Proposed 3 commits:
103
+
104
+ 1. feat: add user authentication
105
+ - src/auth.ts
106
+ - src/middleware/auth.ts
107
+
108
+ 2. fix: correct validation logic
109
+ - src/validators.ts
110
+
111
+ 3. docs: update API documentation
112
+ - README.md
113
+ - docs/api.md
114
+
115
+ Proceed with these 3 commits? (Y/n)
116
+ ```
117
+
118
+ Split mode works with other flags:
119
+
120
+ - `--split --dry-run`: Preview proposed commits without creating them
121
+ - `--split -y`: Auto-confirm all commits
122
+ - `--split -v`: Show AI request/response for debugging
123
+
124
+ ## Hunk-level split (experimental)
125
+
126
+ For finer control, use `--split-hunks` to split changes within files:
127
+
128
+ ```
129
+ aicmt commit --split-hunks
130
+ ```
131
+
132
+ This mode analyzes individual hunks (contiguous blocks of changes) rather than whole files:
133
+
134
+ ```
135
+ Analyzing 4 hunks across 2 files...
136
+ (experimental hunk-level split mode)
137
+
138
+ Proposed 2 commits:
139
+
140
+ 1. fix: correct error handling in auth
141
+ - src/auth.ts:1
142
+ - src/auth.ts:2
143
+
144
+ 2. feat: add logging middleware
145
+ - src/auth.ts:3
146
+ - src/middleware.ts:1
147
+
148
+ Proceed with these 2 commits? (Y/n)
149
+ ```
150
+
151
+ This is useful when a single file contains multiple unrelated changes. If something goes wrong, the tool will automatically rollback all commits.
152
+
153
+ **Note:** This is experimental. Use `--dry-run` first to preview the proposed split.
154
+
155
+ ## Commit message prefix
156
+
157
+ Add a prefix (like a ticket number) to all commit messages:
158
+
159
+ ```
160
+ aicmt commit --prefix "DEV-95: "
161
+ ```
162
+
163
+ The AI generates the commit message, then the prefix is added programmatically:
164
+
165
+ ```
166
+ DEV-95: fix: update validation logic
167
+ ```
168
+
169
+ This works with all modes:
170
+
171
+ - `--prefix "JIRA-123: "`: Standard commit with prefix
172
+ - `--prefix "TASK-456: " --split`: All split commits get the prefix
173
+ - `--prefix "FIX-789: " -y`: Auto-commit with prefix
174
+
175
+ The prefix is not sent to the AI, it's applied as post-processing to the generated message.
81
176
 
82
177
  ## Config format
83
178
 
@@ -112,6 +207,16 @@ Notes:
112
207
  - `OpenRouter error 400`: your output tokens are too high or diff is too large. Lower `maxTokens` or reduce the staged diff.
113
208
  - `Not a git repository`: run inside a git repo.
114
209
 
210
+ ## Local development
211
+
212
+ ```
213
+ npm install
214
+ npm run build
215
+ npm link
216
+ ```
217
+
218
+ After linking, the `aicmt` command is available globally.
219
+
115
220
  ## Development
116
221
 
117
222
  ```