sncommit 1.0.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 +118 -0
- package/bun.lock +705 -0
- package/dist/index.js +59809 -0
- package/eslint.config.mjs +34 -0
- package/package.json +56 -0
- package/src/components/App.tsx +357 -0
- package/src/components/CommitSuggestions.tsx +157 -0
- package/src/components/ConfigApp.tsx +258 -0
- package/src/components/CustomInputPrompt.tsx +82 -0
- package/src/components/StagedFiles.tsx +52 -0
- package/src/components/TuiDialog.tsx +177 -0
- package/src/index.tsx +150 -0
- package/src/services/git.ts +128 -0
- package/src/services/groq.ts +360 -0
- package/src/suppress-warnings.ts +18 -0
- package/src/types/index.ts +36 -0
- package/src/utils/config.ts +66 -0
- package/tsconfig.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Better Commit
|
|
2
|
+
|
|
3
|
+
AI-powered git commit message generator with a beautiful TUI (Terminal User Interface).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **AI-Powered**: Uses Groq AI to generate intelligent, context-aware commit messages
|
|
8
|
+
- **Beautiful TUI**: Modern, interactive terminal interface with keyboard navigation
|
|
9
|
+
- **Smart**: Analyzes staged files, diffs, and recent commit history
|
|
10
|
+
- **Fast**: Built with Bun and optimized for speed
|
|
11
|
+
- **Configurable**: Personalized styles (Conventional, Simple, Detailed) and prompts
|
|
12
|
+
- **Iterative**: "Try again" option and manual editing
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### Prerequisites
|
|
17
|
+
|
|
18
|
+
- Node.js 18+ or Bun
|
|
19
|
+
- A Groq API key (get one free at [console.groq.com](https://console.groq.com))
|
|
20
|
+
|
|
21
|
+
### Quick Start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Clone the repository
|
|
25
|
+
git clone https://github.com/snvshal/better-commit.git
|
|
26
|
+
cd better-commit
|
|
27
|
+
|
|
28
|
+
# Install dependencies
|
|
29
|
+
bun install
|
|
30
|
+
|
|
31
|
+
# Build the project
|
|
32
|
+
bun run build
|
|
33
|
+
|
|
34
|
+
# Link globally (optional)
|
|
35
|
+
npm link
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### 1. Setup
|
|
41
|
+
|
|
42
|
+
First, configure your API key:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
better-commit config
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Use the arrow keys to navigate and **Enter** to edit settings.
|
|
49
|
+
|
|
50
|
+
### 2. Generate Commits
|
|
51
|
+
|
|
52
|
+
Run the tool in any git repository:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Run on currently staged files
|
|
56
|
+
better-commit
|
|
57
|
+
|
|
58
|
+
# Or stage all files and run (like git commit -am)
|
|
59
|
+
better-commit -a
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Alias
|
|
63
|
+
|
|
64
|
+
You can use the short alias `bc` instead of typing `better-commit`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
bc # Generate commit
|
|
68
|
+
bc -a # Stage all and commit
|
|
69
|
+
bc config # Open configuration
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 3. Workflow
|
|
73
|
+
|
|
74
|
+
1. **Select**: App shows 4 AI-generated suggestions based on your changes.
|
|
75
|
+
2. **Navigate**: Use `↑` / `↓` to choose a message.
|
|
76
|
+
3. **Confirm**: Press `Enter` to commit with the selected message.
|
|
77
|
+
4. **Refine**: Choose "Custom input" to write your own, or "Try again" for new ideas.
|
|
78
|
+
5. **Cancel**: Press `Esc` or `Ctrl+C` to exit.
|
|
79
|
+
|
|
80
|
+
## Configuration
|
|
81
|
+
|
|
82
|
+
Run `better-commit config` to modify:
|
|
83
|
+
|
|
84
|
+
| Setting | Description | Default |
|
|
85
|
+
| :---------------- | :-------------------------------------- | :--------------------- |
|
|
86
|
+
| **Groq API Key** | Your secret API key | Required |
|
|
87
|
+
| **Model** | AI model (Llama 3, GPT-OSS, etc.) | `llama-3.1-8b-instant` |
|
|
88
|
+
| **Commit Style** | `conventional`, `simple`, or `detailed` | `conventional` |
|
|
89
|
+
| **Custom Prompt** | Extra instructions for the AI | _None_ |
|
|
90
|
+
|
|
91
|
+
## Development
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Install dependencies
|
|
95
|
+
bun install
|
|
96
|
+
|
|
97
|
+
# Run in development mode
|
|
98
|
+
bun run dev
|
|
99
|
+
|
|
100
|
+
# Build for production
|
|
101
|
+
bun run build
|
|
102
|
+
|
|
103
|
+
# Run production build
|
|
104
|
+
bun run start
|
|
105
|
+
|
|
106
|
+
# Run linting
|
|
107
|
+
bun run lint
|
|
108
|
+
|
|
109
|
+
# Type checking
|
|
110
|
+
bun run type-check
|
|
111
|
+
|
|
112
|
+
# Format code
|
|
113
|
+
bun run format
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
MIT
|