|
| 1 | +# 📝 Commit Message Convention |
| 2 | + |
| 3 | +This project follows [Conventional Commits](https://www.conventionalcommits.org/) specification for automated changelog generation and semantic versioning. |
| 4 | + |
| 5 | +## Format |
| 6 | + |
| 7 | +``` |
| 8 | +<type>[optional scope]: <description> |
| 9 | +
|
| 10 | +[optional body] |
| 11 | +
|
| 12 | +[optional footer(s)] |
| 13 | +``` |
| 14 | + |
| 15 | +## Types |
| 16 | + |
| 17 | +| Type | Description | Version Bump | |
| 18 | +| ---------- | ------------------------ | ------------ | |
| 19 | +| `feat` | New feature | Minor | |
| 20 | +| `fix` | Bug fix | Patch | |
| 21 | +| `perf` | Performance improvement | Patch | |
| 22 | +| `refactor` | Code refactoring | Patch | |
| 23 | +| `docs` | Documentation changes | Patch | |
| 24 | +| `style` | Code style changes | Patch | |
| 25 | +| `test` | Adding or updating tests | Patch | |
| 26 | +| `build` | Build system changes | Patch | |
| 27 | +| `ci` | CI/CD changes | Patch | |
| 28 | +| `chore` | Maintenance tasks | No bump | |
| 29 | + |
| 30 | +## Breaking Changes |
| 31 | + |
| 32 | +Add `BREAKING CHANGE:` in the footer or `!` after type to indicate breaking changes: |
| 33 | + |
| 34 | +```bash |
| 35 | +feat!: remove deprecated API endpoints |
| 36 | + |
| 37 | +BREAKING CHANGE: The old API endpoints have been removed. Use the new v2 endpoints instead. |
| 38 | +``` |
| 39 | + |
| 40 | +## Examples |
| 41 | + |
| 42 | +### Features |
| 43 | + |
| 44 | +```bash |
| 45 | +feat: add GitHub auto-fill integration |
| 46 | +feat(ui): implement dark mode toggle |
| 47 | +feat!: migrate to Next.js 15 App Router |
| 48 | +``` |
| 49 | + |
| 50 | +### Bug Fixes |
| 51 | + |
| 52 | +```bash |
| 53 | +fix: resolve skill selection persistence issue |
| 54 | +fix(mobile): correct responsive navigation layout |
| 55 | +fix(a11y): improve keyboard navigation for forms |
| 56 | +``` |
| 57 | + |
| 58 | +### Performance |
| 59 | + |
| 60 | +```bash |
| 61 | +perf: optimize image loading with next/image |
| 62 | +perf(build): reduce bundle size by 30% |
| 63 | +``` |
| 64 | + |
| 65 | +### Documentation |
| 66 | + |
| 67 | +```bash |
| 68 | +docs: update installation instructions |
| 69 | +docs(api): add TypeScript examples |
| 70 | +docs(readme): fix broken demo links |
| 71 | +``` |
| 72 | + |
| 73 | +### Refactoring |
| 74 | + |
| 75 | +```bash |
| 76 | +refactor: convert components to TypeScript |
| 77 | +refactor(store): migrate to Zustand state management |
| 78 | +``` |
| 79 | + |
| 80 | +## Scopes (Optional) |
| 81 | + |
| 82 | +Use scopes to indicate the area of change: |
| 83 | + |
| 84 | +- `ui` - User interface components |
| 85 | +- `api` - API related changes |
| 86 | +- `build` - Build system |
| 87 | +- `ci` - Continuous integration |
| 88 | +- `docs` - Documentation |
| 89 | +- `test` - Testing |
| 90 | +- `a11y` - Accessibility |
| 91 | +- `perf` - Performance |
| 92 | +- `mobile` - Mobile-specific changes |
| 93 | + |
| 94 | +## Tools |
| 95 | + |
| 96 | +### Commitizen (Recommended) |
| 97 | + |
| 98 | +Install commitizen for interactive commit messages: |
| 99 | + |
| 100 | +```bash |
| 101 | +npm install -g commitizen cz-conventional-changelog |
| 102 | +echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc |
| 103 | +``` |
| 104 | + |
| 105 | +Use `git cz` instead of `git commit`: |
| 106 | + |
| 107 | +```bash |
| 108 | +git add . |
| 109 | +git cz |
| 110 | +``` |
| 111 | + |
| 112 | +### VS Code Extension |
| 113 | + |
| 114 | +Install "Conventional Commits" extension for VS Code to get commit message templates. |
| 115 | + |
| 116 | +## Automated Release Process |
| 117 | + |
| 118 | +1. **Commit** using conventional format |
| 119 | +2. **Push** to master branch |
| 120 | +3. **Release Please** analyzes commits |
| 121 | +4. **Creates PR** with changelog and version bump |
| 122 | +5. **Merge PR** to trigger release and deployment |
| 123 | + |
| 124 | +## Examples in Practice |
| 125 | + |
| 126 | +```bash |
| 127 | +# Adding new feature |
| 128 | +git commit -m "feat(ui): add accessibility menu with font size controls" |
| 129 | + |
| 130 | +# Fixing bug |
| 131 | +git commit -m "fix(mobile): resolve navigation menu overflow on small screens" |
| 132 | + |
| 133 | +# Breaking change |
| 134 | +git commit -m "feat!: migrate to Next.js 15 App Router |
| 135 | +
|
| 136 | +BREAKING CHANGE: Pages directory structure has changed. |
| 137 | +See migration guide for updating custom pages." |
| 138 | + |
| 139 | +# Performance improvement |
| 140 | +git commit -m "perf(build): implement code splitting for 50% bundle reduction" |
| 141 | + |
| 142 | +# Documentation update |
| 143 | +git commit -m "docs(contributing): add TypeScript coding standards" |
| 144 | +``` |
| 145 | + |
| 146 | +## Benefits |
| 147 | + |
| 148 | +- ✅ **Automated changelogs** - No manual changelog maintenance |
| 149 | +- ✅ **Semantic versioning** - Automatic version bumps based on commit types |
| 150 | +- ✅ **Release notes** - Rich, categorized release notes |
| 151 | +- ✅ **Consistency** - Standardized commit history |
| 152 | +- ✅ **Tooling integration** - Works with Release Please, semantic-release, etc. |
0 commit comments