{"id":16055511,"url":"https://github.com/uglow/cz-customizable-ghooks","last_synced_at":"2025-07-27T15:34:06.574Z","repository":{"id":8494857,"uuid":"58611357","full_name":"uglow/cz-customizable-ghooks","owner":"uglow","description":"Integrate cz-customizable config with ghooks or husky","archived":false,"fork":false,"pushed_at":"2023-01-06T14:00:00.000Z","size":877,"stargazers_count":20,"open_issues_count":20,"forks_count":13,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-18T18:26:34.173Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uglow.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-12T05:43:52.000Z","updated_at":"2024-10-30T16:35:59.000Z","dependencies_parsed_at":"2023-01-11T17:24:19.316Z","dependency_job_id":null,"html_url":"https://github.com/uglow/cz-customizable-ghooks","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/uglow/cz-customizable-ghooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uglow%2Fcz-customizable-ghooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uglow%2Fcz-customizable-ghooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uglow%2Fcz-customizable-ghooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uglow%2Fcz-customizable-ghooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uglow","download_url":"https://codeload.github.com/uglow/cz-customizable-ghooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uglow%2Fcz-customizable-ghooks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267378143,"owners_count":24077689,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T02:09:14.373Z","updated_at":"2025-07-27T15:34:06.551Z","avatar_url":"https://github.com/uglow.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cz-customizable-ghooks\n\nIntegrate [cz-customizable](https://github.com/leonardoanalista/cz-customizable) config with [ghooks](https://github.com/gtramontina/ghooks) or [husky](https://github.com/typicode/husky) to use a single configuration for commit message generation AND commit message validation.\n\n[![Build Status](https://travis-ci.org/uglow/cz-customizable-ghooks.svg?branch=master)](https://travis-ci.org/uglow/cz-customizable-ghooks)\n\u003c!--[RM_BADGES]--\u003e\n[![NPM Version](https://img.shields.io/npm/v/cz-customizable-ghooks.svg?style=flat-square)](http://npm.im/cz-customizable-ghooks)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Coverage Status](https://coveralls.io/repos/github/uglow/cz-customizable-ghooks/badge.svg?branch=master)](https://coveralls.io/github/uglow/cz-customizable-ghooks?branch=master)\n[![Dependencies status](https://david-dm.org/uglow/cz-customizable-ghooks/status.svg?theme=shields.io)](https://david-dm.org/uglow/cz-customizable-ghooks#info=dependencies)\n[![Dev-dependencies status](https://david-dm.org/uglow/cz-customizable-ghooks/dev-status.svg?theme=shields.io)](https://david-dm.org/uglow/cz-customizable-ghooks#info=devDependencies)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\n\n\u003c!--[]--\u003e\n## Purpose\n\nThis package validates that a git commit message matches the rules defined in your `cz-customizable` config file (see [cz-customizable](https://github.com/leonardoanalista/cz-customizable)).\n[Example commit message rules](fixtures/fullCommitMessageConfig.js).\n\n## Prerequisites\n\n- git\n- Node \u003e= 4.x\n- [commitizen](https://github.com/commitizen/cz-cli)\n- [cz-customizable](https://github.com/leonardoanalista/cz-customizable)\n- [ghooks](https://github.com/gtramontina/ghooks) or [husky](https://github.com/typicode/husky)\n\nMake sure you have a git repository (`git init`) BEFORE installing ghooks, otherwise you have to take extra steps if you install ghooks before running `git init`.\n\n## Installation\n\nThis package is designed to be used in conjunction with `commitizen`, `cz-customizable` and either `ghooks` or `husky`.\n\n\n1. Install pre-requisites (if not already installed):\n  ```\n  npm i commitizen -g\n  npm i cz-customizable cz-customizable-ghooks\n  ```\n  \n2. Configure cz-customizable in `package.json`:\n  ```\n  \"config\": {\n    \"cz-customizable\": {\n      \"config\": \"path/to/your/cz-customizable-rules.js\"\n    }\n  }\n  ```\n\n\n3. Install ONE of these git hook packages:\n\n\u003cdetails\u003e\n\u003csummary\u003eghooks\u003c/summary\u003e\n\n1. Install ghooks:\n  ```\n  npm i ghooks\n  ```\n  \n2. Configure `package.json`:\n  ```\n  \"config\": {\n    \"ghooks\": {\n      \"commit-msg\": \"cz-customizable-ghooks $2\"\n    }\n  }\n  ```\n  \n_An example of this setup is in `examples/ghooks`._\n\u003c/details\u003e\n  \n\n\u003cdetails\u003e\n\u003csummary\u003ehusky\u003c/summary\u003e\n\nInstall husky:\n```\nnpm i husky\n```\n\n**If you use husky v4 or under:**\n\nConfigure the hooks in the `package.json`:  \n```\n\"husky\": {\n  \"hooks\": {\n    \"commit-msg\": \"cz-customizable-ghooks\"\n  }\n}\n```\n\n**If you use husky v5 or higher:**\n\nInside the *.husky* folder, create a new script:  \n`husky add .husky/commit-msg \"npm run commit-msg -- \\\"$1\\\"\"`.\n\nThen create create the `commit-msg` script in the `package.json`:  \n```\n\"scripts\": {\n  \"commit-msg\": \"cz-customizable-ghooks\"\n}\n```\n\nIf you wish to specify the `LOGGING_LEVEL` flag, you can use [cross-env](https://www.npmjs.com/package/cross-env):  \n```\n\"scripts\": {\n  \"commit-msg\": \"cross-env LOGGING_LEVEL=debug cz-customizable-ghooks\"\n}\n```\n\n_An example of this setup is in `examples/husky`._\n\u003c/details\u003e\n\n\n## Usage\n\nCommit your changes to git as normal. If the commit message entered is invalid, the commit will be rejected with an error message (according to the rules specified in your cz-customizable config).\nWorks with git command-line and visual Git tools (such as SourceTree).\n\n## Additional config\n\n### `appendIssueFromBranchName`\n\nIf this config value is set to true, the git branch name is queried, and an attempt is made to\nparse the branch name, looking for the `ticketNumberPrefix` and `ticketNumberRegExp` values. If found,\nthey are appended to the commit message. If the branch name does not match the `ticketNumberPrefix`\nand `ticketNumberRegExp` expression, or if `ticketNumberPrefix` and `ticketNumberRegExp` are not provided,\nthe full branch name is appended to the commit message. \n\nThis property was previously called `appendBranchNameToCommitMessage`.\n\n## Debugging\n\nYou can turn on debug logging by specifying `LOGGING_LEVEL=debug` before the `cz-customizable-ghooks` command.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuglow%2Fcz-customizable-ghooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuglow%2Fcz-customizable-ghooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuglow%2Fcz-customizable-ghooks/lists"}