{"id":28484550,"url":"https://github.com/dschnare/gommitjs","last_synced_at":"2026-05-09T14:14:32.311Z","repository":{"id":57251932,"uuid":"81599603","full_name":"dschnare/gommitjs","owner":"dschnare","description":"A Nodejs wrapper for the gommit command line tool.","archived":false,"fork":false,"pushed_at":"2017-02-12T03:44:06.000Z","size":3992,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-17T00:57:12.468Z","etag":null,"topics":["commit-message","commits","consistency","git","nodejs"],"latest_commit_sha":null,"homepage":null,"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/dschnare.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-10T19:31:50.000Z","updated_at":"2019-12-23T07:49:26.000Z","dependencies_parsed_at":"2022-09-05T21:11:49.168Z","dependency_job_id":null,"html_url":"https://github.com/dschnare/gommitjs","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschnare%2Fgommitjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschnare%2Fgommitjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschnare%2Fgommitjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschnare%2Fgommitjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dschnare","download_url":"https://codeload.github.com/dschnare/gommitjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dschnare%2Fgommitjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258635379,"owners_count":22733584,"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","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":["commit-message","commits","consistency","git","nodejs"],"created_at":"2025-06-07T22:34:53.290Z","updated_at":"2026-05-09T14:14:27.285Z","avatar_url":"https://github.com/dschnare.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gommitjs\n\n`gommitjs` is a lightweight Git commit message enforcer that wraps [gommit](https://github.com/antham/gommit).\n\n## Setup\n\nFirst create your project\n\n    mkdir my-project\n    cd my-project\n    git init\n    npm init --yes\n\nThen setup `gommitjs`\n\n    npm install gommitjs --save-dev\n    ./node_modules/.bin/gommitjs init\n\nThe above commands will install the `gommitjs` NPM module and download the\n`gommit` binary for your OS and save it under the\n`./node_modules/gommitjs/tools` folder. Then we initialize our project by\ncreating a `.gommit.toml` config file if one doesn't exist and create a\n`.git/hooks/commit-msg` commit hook if one doesn't exist.\n\n*NOTE:* If you already have a `commit-msg` hook then you'll have to maintain this\nhook yourself, using the `gommit` binary to check messages:\n\n    %gommit_path% check message \"$(cat \"$1\")\";\n\nThe `gommit` binary path can be obtained by calling:\n\n    ./node_modules/.bin/gommitjs gommit-path\n\n*NOTE:* If you prefer to install the `gommit` binary somewhere else then you can\nrun the following.\n\n    ./node_modules/.bin/gommitjs update --prefix tools\n\nThis will install the binary in the `./tools` folder.\n\n## Usage\n\n    Ensure your commit messages are consistent\n\n    Usage:\n      gommitjs [command]\n\n    Available Commands:\n      init        Create the gommit config and commit-msg hook files\n      update      Update the gommit binary\n      gommit-path Get the path to the gommit binary\n      check       Check ensure a message follows defined patterns\n      version     App version\n\n    Flags:\n          --config string    (default \".gommit.toml\")\n      -h, --help            help for gommit\n\n    Use \"gommitjs [command] --help\" for more information about a command.\n\n## Practical Usage\n\nFor details on how to use `gommit` with continuous integration servers see\nthe [gommit docs](https://github.com/antham/gommit#practical-usage).\n\n## Versioning\n\nThis project will not have the same version as the `gommit` binary since any\nversion of `gommit` should work with this wrapper.\n\n## OS Support\n\nThe following OSs are supported on 32 and 64-bit architecture:\n\n- OSX\n- Windows\n- Linux\n- FreeBSD\n- OpenBSD\n\nThe following OSs are supported on an ARM architecture:\n\n- Linux\n- FreeBSD\n- OpenBSD\n\nFor NetBSD support please use [gommit](https://github.com/antham/gommit)\ndirectly.\n\n*NOTE:* The `os` module provided by Nodejs is used to determine the platform and\nthe system architecture.\n\nSee: https://nodejs.org/dist/latest-v6.x/docs/api/os.html#os_os_platform\n\nSee: https://nodejs.org/dist/latest-v6.x/docs/api/os.html#os_os_arch\n\n## API\n\n**installGommit(tag = 'latest', { prefix } = {}): Promise**\n\nInstall the gommit binary for the current OS.\n\nExample:\n\n    const gommitjs = require('gommitjs')\n    gommitjs.installGommit('v2.0.0').then(result =\u003e {\n      console.log(`gommit ${result.tag} saved at ${result.path}`)\n    }).catch(error =\u003e {\n      console.error(error)\n    })\n\n    // Or to install the gommit binary to a different location.\n    gommitjs.installGommit('v2.0.0', { prefix: 'tools' }).then(result =\u003e {\n      console.log(`gommit ${result.tag} saved at ${result.path}`)\n    }).catch(error =\u003e {\n      console.error(error)\n    })\n\n**getGommitUrl(tag = 'latest'): Promise**\n\nRetrieves the download URL for the gommit binary for the specified tag.\n\nExample:\n\n    const gommitjs = require('gommitjs')\n    gommitjs.getGommitUrl().then(url =\u003e {\n      console.log(`gommit download url is ${url}`)\n    }).catch(error =\u003e {\n      // Error will be thrown if OS or architecture is unsupported.\n      console.error(error)\n    })\n\n**getGommitBinaryPath({ url, prefix } = {}): Promise**\n\nRetrieves the path to the installed gommit binary.\n\nExample:\n\n    const gommitjs = require('gommitjs')\n    gommitjs.getGommitBinaryPath().then(gommitPath =\u003e {\n      console.log(`gommit installed at ${gommitPath}`)\n    })\n\n    // A path to the binary can be constructed if given the download URL and the\n    // prefix to where the binary is to be saved.\n    // NOTE: This interface is typically only used internally.\n    gommitjs.getGommitUrl('v2.0.0').then(url =\u003e {\n      return gommitjs.getGommitBinaryPath({ url, prefix: 'tools' })\n    }).catch(error =\u003e {\n      // Error will be thrown if OS or architecture is unsupported.\n      console.error(error)\n    }).then(gommitPath =\u003e {\n      console.log(`gommit installed at ${gommitPath}`)\n    })\n\n**gommit(args: []sring, { cwd }): Promise**\n\nCall gommit with the specified arguments just like you would at the command\nline.\n\nExample:\n\n    const { gommit } = require('gommitjs')\n    gommit([ 'version' ])\n      .then(version =\u003e console.log(version))\n      .catch(error =\u003e console.error(error.toString()))\n\n    // Or to check a commit message and load a custom config file.\n    const message = 'Hello'\n    gommit([ 'check', 'message', message, '--config', 'my-config.toml' ])\n      .then(() =\u003e console.log())\n      .catch(error =\u003e console.error(error.toString()))\n\n**gommit.version(): Promise**\n\nRetrieves the gommit version tag.\n\nExample:\n\n    const { gommit } = require('gommitjs')\n    gommit.version()\n      .then(version =\u003e console.log(version))\n      .catch(error =\u003e console.error(error.toString()))\n\n**gommit.checkCommit(commitHash, { config } = {}): Promise**\n\nCheck one commit from its commit ID (must be full commit ID). Optionally the\npath to the TOML, YAML or JSON config file to load can be specified. If no path\nis specified then by default `gommit` will load `./.gommit.toml`.\n\nExample:\n\n    const { gommit } = require('gommitjs')\n    gommit.checkCommit('aeb603ba83614fae682337bdce9ee1bad1da6d6e')\n      .then(() =\u003e console.log('commit is properly formatted!')\n      .catch(error =\u003e console.error(error.toString()))\n\n**gommit.checkMessage(message, { config } = {}): Promise**\n\nCheck a commit message. Optionally the path to the TOML, YAML or JSON config\nfile to load can be specified. If no path is specified then by default `gommit`\nwill load `./.gommit.toml`.\n\nExample:\n\n    const { gommit } = require('gommitjs')\n    gommit.checkMessage('Hello')\n      .then(() =\u003e console.log('message is properly formatted!')\n      .catch(error =\u003e console.error(error.toString()))\n\n**gommit.checkRange(refStart, refEnd, { config } = {}): Promise**\n\nCheck a commit range. Ranges can be any of the following values:\n\n- with relative references : `master~2^`, `master`\n- with asbolute references : `dev`, `test`\n- with commit ids : `7bbb37ade3ff36e362d7e20bf34a1325a15b`, `09f25db7971c100a8c0cfc2b22ab7f872ff0c18d`\n\nOptionally the path to the TOML, YAML or JSON config file to load can be\nspecified. If no path is specified then by default `gommit` will load\n`./.gommit.toml`.\n\nExample:\n\n    const { gommit } = require('gommitjs')\n    gommit.checkRange('master~2^', 'master')\n      .then(() =\u003e console.log('all commits are properly formatted!')\n      .catch(error =\u003e console.error(error.toString()))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdschnare%2Fgommitjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdschnare%2Fgommitjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdschnare%2Fgommitjs/lists"}