11# commit-from-branch
22
3- Flexible commit message templating from branch name (ticket/segments) for Husky's ` prepare-commit-msg ` hook.
3+ <div align =" center " >
4+
5+ [ ![ NPM Version] ( https://img.shields.io/npm/v/@253eosam/commit-from-branch?style=flat-square&color=blue )] ( https://www.npmjs.com/package/@253eosam/commit-from-branch )
6+ [ ![ NPM Downloads] ( https://img.shields.io/npm/dm/@253eosam/commit-from-branch?style=flat-square&color=green )] ( https://www.npmjs.com/package/@253eosam/commit-from-branch )
7+ [ ![ GitHub Release] ( https://img.shields.io/github/v/release/253eosam/commit-from-branch?style=flat-square&color=purple )] ( https://github.com/253eosam/commit-from-branch/releases )
8+ [ ![ License] ( https://img.shields.io/npm/l/@253eosam/commit-from-branch?style=flat-square&color=orange )] ( https://github.com/253eosam/commit-from-branch/blob/main/LICENSE )
9+
10+ [ ![ CI Status] ( https://img.shields.io/github/actions/workflow/status/253eosam/commit-from-branch/release.yml?style=flat-square&label=CI )] ( https://github.com/253eosam/commit-from-branch/actions )
11+ [ ![ GitHub Pages] ( https://img.shields.io/github/deployments/253eosam/commit-from-branch/github-pages?style=flat-square&label=Demo )] ( https://253eosam.github.io/commit-from-branch/ )
12+ [ ![ Node.js] ( https://img.shields.io/node/v/@253eosam/commit-from-branch?style=flat-square&color=brightgreen )] ( https://nodejs.org/ )
13+ [ ![ TypeScript] ( https://img.shields.io/badge/TypeScript-Ready-blue?style=flat-square )] ( https://www.typescriptlang.org/ )
14+
15+ </div >
16+
17+ ** Flexible commit message templating from branch name (ticket/segments) for Husky's ` prepare-commit-msg ` hook.**
418
519Automatically formats your commit messages based on your branch name, extracting Jira-style tickets (e.g., ` ABC-123 ` ) and supporting flexible templating with branch segments.
620
@@ -14,19 +28,35 @@ Automatically formats your commit messages based on your branch name, extracting
1428- 🎨 ** Pattern matching** - Include/exclude branches with glob patterns
1529- 🏃 ** Fast & lightweight** - Minimal dependencies, TypeScript-based
1630
17- ## Installation
31+
32+ ## 📖 Table of Contents
33+
34+ - [ Demo] ( #-demo )
35+ - [ Installation] ( #-installation )
36+ - [ Quick Start] ( #-quick-start )
37+ - [ Configuration] ( #-configuration )
38+ - [ Template Variables] ( #-template-variables )
39+ - [ Examples] ( #-examples )
40+ - [ Debug Mode] ( #-debug-mode )
41+ - [ Programmatic Usage] ( #-programmatic-usage )
42+ - [ How It Works] ( #-how-it-works )
43+ - [ Requirements] ( #-requirements )
44+ - [ Contributing] ( #-contributing )
45+ - [ Links] ( #-links )
46+
47+ ## 🌐 Demo
48+
49+ ** [ 🚀 Live Demo] ( https://253eosam.github.io/commit-from-branch/ ) ** - Try the interactive demo to see how commit message templating works!
50+
51+ ## 📦 Installation
1852
1953``` bash
2054npm install @253eosam/commit-from-branch --save-dev
2155```
2256
2357> ** Note** : This package requires Husky v9 as a peer dependency. npm will automatically warn you if it's not installed.
2458
25- ## Demo
26-
27- 🌐 ** [ Live Demo] ( https://253eosam.github.io/commit-from-branch/ ) ** - Try the interactive demo to see how commit message templating works!
28-
29- ## Quick Start
59+ ## 🚀 Quick Start
3060
31611 . ** Install Husky v9** (if not already installed):
3262
@@ -62,7 +92,7 @@ git commit -m "implement user authentication"
6292# Result: "[ABC-123] implement user authentication"
6393```
6494
65- ## Configuration
95+ ## ⚙️ Configuration
6696
6797Add configuration to your ` package.json ` :
6898
@@ -86,7 +116,7 @@ Add configuration to your `package.json`:
86116| ` includePattern ` | ` string \| string[] ` | ` ["*"] ` | Glob patterns for branches to include |
87117| ` exclude ` | ` string[] ` | ` ["merge", "squash", "revert"] ` | Commit sources to exclude |
88118
89- ## Template Variables
119+ ## 🔧 Template Variables
90120
91121Use these placeholders in your format templates:
92122
@@ -100,7 +130,7 @@ Use these placeholders in your format templates:
100130| ` ${msg} ` | Original commit message | ` implement user authentication ` |
101131| ` ${body} ` | Full original commit body | Multi-line commit content |
102132
103- ## Examples
133+ ## 💡 Examples
104134
105135### Basic Ticket Extraction
106136
@@ -156,23 +186,23 @@ Use these placeholders in your format templates:
156186}
157187```
158188
159- ## Debug Mode
189+ ## 🐛 Debug Mode
160190
161191Enable debug logging:
162192
163193``` bash
164194BRANCH_PREFIX_DEBUG=1 git commit -m " test message"
165195```
166196
167- ## Dry Run Mode
197+ ## 🧪 Dry Run Mode
168198
169199Test without modifying commit messages:
170200
171201``` bash
172202BRANCH_PREFIX_DRYRUN=1 git commit -m " test message"
173203```
174204
175- ## Programmatic Usage
205+ ## 🔌 Programmatic Usage
176206
177207``` typescript
178208import { run } from " @253eosam/commit-from-branch" ;
@@ -192,7 +222,7 @@ import { initHusky } from "@253eosam/commit-from-branch/init";
192222initHusky (" /path/to/repo" );
193223```
194224
195- ## How It Works
225+ ## ⚡ How It Works
196226
1972271 . ** Hook Integration** : Integrates with Husky's ` prepare-commit-msg ` hook
1982282 . ** Branch Detection** : Gets current branch name using ` git rev-parse --abbrev-ref HEAD `
@@ -201,13 +231,13 @@ initHusky("/path/to/repo");
2012315 . ** Template Rendering** : Replaces placeholders with actual values
2022326 . ** Message Formatting** : Updates commit message file with formatted result
203233
204- ## Requirements
234+ ## 📋 Requirements
205235
206236- Node.js >= 16
207237- Git repository
208238- Husky v9 (peer dependency)
209239
210- ## Contributing
240+ ## 🤝 Contributing
211241
2122421 . Fork the repository
2132432 . Create a feature branch: ` git checkout -b feature/my-feature `
@@ -217,6 +247,34 @@ initHusky("/path/to/repo");
2172476 . Push to the branch: ` git push origin feature/my-feature `
2182487 . Submit a pull request
219249
220- ## License
250+ ## 🔗 Links
251+
252+ ### Package & Releases
253+ - ** [ 📦 NPM Package] ( https://www.npmjs.com/package/@253eosam/commit-from-branch ) ** - Official NPM package
254+ - ** [ 🚀 GitHub Releases] ( https://github.com/253eosam/commit-from-branch/releases ) ** - Release notes and downloads
255+ - ** [ 🌐 Live Demo] ( https://253eosam.github.io/commit-from-branch/ ) ** - Interactive demo
256+
257+ ### Development & Community
258+ - ** [ 💻 Source Code] ( https://github.com/253eosam/commit-from-branch ) ** - GitHub repository
259+ - ** [ 🐛 Report Issues] ( https://github.com/253eosam/commit-from-branch/issues ) ** - Bug reports and feature requests
260+ - ** [ 📊 CI/CD Pipeline] ( https://github.com/253eosam/commit-from-branch/actions ) ** - Build status and automation
261+ - ** [ 📈 NPM Stats] ( https://npmcharts.com/compare/@253eosam/commit-from-branch ) ** - Download statistics
262+
263+ ### Documentation
264+ - ** [ 📚 API Documentation] ( https://github.com/253eosam/commit-from-branch#-programmatic-usage ) ** - Programmatic usage guide
265+ - ** [ ⚙️ Configuration Guide] ( https://github.com/253eosam/commit-from-branch#%EF%B8%8F-configuration ) ** - Setup and customization
266+ - ** [ 🔧 Template Variables] ( https://github.com/253eosam/commit-from-branch#-template-variables ) ** - Available placeholders
267+
268+ ## 📄 License
221269
222270MIT © [ 253eosam] ( https://github.com/253eosam )
271+
272+ ---
273+
274+ <div align =" center " >
275+
276+ ** [ ⬆ Back to Top] ( #commit-from-branch ) **
277+
278+ Made with ❤️ by [ 253eosam] ( https://github.com/253eosam )
279+
280+ </div >
0 commit comments