@himenon/claude-commit-msg-gen 0.1.0 → 0.1.2
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
|
@@ -1,44 +1,61 @@
|
|
|
1
1
|
# claude-commit-msg-gen
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
A CLI tool that automatically generates [Conventional Commits](https://www.conventionalcommits.org/) messages from staged diffs using the [Anthropic API](https://www.anthropic.com/) and [Lefthook](https://lefthook.dev/).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For architecture and design details, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Setup
|
|
8
8
|
|
|
9
|
-
### 1. Anthropic API
|
|
9
|
+
### 1. Set Anthropic API key
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
12
|
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
### 2. Lefthook
|
|
15
|
+
### 2. Install Lefthook
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
18
|
brew install lefthook
|
|
19
|
+
# or
|
|
19
20
|
pnpm add -g lefthook
|
|
20
21
|
```
|
|
21
22
|
|
|
22
|
-
### 3.
|
|
23
|
+
### 3. Install the binary
|
|
24
|
+
|
|
25
|
+
**Via curl (no Node.js required):**
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
curl -fsSL https://raw.githubusercontent.com/Himenon/claude-commit-msg-gen/main/scripts/install.sh | sh
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
To install to a custom directory:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
INSTALL_DIR="$HOME/.local/bin" curl -fsSL https://raw.githubusercontent.com/Himenon/claude-commit-msg-gen/main/scripts/install.sh | sh
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Via npm / pnpm:**
|
|
23
38
|
|
|
24
39
|
```sh
|
|
25
40
|
pnpm install -g @himenon/claude-commit-msg-gen
|
|
41
|
+
# or
|
|
42
|
+
npm install -g @himenon/claude-commit-msg-gen
|
|
26
43
|
```
|
|
27
44
|
|
|
28
|
-
### 4.
|
|
45
|
+
### 4. Enable the hook
|
|
29
46
|
|
|
30
47
|
```sh
|
|
31
48
|
lefthook install
|
|
32
49
|
```
|
|
33
50
|
|
|
34
|
-
|
|
51
|
+
`git commit` will now auto-generate commit messages.
|
|
35
52
|
|
|
36
|
-
## API
|
|
53
|
+
## Keep the API key out of your shell profile
|
|
37
54
|
|
|
38
|
-
`lefthook-local.yml`
|
|
55
|
+
Write the API key in `lefthook-local.yml` instead. This file is listed in `.gitignore` and will never be committed.
|
|
39
56
|
|
|
40
57
|
```yaml
|
|
41
|
-
# lefthook-local.yml
|
|
58
|
+
# lefthook-local.yml (.gitignore'd)
|
|
42
59
|
prepare-commit-msg:
|
|
43
60
|
jobs:
|
|
44
61
|
- name: auto-commit-message
|
|
@@ -46,26 +63,26 @@ prepare-commit-msg:
|
|
|
46
63
|
ANTHROPIC_API_KEY: "sk-ant-..."
|
|
47
64
|
```
|
|
48
65
|
|
|
49
|
-
`lefthook-local.yml`
|
|
66
|
+
`lefthook-local.yml` is merged on top of `lefthook.yml`. Only the keys you specify are overridden; everything else continues to use the values from `lefthook.yml`.
|
|
50
67
|
|
|
51
|
-
##
|
|
68
|
+
## Troubleshooting
|
|
52
69
|
|
|
53
|
-
**`Binary not found`
|
|
70
|
+
**`Binary not found` is shown**
|
|
54
71
|
|
|
55
72
|
```sh
|
|
56
73
|
pnpm run build
|
|
57
74
|
```
|
|
58
75
|
|
|
59
|
-
**`ANTHROPIC_API_KEY
|
|
76
|
+
**`ANTHROPIC_API_KEY is not set` is shown**
|
|
60
77
|
|
|
61
78
|
```sh
|
|
62
79
|
echo $ANTHROPIC_API_KEY
|
|
63
80
|
```
|
|
64
81
|
|
|
65
|
-
|
|
82
|
+
**Temporarily disable auto-generation**
|
|
66
83
|
|
|
67
84
|
```sh
|
|
68
85
|
LEFTHOOK=0 git commit
|
|
69
86
|
```
|
|
70
87
|
|
|
71
|
-
> `claude` CLI
|
|
88
|
+
> For the shell-script alternative using the `claude` CLI, see [docs/SHELL_SCRIPT_ALTERNATIVE.md](docs/SHELL_SCRIPT_ALTERNATIVE.md).
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|