Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a3b5ed9
feat: remove old scripts
volbrene Sep 18, 2025
ea6dfa4
feat: init typescript
volbrene Sep 18, 2025
52d600a
feat: add build to pretest
volbrene Sep 18, 2025
1dd2632
feat: init first cli tests
volbrene Sep 18, 2025
1838177
feat: fix uninstall test
volbrene Sep 18, 2025
452a7b6
feat: refactoring src
volbrene Sep 18, 2025
de52308
feat: update Readme
volbrene Sep 18, 2025
f2167b4
feat: simplify CLI command names in README
volbrene Sep 18, 2025
1915e50
feat: update section header for CLI commands in README
volbrene Sep 18, 2025
31787f1
feat: erweitere Branch-Konfiguration in release.config.cjs
volbrene Sep 18, 2025
85b9715
feat: aktualisiere CI- und Release-Workflows zur Vereinfachung der Tr…
volbrene Sep 18, 2025
4c94e22
test: fix tests
volbrene Sep 18, 2025
e082912
chore(release): 1.9.0-beta.1 [skip ci]
semantic-release-bot Sep 18, 2025
c739c07
chore: update workflow
volbrene Sep 18, 2025
8920483
Merge branch 'develop' of https://github.com/volbrene/githooks into d…
volbrene Sep 18, 2025
151fcde
chore: update workflow
volbrene Sep 18, 2025
9c3677d
fix: ensure 'prepare' script is set in package.json for init command
volbrene Sep 18, 2025
ac05ee4
chore(release): 1.9.0-beta.2 [skip ci]
semantic-release-bot Sep 18, 2025
5fec6e4
chore: add getHooksDir function to retrieve hooks directory path
volbrene Sep 18, 2025
d8b87db
Merge branch 'develop' of https://github.com/volbrene/githooks into d…
volbrene Sep 18, 2025
7d47806
refactor: move git utility functions to utils directory
volbrene Sep 18, 2025
7d59827
chore: add npm downloads badge to README
volbrene Sep 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .github/workflows/ci.yml → .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: CI
name: Lint & Test
on:
pull_request:
push:
branches: [main]

workflow_call:
jobs:
lint-and-test:
runs-on: ubuntu-latest
Expand All @@ -13,12 +11,9 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci

# Run prettier check (fails if formatting is wrong)
- name: Install deps
run: npm ci
- name: Run Prettier
run: npm run lint:prettier

# Run tests only if Prettier passed
- name: Run Tests
run: npm test -- --runInBand
35 changes: 14 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,36 @@
name: Release
name: Release & Publish
on:
workflow_run:
workflows: ['CI']
types: [completed]
push:
branches: ['main', 'rc', 'develop']

jobs:
release:
# Only run if CI succeeded AND the source branch was main
if: >
${{
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'main'
}}
quality:
uses: ./.github/workflows/lint-and-test.yml

publish:
name: Semantic Release
needs: quality
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
steps:
- name: Check out the exact commit from the CI run
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_sha }}

- uses: actions/setup-node@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
registry-url: 'https://registry.npmjs.org/'

- run: npm ci

- name: Run Prettier
run: npm run lint:prettier

- name: Run Tests
run: npm test -- --runInBand
- name: Install deps
run: npm ci

- name: Check NPM token works
run: npm whoami --registry=https://registry.npmjs.org/
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
coverage
coverage
dist
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
## [1.9.0-beta.2](https://github.com/volbrene/githooks/compare/v1.9.0-beta.1...v1.9.0-beta.2) (2025-09-18)

### Bug Fixes

