orcommit 1.0.0 โ 1.0.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 +149 -42
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ORCommit Git Manager
|
|
2
2
|
|
|
3
3
|
> AI-powered Git commit message generator with efficient chunk processing for large files
|
|
4
4
|
|
|
@@ -6,19 +6,21 @@
|
|
|
6
6
|
[](https://github.com/ellerbrock/typescript-badges/)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
|
-
A sophisticated CLI tool that generates meaningful, contextual commit messages using
|
|
9
|
+
A sophisticated CLI tool that generates meaningful, contextual commit messages using ORCommit and OpenAI APIs. Designed with a modular TypeScript architecture and optimized for handling large codebases through intelligent diff chunking.
|
|
10
10
|
|
|
11
11
|
## โจ Features
|
|
12
12
|
|
|
13
|
-
- ๐ค **AI-Powered**: Generate commit messages using
|
|
14
|
-
- ๐ฆ **
|
|
15
|
-
-
|
|
13
|
+
- ๐ค **AI-Powered**: Generate commit messages using ORCommit and OpenAI models
|
|
14
|
+
- ๐ฆ **Token-Aware Chunking**: Intelligently split large diffs based on actual token limits
|
|
15
|
+
- ๐ **Smart Push Integration**: Interactive push prompts with automatic upstream setup
|
|
16
|
+
- ๐จ **Elegant UI**: Structured progress with phase indicators and timing
|
|
17
|
+
- โก **Lightning Fast**: Intelligent caching with memory and disk persistence
|
|
18
|
+
- ๐ง **Highly Configurable**: Extensive CLI options and provider settings
|
|
16
19
|
- ๐ **Secure**: Safe storage of API keys with proper file permissions (600)
|
|
17
|
-
- ๐ฏ **Conventional Commits**:
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
- ๐งช **Well-Tested**: Comprehensive test suite with Jest
|
|
20
|
+
- ๐ฏ **Conventional Commits**: Full support for conventional commit format with emoji
|
|
21
|
+
- ๐ก๏ธ **Robust**: Comprehensive error handling with timeouts and auto-recovery
|
|
22
|
+
- ๐ง **Smart Filtering**: Automatically filters generated files and whitespace
|
|
23
|
+
- ๐งช **Production Ready**: Comprehensive test suite with 90%+ coverage
|
|
22
24
|
|
|
23
25
|
## ๐ Installation
|
|
24
26
|
|
|
@@ -61,30 +63,60 @@ That's it! The tool will analyze your staged changes and generate an appropriate
|
|
|
61
63
|
Generate and create a commit message for staged changes.
|
|
62
64
|
|
|
63
65
|
**Options:**
|
|
66
|
+
|
|
67
|
+
**Basic Options:**
|
|
64
68
|
- `-y, --yes` - Skip confirmation and auto-commit
|
|
69
|
+
- `-d, --dry-run` - Generate message without creating commit
|
|
70
|
+
- `-v, --verbose` - Enable verbose logging
|
|
71
|
+
- `-w, --watch` - Watch for changes and auto-generate commits
|
|
72
|
+
|
|
73
|
+
**Commit Format:**
|
|
65
74
|
- `-s, --scope <scope>` - Specify commit scope (e.g., auth, ui, api)
|
|
66
75
|
- `-t, --type <type>` - Specify commit type (feat, fix, docs, etc.)
|
|
67
76
|
- `-b, --breaking` - Mark as breaking change
|
|
68
|
-
-
|
|
69
|
-
-
|
|
77
|
+
- `--emoji` - Include appropriate emoji in commit message
|
|
78
|
+
- `--one-line` - Generate single-line commit message
|
|
79
|
+
- `--description-length <length>` - Maximum description length
|
|
80
|
+
|
|
81
|
+
**Provider & Processing:**
|
|
70
82
|
- `-p, --provider <provider>` - Specify AI provider (openrouter|openai)
|
|
83
|
+
- `--max-files <count>` - Maximum number of files to analyze
|
|
84
|
+
- `--ignore-generated` - Ignore auto-generated files (default: true)
|
|
85
|
+
- `--ignore-whitespace` - Ignore whitespace-only changes (default: true)
|
|
86
|
+
|
|
87
|
+
**Caching:**
|
|
88
|
+
- `--no-cache` - Disable caching for this commit
|
|
89
|
+
- `--clear-cache` - Clear cache before generating
|
|
90
|
+
|
|
91
|
+
**Git Integration:**
|
|
92
|
+
- `--push` - Push changes to remote after commit
|
|
93
|
+
- `--auto-push` - Automatically push all future commits
|
|
71
94
|
|
|
72
95
|
**Examples:**
|
|
73
96
|
```bash
|
|
74
|
-
# Basic usage
|
|
97
|
+
# Basic usage with interactive push prompt
|
|
75
98
|
orc commit
|
|
76
99
|
|
|
77
|
-
# Auto-confirm
|
|
78
|
-
orc commit --yes --
|
|
100
|
+
# Auto-confirm and push
|
|
101
|
+
orc commit --yes --push
|
|
102
|
+
|
|
103
|
+
# Generate with emoji and one-line format
|
|
104
|
+
orc commit --emoji --one-line
|
|
105
|
+
|
|
106
|
+
# Specify type, scope and auto-push
|
|
107
|
+
orc commit --type feat --scope auth --auto-push
|
|
79
108
|
|
|
80
109
|
# Dry run to see generated message
|
|
81
|
-
orc commit --dry-run
|
|
110
|
+
orc commit --dry-run --verbose
|
|
111
|
+
|
|
112
|
+
# Breaking change with description limit
|
|
113
|
+
orc commit --breaking --type feat --description-length 50
|
|
82
114
|
|
|
83
|
-
#
|
|
84
|
-
orc commit --provider openai
|
|
115
|
+
# Clear cache and use specific provider
|
|
116
|
+
orc commit --clear-cache --provider openai
|
|
85
117
|
|
|
86
|
-
#
|
|
87
|
-
orc commit --
|
|
118
|
+
# Process only 5 files with no caching
|
|
119
|
+
orc commit --max-files 5 --no-cache
|
|
88
120
|
```
|
|
89
121
|
|
|
90
122
|
### `orc config`
|
|
@@ -108,6 +140,20 @@ orc config get openrouter
|
|
|
108
140
|
orc config path
|
|
109
141
|
```
|
|
110
142
|
|
|
143
|
+
### `orc cache`
|
|
144
|
+
Manage intelligent caching system.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Show cache statistics
|
|
148
|
+
orc cache stats
|
|
149
|
+
|
|
150
|
+
# Clear all cached data
|
|
151
|
+
orc cache clear
|
|
152
|
+
|
|
153
|
+
# Clean up expired entries
|
|
154
|
+
orc cache cleanup
|
|
155
|
+
```
|
|
156
|
+
|
|
111
157
|
### `orc test`
|
|
112
158
|
Test API connection for configured providers.
|
|
113
159
|
|
|
@@ -171,20 +217,26 @@ The tool is built with a modular TypeScript architecture:
|
|
|
171
217
|
|
|
172
218
|
### Core Modules
|
|
173
219
|
|
|
174
|
-
- **CLI Module**: Command-line interface using Commander.js
|
|
175
|
-
- **Config Module**: Secure configuration management with file permissions
|
|
176
|
-
- **Git Module**: Git repository interaction
|
|
177
|
-
- **API Module**: HTTP client with
|
|
178
|
-
- **Logger Module**:
|
|
179
|
-
- **
|
|
220
|
+
- **CLI Module**: Command-line interface using Commander.js with @clack/prompts
|
|
221
|
+
- **Config Module**: Secure configuration management with file permissions (600)
|
|
222
|
+
- **Git Module**: Advanced Git repository interaction with intelligent diff parsing
|
|
223
|
+
- **API Module**: Robust HTTP client with exponential backoff and concurrency control
|
|
224
|
+
- **Logger Module**: Elegant progress indicators with timing and structured output
|
|
225
|
+
- **Tokenizer Module**: Token-aware chunking using tiktoken for accurate processing
|
|
226
|
+
- **Cache Module**: Two-level caching (memory + disk) with TTL and cleanup
|
|
227
|
+
- **Diff Filter Module**: Smart filtering of generated files and irrelevant changes
|
|
228
|
+
- **Core Orchestrator**: Main coordination with phase-based processing
|
|
180
229
|
|
|
181
230
|
### Key Features
|
|
182
231
|
|
|
183
|
-
- **
|
|
184
|
-
- **
|
|
185
|
-
- **
|
|
186
|
-
- **
|
|
187
|
-
- **
|
|
232
|
+
- **Token-Based Chunking**: Uses tiktoken to respect actual model token limits
|
|
233
|
+
- **Intelligent Caching**: Memory + disk caching with automatic cleanup and TTL
|
|
234
|
+
- **Smart Filtering**: Automatically filters out generated files, lock files, and whitespace-only changes
|
|
235
|
+
- **Interactive Push**: Prompts user for push with automatic upstream configuration
|
|
236
|
+
- **Elegant UI**: Phase-based progress with emojis, timing, and structured output
|
|
237
|
+
- **Robust Error Handling**: Comprehensive error types with timeout protection
|
|
238
|
+
- **Type Safety**: Full TypeScript coverage with strict mode enabled
|
|
239
|
+
- **Production Ready**: Extensive test suite with unit and integration tests
|
|
188
240
|
|
|
189
241
|
## ๐ง Advanced Usage
|
|
190
242
|
|
|
@@ -197,20 +249,33 @@ export OPENROUTER_API_KEY="your-key-here"
|
|
|
197
249
|
export OPENAI_API_KEY="your-openai-key"
|
|
198
250
|
```
|
|
199
251
|
|
|
200
|
-
###
|
|
252
|
+
### Smart File Processing
|
|
253
|
+
|
|
254
|
+
The tool intelligently processes large codebases:
|
|
255
|
+
|
|
256
|
+
**Token-Aware Chunking:**
|
|
257
|
+
- Uses tiktoken for accurate token counting
|
|
258
|
+
- Respects model-specific token limits (GPT-4: 8K, Claude: 100K)
|
|
259
|
+
- Preserves context at logical boundaries (files, functions)
|
|
260
|
+
- Dynamic chunk sizing based on available tokens
|
|
201
261
|
|
|
202
|
-
|
|
262
|
+
**Intelligent Filtering:**
|
|
263
|
+
- Auto-detects and skips generated files (dist/, build/, .lock files)
|
|
264
|
+
- Filters out whitespace-only changes
|
|
265
|
+
- Relevancy scoring to focus on meaningful changes
|
|
266
|
+
- Configurable file size limits (default: 1MB per file)
|
|
203
267
|
|
|
204
|
-
|
|
205
|
-
-
|
|
206
|
-
-
|
|
268
|
+
**Performance:**
|
|
269
|
+
- Memory + disk caching for instant repeated requests
|
|
270
|
+
- Concurrent API processing (up to 3 parallel requests)
|
|
271
|
+
- Exponential backoff for rate limit handling
|
|
207
272
|
|
|
208
273
|
### Custom Models
|
|
209
274
|
|
|
210
275
|
Configure specific models for each provider:
|
|
211
276
|
|
|
212
277
|
```bash
|
|
213
|
-
#
|
|
278
|
+
# ORCommit models
|
|
214
279
|
orc config model openrouter anthropic/claude-3-haiku:beta
|
|
215
280
|
orc config model openrouter openai/gpt-4-turbo-preview
|
|
216
281
|
|
|
@@ -219,6 +284,33 @@ orc config model openai gpt-4
|
|
|
219
284
|
orc config model openai gpt-3.5-turbo
|
|
220
285
|
```
|
|
221
286
|
|
|
287
|
+
### Interactive Experience
|
|
288
|
+
|
|
289
|
+
**Elegant Progress Display:**
|
|
290
|
+
```
|
|
291
|
+
๐ Analyzing changes...
|
|
292
|
+
โ Found 15 staged files
|
|
293
|
+
โ Ready to analyze 12 files
|
|
294
|
+
|
|
295
|
+
๐ค Generating commit message...
|
|
296
|
+
โ Commit message generated (1.2s)
|
|
297
|
+
|
|
298
|
+
๐พ Creating commit...
|
|
299
|
+
โ Commit created
|
|
300
|
+
โ Commit: feat(ui): add interactive push prompts
|
|
301
|
+
|
|
302
|
+
Do you want to push to remote? โบ Yes
|
|
303
|
+
๐ Pushing to remote...
|
|
304
|
+
โ Pushed to main (2.1s)
|
|
305
|
+
โ Changes pushed successfully
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Smart Push Integration:**
|
|
309
|
+
- Interactive prompts for push decisions
|
|
310
|
+
- Automatic upstream branch setup
|
|
311
|
+
- Support for multiple remotes
|
|
312
|
+
- Graceful handling of push failures
|
|
313
|
+
|
|
222
314
|
## ๐งช Development
|
|
223
315
|
|
|
224
316
|
### Setup
|
|
@@ -259,7 +351,7 @@ npm test -- utils.test.ts
|
|
|
259
351
|
|
|
260
352
|
- Node.js >= 16.0.0
|
|
261
353
|
- Git repository
|
|
262
|
-
-
|
|
354
|
+
- ORCommit or OpenAI API key
|
|
263
355
|
|
|
264
356
|
## ๐ Security
|
|
265
357
|
|
|
@@ -276,13 +368,26 @@ npm test -- utils.test.ts
|
|
|
276
368
|
|
|
277
369
|
**"No staged changes found"**
|
|
278
370
|
- Use `git add` to stage files before generating commits
|
|
371
|
+
- Check if files are in .gitignore
|
|
279
372
|
|
|
280
373
|
**"API key not configured"**
|
|
281
374
|
- Set your API key: `orc config set openrouter your-key`
|
|
375
|
+
- Verify with: `orc config get`
|
|
282
376
|
|
|
283
|
-
**"
|
|
377
|
+
**"All changes were filtered out"**
|
|
378
|
+
- Check if only generated files were changed
|
|
379
|
+
- Try with `--ignore-generated=false` to include all files
|
|
380
|
+
- Use `--verbose` to see what was filtered
|
|
381
|
+
|
|
382
|
+
**"Operation timed out"**
|
|
383
|
+
- Large repositories may take time - operations auto-timeout at 30s
|
|
384
|
+
- Try with `--max-files 10` to limit scope
|
|
284
385
|
- Check your internet connection and API key validity
|
|
285
|
-
|
|
386
|
+
|
|
387
|
+
**"Push failed"**
|
|
388
|
+
- Ensure you have push permissions to the repository
|
|
389
|
+
- Check if upstream branch is configured: `git branch -vv`
|
|
390
|
+
- Try manual push first: `git push`
|
|
286
391
|
|
|
287
392
|
### Debug Mode
|
|
288
393
|
|
|
@@ -314,5 +419,7 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
314
419
|
- [OpenRouter](https://openrouter.ai/) for providing access to multiple AI models
|
|
315
420
|
- [OpenAI](https://openai.com/) for their powerful language models
|
|
316
421
|
- The open-source community for the excellent tools and libraries used in this project
|
|
317
|
-
|
|
318
|
-
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
**Built with โค๏ธ using TypeScript, Commander.js, and cutting-edge AI technology.**
|