Skip to content

Commit ced3122

Browse files
📝 docs: Add .lobecommitignore for file exclusion patterns
1 parent 8145015 commit ced3122

File tree

7 files changed

+468
-25
lines changed

7 files changed

+468
-25
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Lobe Commit Ignore File
2+
# This file specifies which files should be excluded from git diff analysis
3+
# Each line should contain a glob pattern
4+
5+
# Lock files (included by default)
6+
*-lock.*
7+
*.lock
8+
package-lock.json
9+
yarn.lock
10+
pnpm-lock.yaml
11+
12+
# Large binary files
13+
**/*.jpg
14+
**/*.jpeg
15+
**/*.png
16+
**/*.gif
17+
**/*.svg
18+
**/*.ico
19+
**/*.webp
20+
**/*.mp4
21+
**/*.mp3
22+
**/*.wav
23+
**/*.avi
24+
**/*.mov
25+
26+
# Compressed files
27+
**/*.zip
28+
**/*.tar
29+
**/*.tar.gz
30+
**/*.rar
31+
**/*.7z
32+
33+
# Build artifacts
34+
node_modules/**
35+
dist/**
36+
build/**
37+
out/**
38+
.next/**
39+
.nuxt/**
40+
coverage/**
41+
42+
# Minified files
43+
**/*.min.js
44+
**/*.min.css
45+
46+
# Environment files
47+
.env
48+
.env.local
49+
.env.production
50+
51+
# Database files
52+
**/*.db
53+
**/*.sqlite
54+
**/*.sqlite3
55+
56+
# Log files
57+
**/*.log
58+
logs/**
59+
60+
# IDE and editor files
61+
.vscode/settings.json
62+
.idea/**
63+
*.swp
64+
*.swo
65+
66+
# OS files
67+
.DS_Store
68+
Thumbs.db
69+
70+
# Add your custom patterns below
71+
# path/to/large-asset.zip
72+
# **/*.custom-extension