* ensure 'prepare' script is set in package.json for init command ([9c3677d](https://github.com/volbrene/githooks/commit/9c3677d2da42d26a5ffebf36621562e25f34ab36))

## [1.9.0-beta.1](https://github.com/volbrene/githooks/compare/v1.8.1...v1.9.0-beta.1) (2025-09-18)

### Features

* add build to pretest ([52d600a](https://github.com/volbrene/githooks/commit/52d600ab6a7ffec9328ddcbe35927efa8c1c5f7d))
* aktualisiere CI- und Release-Workflows zur Vereinfachung der Trigger-Bedingungen ([85b9715](https://github.com/volbrene/githooks/commit/85b97151a1f5dd895a62c2e45c73a6aaf0121994))
* erweitere Branch-Konfiguration in release.config.cjs ([31787f1](https://github.com/volbrene/githooks/commit/31787f1143c31c393290ce78c92c4cce0f65c06e))
* fix uninstall test ([1838177](https://github.com/volbrene/githooks/commit/1838177e95d4991c8a8cf39ca49a2f202d4c7ba4))
* init first cli tests ([1dd2632](https://github.com/volbrene/githooks/commit/1dd2632cd1f927b888f5d55b56f013248300df5a))
* init typescript ([ea6dfa4](https://github.com/volbrene/githooks/commit/ea6dfa49d41f17ed414109d516ef987958d171c6))
* refactoring src ([452a7b6](https://github.com/volbrene/githooks/commit/452a7b69d74cbfb534ebeacf03073a51b4f59385))
* remove old scripts ([a3b5ed9](https://github.com/volbrene/githooks/commit/a3b5ed97c681da89e512d91ec1641f08072cc0a7))
* simplify CLI command names in README ([f2167b4](https://github.com/volbrene/githooks/commit/f2167b450e076e307161eccd28e129724b94491d))
* update Readme ([de52308](https://github.com/volbrene/githooks/commit/de523086923eceaf0abe22dc01e4fede197930d8))
* update section header for CLI commands in README ([1915e50](https://github.com/volbrene/githooks/commit/1915e50656c91b77b89d665d29f43ccd6c94f455))

## [1.8.1](https://github.com/volbrene/githooks/compare/v1.8.0...v1.8.1) (2025-09-16)

### Bug Fixes
Expand Down
48 changes: 41 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![npm version](https://img.shields.io/npm/v/volbrene-git-hooks.svg)](https://www.npmjs.com/package/volbrene-git-hooks)
[![CI](https://github.com/volbrene/githooks/actions/workflows/ci.yml/badge.svg)](https://github.com/volbrene/githooks/actions)
[![npm downloads](https://img.shields.io/npm/dm/volbrene-git-hooks.svg)](https://www.npmjs.com/package/volbrene-git-hooks)

> **Volbrene – Git Hooks** helps you keep your commit messages consistent and enforce [Conventional Commits](https://www.conventionalcommits.org/) automatically.

Expand All @@ -18,13 +19,27 @@

## 📦 Installation

Make sure you have [Node.js](https://nodejs.org/) and `npm` installed, then run:
Make sure you have [Node.js](https://nodejs.org/) (>=16) and `npm` installed, then run:

```sh
npm install --save-dev volbrene-git-hooks
```

The preinstall script in this package will automatically place the hooks into .git/hooks/.
After that, initialize the hooks with:

```sh
npx volbrene-git-hooks init
```

This will add a `prepare` script to your `package.json`:

```jsonc
"scripts": {
"prepare": "volbrene-git-hooks"
}
```

With this in place, the hooks will be automatically reinstalled whenever you (or your team) run `npm install`.

## 🔗 Available Hooks

Expand Down Expand Up @@ -62,21 +77,40 @@ Supported branch prefixes:
| `revert/*` | `revert(...)` |
| `task/*` or unknown | `chore(...)` |

# CLI Commands
# ⚙️ CLI Commands

## `volbrene-git-hooks install`
## `install`

Installs or re-installs the Git hooks for the current repository.

- Ensures `.git/hooks` exists
- Copies the `prepare-commit-msg` hook from this package into `.git/hooks`
- Makes the hook executable on Linux/macOS
- Can be run manually or in your `package.json` (`prepare` or `postinstall` script)

## `volbrene-git-hooks reset-hooks`
## `reset-hooks`

Resets Git’s `core.hooksPath` back to the default `.git/hooks` folder.

- Unsets any custom `core.hooksPath` (e.g. from Husky or other tools)
- Sets the local repository back to `.git/hooks`
- Prints the effective hook directory for verification

## `uninstall`

Removes all installed Git hooks and unsets `core.hooksPath`.

- Deletes the `.git/hooks` folder (or the directory configured in `core.hooksPath`)
- Attempts to unset `core.hooksPath` (ignored if not set)
- Useful for clean-up or before switching to another hook manager

## `init`

Sets up automatic hook installation on `npm install`.

- Adds `"prepare": "volbrene-git-hooks"` to your `package.json` scripts
- Ensures hooks will be installed for every developer after `npm install`
- Recommended for teams to keep hooks consistent
- Copies the `prepare-commit-msg` hook from this package into `.git/hooks`

## `help`

Shows usage information and a list of available commands.
Loading