genai-commit 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
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,215 @@
1
+ # genai-commit
2
+
3
+ AI-powered commit message generator using Claude Code or Cursor CLI.
4
+
5
+ [![npm version](https://badge.fury.io/js/genai-commit.svg)](https://www.npmjs.com/package/genai-commit)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![GitHub](https://img.shields.io/github/stars/Seungwoo321/genai-commit?style=social)](https://github.com/Seungwoo321/genai-commit)
8
+
9
+ ## Features
10
+
11
+ - **AI-powered commit messages** - Generate meaningful commit messages using Claude Code or Cursor CLI
12
+ - **Conventional Commits** - Automatically follows the Conventional Commits specification
13
+ - **Multi-language support** - Generate titles and messages in English or Korean
14
+ - **Jira integration** - Assign Jira tickets to commits and auto-merge related changes
15
+ - **Interactive workflow** - Review, provide feedback, and refine before committing
16
+ - **Smart file grouping** - Intelligently splits changes into logical commits
17
+
18
+ ## How It Works
19
+
20
+ ```mermaid
21
+ flowchart TD
22
+ A[Start: genai-commit] --> B[Collect Git Changes]
23
+ B --> C{Changes Found?}
24
+ C -->|No| D[Exit: No changes]
25
+ C -->|Yes| E[Generate Tree Summary]
26
+ E --> F[Build AI Prompt]
27
+ F --> G{Select Provider}
28
+ G -->|Claude Code| H[Claude Code CLI]
29
+ G -->|Cursor CLI| I[Cursor CLI]
30
+ H --> J[Parse JSON Response]
31
+ I --> K[Parse Delimiter Response]
32
+ J --> L[Display Proposed Commits]
33
+ K --> L
34
+ L --> M{User Action}
35
+ M -->|y| N[Execute git add + commit]
36
+ M -->|n| O[Cancel]
37
+ M -->|f| P[Get Feedback]
38
+ M -->|t| Q[Assign Jira Tickets]
39
+ P --> F
40
+ Q --> R[Merge Same-Ticket Commits]
41
+ R --> L
42
+ N --> S[Done]
43
+ ```
44
+
45
+ ## Prerequisites
46
+
47
+ You need at least one of these AI CLI tools installed:
48
+
49
+ - [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) - Anthropic's official CLI
50
+ - [Cursor CLI](https://www.cursor.com/) - Cursor's agent CLI
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ # Global installation
56
+ npm install -g genai-commit
57
+
58
+ # Or use directly with npx (no installation required)
59
+ npx genai-commit claude-code
60
+ ```
61
+
62
+ ## Usage
63
+
64
+ ### Generate Commit Messages
65
+
66
+ ```bash
67
+ # Using Claude Code
68
+ genai-commit claude-code
69
+
70
+ # Using Cursor CLI
71
+ genai-commit cursor-cli
72
+
73
+ # With specific model (Cursor only)
74
+ genai-commit cursor-cli --model sonnet-4.5
75
+
76
+ # Set language for both title and message
77
+ genai-commit claude-code --lang ko
78
+
79
+ # Set languages separately
80
+ genai-commit claude-code --title-lang en --message-lang ko
81
+ ```
82
+
83
+ ### Authentication
84
+
85
+ ```bash
86
+ # Login to Cursor
87
+ genai-commit login cursor-cli
88
+
89
+ # Setup Claude token
90
+ genai-commit login claude-code
91
+
92
+ # Check status
93
+ genai-commit status claude-code
94
+ genai-commit status cursor-cli
95
+ ```
96
+
97
+ ### Interactive Options
98
+
99
+ After generating commit messages, you'll see an interactive menu:
100
+
101
+ | Option | Description |
102
+ |--------|-------------|
103
+ | `[y]` | Commit all proposed commits |
104
+ | `[n]` | Cancel |
105
+ | `[f]` | Provide feedback to regenerate |
106
+ | `[t]` | Assign Jira tickets and regroup commits |
107
+
108
+ ## Options
109
+
110
+ | Option | Description | Default |
111
+ |--------|-------------|---------|
112
+ | `--lang <lang>` | Set both title and message language (en\|ko) | - |
113
+ | `--title-lang <lang>` | Language for commit title | `en` |
114
+ | `--message-lang <lang>` | Language for commit message | `ko` |
115
+ | `--model <model>` | Model to use (Cursor CLI only) | `gemini-3-flash` |
116
+
117
+ ## Examples
118
+
119
+ ### Basic Usage
120
+
121
+ ```bash
122
+ # Navigate to your git repository
123
+ cd my-project
124
+
125
+ # Make some changes
126
+ echo "console.log('hello');" >> src/index.js
127
+
128
+ # Generate and create commits
129
+ genai-commit claude-code
130
+ ```
131
+
132
+ ### With Jira Integration
133
+
134
+ 1. Run `genai-commit claude-code`
135
+ 2. Review proposed commits
136
+ 3. Press `t` to assign Jira tickets
137
+ 4. Enter Jira URLs for each commit
138
+ 5. Commits with the same Jira ticket are automatically merged
139
+ 6. Press `y` to commit
140
+
141
+ ### Providing Feedback
142
+
143
+ 1. Run `genai-commit cursor-cli`
144
+ 2. Review proposed commits
145
+ 3. Press `f` to provide feedback
146
+ 4. Enter your feedback (e.g., "Split the auth changes into separate commits")
147
+ 5. AI regenerates based on your feedback
148
+ 6. Press `y` to commit
149
+
150
+ ## Programmatic Usage
151
+
152
+ ```typescript
153
+ import {
154
+ createProvider,
155
+ isGitRepository,
156
+ getCurrentBranch,
157
+ getGitStatus,
158
+ generateFullTreeSummary,
159
+ } from 'genai-commit';
160
+
161
+ // Create a provider
162
+ const provider = createProvider('claude-code', { timeout: 120000 });
163
+
164
+ // Check provider status
165
+ const status = await provider.status();
166
+ console.log(status.available ? 'Ready' : 'Not available');
167
+
168
+ // Generate commits programmatically
169
+ const branch = await getCurrentBranch();
170
+ const { changes } = await getGitStatus();
171
+ const treeSummary = generateFullTreeSummary(branch, changes);
172
+
173
+ const response = await provider.generate(treeSummary, 'commit');
174
+ const result = provider.parseResponse(response);
175
+
176
+ console.log(result.commits);
177
+ ```
178
+
179
+ ## Supported Commit Types
180
+
181
+ Following the Conventional Commits specification:
182
+
183
+ | Type | Description |
184
+ |------|-------------|
185
+ | `feat` | New feature |
186
+ | `fix` | Bug fix |
187
+ | `docs` | Documentation |
188
+ | `style` | Formatting (no code change) |
189
+ | `refactor` | Code restructuring |
190
+ | `test` | Adding tests |
191
+ | `chore` | Maintenance |
192
+ | `perf` | Performance improvement |
193
+ | `ci` | CI/CD changes |
194
+ | `build` | Build system changes |
195
+
196
+ ## Configuration
197
+
198
+ The tool uses sensible defaults but can be configured:
199
+
200
+ | Setting | Default | Description |
201
+ |---------|---------|-------------|
202
+ | `maxInputSize` | 30000 | Maximum input size in bytes |
203
+ | `maxDiffSize` | 15000 | Maximum diff size in bytes |
204
+ | `timeout` | 120000 | AI request timeout in ms |
205
+ | `treeDepth` | 3 | Directory depth for tree compression |
206
+
207
+ ## Requirements
208
+
209
+ - Node.js >= 18.0.0
210
+ - Git repository
211
+ - Claude Code CLI or Cursor CLI installed and authenticated
212
+
213
+ ## License
214
+
215
+ MIT
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../dist/cli.js';