@lenadweb/aicmt 0.1.1
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/LICENSE +21 -0
- package/README.md +123 -0
- package/dist/bin/aicmt.js +870 -0
- package/dist/bin/aicmt.js.map +1 -0
- package/dist/cli.js +876 -0
- package/dist/cli.js.map +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 lenadweb
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# aicmt
|
|
2
|
+
|
|
3
|
+
AI-assisted git commits via OpenRouter. Designed for fast, consistent commit messages with minimal prompts.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
- Generates 3 commit message options from the staged diff
|
|
8
|
+
- Supports global defaults with per-repo overrides
|
|
9
|
+
- Can auto-stage and auto-commit with `-y`
|
|
10
|
+
- Logs AI request/response with `--verbose` for troubleshooting
|
|
11
|
+
|
|
12
|
+
## How it works
|
|
13
|
+
|
|
14
|
+
- Collects staged diff; if unstaged files exist, it can stage all changes
|
|
15
|
+
- Builds a minimal prompt: system instructions + raw diff
|
|
16
|
+
- Requests 3 commit message options from OpenRouter
|
|
17
|
+
- Lets you pick (or auto-picks the first with `-y`)
|
|
18
|
+
- Creates the git commit with the chosen message
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- Node.js 16+
|
|
23
|
+
- Git
|
|
24
|
+
|
|
25
|
+
## Install (local dev)
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
npm install
|
|
29
|
+
npm run build
|
|
30
|
+
npm link
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
After linking, the `aicmt` command is available globally.
|
|
34
|
+
|
|
35
|
+
## Global config
|
|
36
|
+
|
|
37
|
+
The global config file lives at:
|
|
38
|
+
|
|
39
|
+
- `$XDG_CONFIG_HOME/aicmt/config.json`
|
|
40
|
+
- `~/.config/aicmt/config.json` (fallback)
|
|
41
|
+
|
|
42
|
+
Global defaults apply to all repos. Per-repo overrides live under `projects`.
|
|
43
|
+
|
|
44
|
+
## Init (interactive)
|
|
45
|
+
|
|
46
|
+
Run init inside a git repo:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
aicmt init
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
You will choose:
|
|
53
|
+
|
|
54
|
+
- Commit format (preset or custom)
|
|
55
|
+
- Additional instructions
|
|
56
|
+
- Model, temperature, max tokens
|
|
57
|
+
- Scope (global defaults or repo override)
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
Default command runs `commit` (or `init` if no global config exists yet):
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
aicmt
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Explicit form:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
aicmt commit
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If there are unstaged changes, aicmt will ask to stage them. It always commits all changes that are staged.
|
|
74
|
+
|
|
75
|
+
## Flags
|
|
76
|
+
|
|
77
|
+
- `-c, --config <path>`: Custom global config path
|
|
78
|
+
- `--dry-run`: Show the chosen message without committing
|
|
79
|
+
- `-v, --verbose`: Print AI request and response logs
|
|
80
|
+
- `-y, --yes`: Skip prompts (stage all, pick first message, auto-confirm)
|
|
81
|
+
|
|
82
|
+
## Config format
|
|
83
|
+
|
|
84
|
+
Example global config with repo override:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"openrouterApiKey": "sk-...",
|
|
89
|
+
"model": "openai/gpt-4o-mini",
|
|
90
|
+
"format": "conventional",
|
|
91
|
+
"instructions": "Generate a short conventional-lite commit message:\n\nlowercase only\nno period, no emoji\nimperative verb (add / fix / update / remove / improve)\n3-7 words\ndescribe what was done, not why\n\nExamples:\nadd smart preview toggler\nfix expand text for smart preview\nremove custom font family\n\nContext:\n<brief description of code changes>\n\nReturn only one commit message.",
|
|
92
|
+
"temperature": 0.2,
|
|
93
|
+
"maxTokens": 120,
|
|
94
|
+
"projects": {
|
|
95
|
+
"/path/to/repo": {
|
|
96
|
+
"format": "conventional-scope",
|
|
97
|
+
"instructions": "Use Conventional Commits with scope."
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Notes:
|
|
104
|
+
|
|
105
|
+
- `maxTokens` is clamped between 32 and 512 to prevent excessive output.
|
|
106
|
+
- If a repo has no override, global defaults are used.
|
|
107
|
+
- Keep the global config private (it contains your API key).
|
|
108
|
+
|
|
109
|
+
## Troubleshooting
|
|
110
|
+
|
|
111
|
+
- `No config found for this repo` or `Missing ...`: run `aicmt init` to set global defaults or a repo override.
|
|
112
|
+
- `OpenRouter error 400`: your output tokens are too high or diff is too large. Lower `maxTokens` or reduce the staged diff.
|
|
113
|
+
- `Not a git repository`: run inside a git repo.
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
npm run build
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Entry point:
|
|
122
|
+
|
|
123
|
+
- `src/bin/aicmt.ts`
|