@shailesh-714/git-bot 0.1.0
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 +128 -0
- package/bundle/git-bot.cjs +78879 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# git-bot
|
|
2
|
+
|
|
3
|
+
An LLM-powered CLI assistant for writing conventional commit messages and branch names.
|
|
4
|
+
|
|
5
|
+
It reads the changes in your git repository, generates a relevant commit message following
|
|
6
|
+
configurable conventions, and can also create a matching branch name when you start new work.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Conventional commits**: enforces allowed commit types like `feat:`, `fix:`, `refactor:`, etc.
|
|
11
|
+
- **Branch naming**: generates branch names with allowed prefixes like `feature/`, `bugfix/`, etc.
|
|
12
|
+
- **Staged-first diff reading**: prefers staged changes and falls back to unstaged changes.
|
|
13
|
+
- **Combined workflow**: create a branch and commit in a single command.
|
|
14
|
+
- **LangGraph-powered generation**: structured LLM output with node-level retry policies and soft context restrictions.
|
|
15
|
+
- **Configurable rules**: customize commit types, branch prefixes, length limits, and credentials via TOML.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Published to the public npm registry.
|
|
20
|
+
|
|
21
|
+
Requires **Node.js >= 20**.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g @shailesh-714/git-bot
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Run without installing:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx @shailesh-714/git-bot commit --dry-run
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Manual
|
|
34
|
+
|
|
35
|
+
If you already have the repo cloned:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install
|
|
39
|
+
npm run build
|
|
40
|
+
node ./bundle/git-bot.cjs --help
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
Create `~/.config/git-bot/config.toml` (or pass `--config`):
|
|
46
|
+
|
|
47
|
+
```toml
|
|
48
|
+
[llm]
|
|
49
|
+
provider = "openai"
|
|
50
|
+
model = "gpt-4o-mini"
|
|
51
|
+
apiKey = "sk-..." # or set OPENAI_API_KEY
|
|
52
|
+
baseUrl = "" # optional OpenAI-compatible endpoint
|
|
53
|
+
temperature = 0.2
|
|
54
|
+
|
|
55
|
+
[conventions.commit]
|
|
56
|
+
enabledTypes = [
|
|
57
|
+
"feat", "fix", "refactor", "docs", "test", "chore", "style", "perf"
|
|
58
|
+
]
|
|
59
|
+
format = "{type}: {summary}"
|
|
60
|
+
maxLength = 72
|
|
61
|
+
|
|
62
|
+
[conventions.branch]
|
|
63
|
+
enabledPrefixes = [
|
|
64
|
+
"feature", "bugfix", "hotfix", "release"
|
|
65
|
+
]
|
|
66
|
+
separator = "/"
|
|
67
|
+
maxLength = 60
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Generate an example config:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git-bot config --init
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Generate a commit message from staged changes (falls back to unstaged)
|
|
80
|
+
git-bot commit
|
|
81
|
+
|
|
82
|
+
# Stage all changes and commit in one step
|
|
83
|
+
git-bot commit --all
|
|
84
|
+
|
|
85
|
+
# Show the generated message without committing
|
|
86
|
+
git-bot commit --dry-run
|
|
87
|
+
|
|
88
|
+
# Skip confirmation prompts
|
|
89
|
+
git-bot commit --yes
|
|
90
|
+
|
|
91
|
+
# Generate a commit message and create a branch in one go
|
|
92
|
+
git-bot commit --branch
|
|
93
|
+
|
|
94
|
+
# Same with an issue identifier
|
|
95
|
+
git-bot commit --branch --issue JIRA-123
|
|
96
|
+
|
|
97
|
+
# Generate and create only a branch
|
|
98
|
+
git-bot branch
|
|
99
|
+
|
|
100
|
+
# Dry-run branch name only
|
|
101
|
+
git-bot branch --dry-run
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Environment Variables
|
|
105
|
+
|
|
106
|
+
- `OPENAI_API_KEY` — used when `apiKey` is not set in config.
|
|
107
|
+
- `GIT_BOT_CONFIG` — default config file path.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm install
|
|
113
|
+
npm run dev -- commit --dry-run
|
|
114
|
+
npm test
|
|
115
|
+
npm run build
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Releasing
|
|
119
|
+
|
|
120
|
+
1. Bump the version in `package.json`.
|
|
121
|
+
2. Push the change to `main`.
|
|
122
|
+
3. Go to **Actions → Release → Run workflow**.
|
|
123
|
+
|
|
124
|
+
The workflow will tag the release, build and test the package, publish it to the GitHub Packages npm registry, and create a GitHub Release.
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|