packages/lobe-commit/README.md

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@ English · [简体中文](./README.zh-CN.md) · [Changelog](./CHANGELOG.md) · [
4141
- [🔗 Links](#-links)
4242
- [More Products](#more-products)
4343
- [Credits](#credits)
44+
- [🚀 Advanced Features](#-advanced-features)
45+
- [File Filtering](#file-filtering)
46+
- [Enhanced Prompts](#enhanced-prompts)
47+
- [Message Templates](#message-templates)
48+
- [Diff Compression](#diff-compression)
49+
- [Full GitMoji Support](#full-gitmoji-support)
50+
- [🔧 Configuration Reference](#-configuration-reference)
51+
- [New Configuration Options](#new-configuration-options)
52+
- [File Filtering Rules](#file-filtering-rules)
53+
- [📊 Comparison with OpenCommit](#-comparison-with-opencommit)
54+
- [🎯 Best Practices](#-best-practices)
55+
- [Optimal Workflow](#optimal-workflow)
56+
- [Performance Tips](#performance-tips)
57+
- [Quality Guidelines](#quality-guidelines)
58+
- [🔄 Migration from OpenCommit](#-migration-from-opencommit)
4459

4560
####
4661

@@ -282,6 +297,158 @@ This project is [MIT](./LICENSE) licensed.
282297

283298
<!-- LINK GROUP -->
284299

300+
## 🚀 Advanced Features
301+
302+
### File Filtering
303+
304+
Lobe Commit supports intelligent file filtering to exclude irrelevant files from analysis:
305+
306+
#### Default Exclusions
307+
308+
- Lock files (`*-lock.*`, `*.lock`)
309+
- Binary files (images, videos, archives)
310+
- Build artifacts (`dist/`, `node_modules/`, etc.)
311+
- Minified files (`*.min.js`, `*.min.css`)
312+
313+
#### Custom Exclusions
314+
315+
Create a `.lobecommitignore` file in your project root:
316+
317+
```gitignore
318+
# Custom ignore patterns
319+
path/to/large-asset.zip
320+
**/*.custom-extension
321+
docs/api/*.json
322+
323+
# Environment-specific files
324+
.env.staging
325+
config/secrets.yaml
326+
```
327+
328+
### Enhanced Prompts
329+
330+
The new prompt system provides:
331+
332+
- **Context Awareness**: Analyzes file paths, function names, and change patterns
333+
- **Business Impact Focus**: Emphasizes user-facing changes and business value
334+
- **Technical Precision**: Better understanding of architectural decisions
335+
- **WHY Explanations**: Optional explanations of change motivations
336+
337+
#### Configuration Options
338+
339+
```bash
340+
# Include "why" explanations in commit messages
341+
lobe-commit --config
342+
343+
# Select "includeWhy" and set to true
344+
```
345+
346+
### Message Templates
347+
348+
Support for custom message templates with placeholders:
349+
350+
```bash
351+
# Example: Include issue references
352+
git commit # message: "feat: add user authentication"
353+
# With template: "feat: add user authentication (#123)"
354+
```
355+
356+
Configure template in settings:
357+
358+
- `messageTemplate`: Pattern like `"$msg (#123)"` or `"[PROJ-456] $msg"`
359+
360+
### Diff Compression
361+
362+
Intelligent diff compression for large changes:
363+
364+
- Prioritizes actual code changes over context
365+
- Maintains file headers and change indicators
366+
- Truncates verbose output while preserving meaning
367+
- Maximum 200 lines by default (configurable)
368+
369+
### Full GitMoji Support
370+
371+
Toggle between:
372+
373+
- **Simplified**: 10 most common emojis (default)
374+
- **Full Specification**: Complete gitmoji.dev standard
375+
376+
```bash
377+
# Enable full GitMoji specification
378+
lobe-commit --config
379+
# Set "useFullGitmoji" to true
380+
```
381+
382+
## 🔧 Configuration Reference
383+
384+
### New Configuration Options
385+
386+
| Option | Type | Default | Description |
387+
| ----------------- | ------- | -------- | ---------------------------------------------- |
388+
| `includeWhy` | boolean | `false` | Include explanation of why changes were made |
389+
| `messageTemplate` | string | `"$msg"` | Template for commit messages with placeholders |
390+
| `oneLineCommit` | boolean | `false` | Force single-line commit messages |
391+
| `useFullGitmoji` | boolean | `false` | Use complete GitMoji specification |
392+
393+
### File Filtering Rules
394+
395+
1. **Default patterns** are always applied
396+
2. **Custom patterns** from `.lobecommitignore` are added
397+
3. **Glob patterns** supported (e.g., `**/*.test.js`)
398+
4. **Comments** supported with `#` prefix
399+
5. **Case sensitive** pattern matching
400+
401+
## 📊 Comparison with OpenCommit
402+
403+
| Feature | Lobe Commit | OpenCommit |
404+
| ----------------- | ---------------------- | ---------------------- |
405+
| Interactive UI | ✅ Rich CLI UI | ❌ Simple prompts |
406+
| File Filtering |`.lobecommitignore` |`.opencommitignore` |
407+
| Streaming | ✅ Real-time | ❌ Batch only |
408+
| Issue Integration | ✅ GitHub Issues | ❌ Manual only |
409+
| Custom Prompts | ✅ Enhanced system | ✅ Basic templates |
410+
| Diff Compression | ✅ Intelligent | ❌ Raw diff |
411+
| Multi-language | ✅ Built-in | ✅ Via config |
412+
413+
## 🎯 Best Practices
414+
415+
### Optimal Workflow
416+
417+
1. **Stage relevant changes**: `git add <specific-files>`
418+
2. **Use file filtering**: Create `.lobecommitignore` for project
419+
3. **Configure templates**: Set up issue/PR reference patterns
420+
4. **Enable WHY mode**: For complex architectural changes
421+
5. **Review and edit**: Use the interactive interface to refine
422+
423+
### Performance Tips
424+
425+
- Use `.lobecommitignore` to exclude large files
426+
- Enable diff compression for complex changes
427+
- Use specific staging rather than `git add .`
428+
- Configure appropriate `maxLength` for your team
429+
430+
### Quality Guidelines
431+
432+
- Enable `includeWhy` for refactoring commits
433+
- Use full GitMoji for detailed categorization
434+
- Configure locale for international teams
435+
- Set up message templates for consistency
436+
437+
## 🔄 Migration from OpenCommit
438+
439+
If you're migrating from OpenCommit:
440+
441+
1. **Rename ignore file**: `.opencommitignore``.lobecommitignore`
442+
2. **Update config**: Most settings transfer directly
443+
3. **Enable streaming**: For better user experience
444+
4. **Try interactive mode**: Leverage the rich UI features
445+
446+
```bash
447+
# Quick migration
448+
cp .opencommitignore .lobecommitignore
449+
lobe-commit --config # Set up your preferences
450+
```
451+
285452
[back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square
286453
[bun-link]: https://bun.sh
287454
[bun-shield]: https://img.shields.io/badge/-speedup%20with%20bun-black?logo=bun&style=for-the-badge

packages/lobe-commit/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@
5858
"gitconfig": "^2.0.8",
5959
"gpt-tokenizer": "^2.8.1",
6060
"ink": "^4.4.1",
61-
"lodash-es": "^4.17.21",
61+
"lodash-es": "^4",
62+
"minimatch": "^10.0.1",
6263
"octokit": "^4.0.3",
63-
"openai": "^4.103.0",
64+
"openai": "^4",
6465
"pangu": "^4.0.7",
6566
"path-exists": "^5.0.0",
6667
"react": "^18.3.1",

0 commit comments

Comments
 (0)