{"id":20395423,"url":"https://github.com/jpeer264/node-semantic-git-commit-cli","last_synced_at":"2025-04-07T10:23:37.256Z","repository":{"id":18667751,"uuid":"84879203","full_name":"JPeer264/node-semantic-git-commit-cli","owner":"JPeer264","description":"A CLI for semantic git commits","archived":false,"fork":false,"pushed_at":"2023-02-12T14:48:01.000Z","size":2296,"stargazers_count":148,"open_issues_count":11,"forks_count":11,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-04T20:40:54.397Z","etag":null,"topics":["cli","commit","emoji","git","nodejs","semantic"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/semantic-git-commit-cli","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/JPeer264.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":null,"patreon":"jpeer","open_collective":"sgc","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-03-13T22:07:24.000Z","updated_at":"2025-02-19T09:54:58.000Z","dependencies_parsed_at":"2024-01-03T04:14:44.006Z","dependency_job_id":"c232bf42-c59c-46d0-980d-e743c9dc8dea","html_url":"https://github.com/JPeer264/node-semantic-git-commit-cli","commit_stats":{"total_commits":222,"total_committers":10,"mean_commits":22.2,"dds":"0.30180180180180183","last_synced_commit":"9e143576c0a07944a6fe1b56e84f2ab3d898c6fd"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-semantic-git-commit-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-semantic-git-commit-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-semantic-git-commit-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JPeer264%2Fnode-semantic-git-commit-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JPeer264","download_url":"https://codeload.github.com/JPeer264/node-semantic-git-commit-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247632752,"owners_count":20970214,"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":["cli","commit","emoji","git","nodejs","semantic"],"created_at":"2024-11-15T03:57:28.535Z","updated_at":"2025-04-07T10:23:37.231Z","avatar_url":"https://github.com/JPeer264.png","language":"JavaScript","funding_links":["https://patreon.com/jpeer","https://opencollective.com/sgc"],"categories":[],"sub_categories":[],"readme":"# semantic-git-commit-cli\n\n[![Backers on Open Collective](https://opencollective.com/sgc/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/sgc/sponsors/badge.svg)](#sponsors)\n[![Build Status](https://travis-ci.com/JPeer264/node-semantic-git-commit-cli.svg?branch=master)](https://travis-ci.com/JPeer264/node-semantic-git-commit-cli)\n[![Build status](https://ci.appveyor.com/api/projects/status/t9xwo0r3n2oe5ywf/branch/master?svg=true)](https://ci.appveyor.com/project/JPeer264/node-semantic-git-commit-cli/branch/master)\n[![Coverage Status](https://coveralls.io/repos/github/JPeer264/node-semantic-git-commit-cli/badge.svg?branch=master)](https://coveralls.io/github/JPeer264/node-semantic-git-commit-cli?branch=master)\n\n\n\u003e A CLI to keep semantic git commits. With emoji support 😄 👍\n\n\u003cimg src=\"https://raw.githubusercontent.com/JPeer264/node-semantic-git-commit-cli/master/media/screenshot.gif\"\u003e\n\n## Why?\n\nMany projects got different git commit rules. It is hard to remember them all. Usually you start with `git commit -m \"`, and then? You have to think about the projects commit guidelines.\n\n`sgc` will take care of the commit guidelines, so you can focus on the more important stuff: **code**\n\n## Installation\n\n```sh\n$ npm i -g semantic-git-commit-cli\n```\nor\n```sh\n$ yarn global add semantic-git-commit-cli\n```\n\n## Usage\n\nForget the times when you used `git commit -m \"...\"`, now just type:\n```sh\n$ sgc\n```\nor if you already have an alias for sgc, use following instead:\n```sh\n$ semantic-git-commit\n```\n\n### Usage with parameters\n\n\u003e Note: if any block is added it will get skipped in the questions. If there are still some questions open they will still be asked\n\nAvailable parameters:\n\n- `m` | `message`: Add and skip the message block\n- `t` | `type`: Add and skip the type block (this has to be defined in the [types](#types) as `argKey`)\n- `s` | `scope`: Add and skip the scope block\n\nTo skip some questions you can add parameters:\n\nFollowing:\n```sh\n$ sgc -t feat -m some new features\n```\n\nWill generate: `Feat: some new features`\n\n--\n\nFollowing:\n```sh\n$ sgc -t feat -s myScope -m some new features\n```\n\nWill generate: `Feat(myScope): some new features`\n\n### Usage with [semantic-release](https://github.com/semantic-release/semantic-release)\n\n\u003e Configure sgc for the following [semantic-release options](https://github.com/semantic-release/semantic-release#plugins): `analyzeCommits` and `generateNotes`\n\nFirst step, install the following plugins with\n```sh\n$ npm install --save-dev sr-commit-analyzer sr-release-notes-generator conventional-changelog-eslint\n```\n\nor\n\n```sh\n$ yarn add -D sr-commit-analyzer sr-release-notes-generator conventional-changelog-eslint\n```\n\nThen, create  a `release.config.js` file in a `config` folder in the root folder of your project:\n```js\n/* eslint-disable no-useless-escape */\nmodule.exports = {\n  analyzeCommits: {\n    preset: 'eslint',\n    releaseRules: './config/release-rules.js', // optional, only if you want to set up new/modified release rules inside another file\n    parserOpts: { // optional, only you want to have emoji commit support\n      headerPattern: /^(?::([\\w-]*):)?\\s*(\\w*):\\s*(.*)$/,\n      headerCorrespondence: [\n        'emoji',\n        'tag',\n        'message',\n      ],\n    },\n  },\n  generateNotes: {\n    preset: 'eslint',\n    parserOpts: { // optional, only you want to have emoji commit support\n      headerPattern: /^(?::([\\w-]*):)?\\s*(\\w*):\\s*(.*)$/,\n      headerCorrespondence: [\n        'emoji',\n        'tag',\n        'message',\n      ],\n    },\n  },\n};\n```\n\nThen, update the  `semantic-release ` script to your `package.json` to this : \n```json\n\"scripts\": {\n    \"semantic-release\": \"semantic-release -e ./config/release.config.js\",\n}\n```\n\n## Commands\n\n### check\n\nThis will check all commits and will fail if your commits do not meet the defined config.\n\n**Flags**\n  - `start`: A commit SHA to start, in case you started using `sgc` later of your development\n\n```sh\n$ sgc check --start 84a1abd\n```\n\n## Config\n\n\u003e Just create a `.sgcrc` in your project root or you can add everything in your `package.json` with the value `sgc`\n\nYou can even create a global config. Just go to your users home and create a `.sgcrc`. The global config will be triggered if no project configurations are present.\n\nThe order and namings of the commit (this can vary with different settings):\n```\n\u003ctype\u003e(\u003cscope\u003e)\u003cdelimiter\u003e \u003cmessage\u003e\n\n\u003cbody\u003e\n```\n\n**Options:**\n- [body](#body)\n- [scope](#scope)\n- [emoji](#emoji)\n- [delimiter](#delimiter)\n- [lowercaseTypes](#lowercaseTypes)\n- [initialCommit](#initialCommit)\n- [types](#types)\n- [addScopeSpace](#addScopeSpace)\n- [rules](#rules)\n\n### body\n\n**Type:** `boolean`\n\n**Default**: `true`\n\nAsks if more info (body) should be added. This will open your default editor.\n\nExample:\n```json\n{\n  \"body\": false\n}\n```\n\n### scope\n\n**Type:** `boolean`\n\n**Default:** `false`\n\nAsks for the scope in parentheses of the commit.\n\nExample:\n```json\n{\n  \"scope\": true\n}\n```\n\n### emoji\n\n**Type:** `boolean`\n\n**Default:** `false`\n\nA boolean to enable emoji at the beginning of a commit message\n\nExample:\n```json\n{\n  \"emoji\": true\n}\n```\n\n### delimiter\n\n**Type:** `string`\n\n**Default:** `:`\n\nA string which is the delimiter between the type and the message.\n\nExample:\n```json\n{\n  \"delimiter\": \":\"\n}\n```\nor type specific delimiters, which will overwrite the global one:\n```json5\n{\n  \"delimiter\": \":\",\n  \"types\": [\n    {\n      \"type\": \"Feat\",\n      \"delimiter\": \" -\"\n    }, // will generate \"Feat - message\"\n    {\n      \"type\": \"Fix\",\n    } // will generate \"Fix: message\"\n  ]\n}\n```\n\n### lowercaseTypes\n\n**Type:** `boolean`\n\n**Default:** `false`\n\nA boolean to lowercase types.\n\nExample:\n```json\n{\n  \"lowercaseTypes\": true\n}\n```\n\n### initialCommit\n\n**Type:** `object`\n\n**Default:**\n\n```json\n{\n  \"initialCommit\": {\n    \"isEnabled\": true,\n    \"emoji\": \":tada:\",\n    \"message\": \"Initial commit\"\n  }\n}\n```\n\n**Keys:**\n\n- `isEnabled` - Whether an explicit initial commit should be used for the very first commit\n- `emoji` - An emoji which will be appended at the beginning of the commit ([Emoji Cheat Sheet](https://www.webpagefx.com/tools/emoji-cheat-sheet/))\n- `message` - The commit message for the very first commit\n\n### types\n\n\u003e Types will define your git commits. If `types` is not set in your own `.sgcrc`, the `types` of the global [.sgcrc](.sgcrc)\n\n\u003e Notice: If the `type` is `false` it will let you to manually add the type. This is usefull especially if you have a `prefix` named `SGC-` to reference these as a ticket number for your ticket tool\n\n**Keys**\n\n- `type` (`string` or `false`) - This will be your commit convention and will be your start of your commit - e.g.: `Feat:`\n- `prefix` (optional) - This option is just valid, if `type` is `false`\n- `description` (optional) - The description to explain what your type is about\n- `emoji` (optional) - An emoji which will be appended at the beginning of the commit ([Emoji Cheat Sheet](https://www.webpagefx.com/tools/emoji-cheat-sheet/))\n- `argKeys` | Array (optional) - Keys which will be accessed through the `-t` [parameter](#usage-with-parameters)\n\nThe `.sgcrc`:\n\n```json\n{\n    \"types\": [\n      {\n        \"emoji\": \":sparkles:\",\n        \"type\": \"Feat:\",\n        \"description\": \"Any description to describe the type\",\n        \"argKeys\": [\"f\", \"feat\", \"feature\"]\n      }\n    ]\n}\n```\n\nor the `package.json`:\n\n```json\n{\n    \"name\": \"Your application name\",\n    \"version\": \"1.0.0\",\n    \"sgc\": {\n        \"types\": [\n            {\n              \"emoji\": \":sparkles:\",\n              \"type\": \"Feat:\",\n              \"description\": \"Any description to describe the type\",\n              \"argKeys\": [\"f\", \"feat\", \"feature\"]\n            }\n        ]\n    }\n}\n```\n\n### addScopeSpace\n\n**Type:** `boolean`\n\n**Default:** `true`\n\n\u003e This rule just affects the commit message if `scope` is set to true\n\nIf set to `false` there will be no space between `\u003ctype\u003e` and `(\u003cscope\u003e)`\n\nExample:\n```json\n{\n  \"addScopeSpace\": false\n}\n```\n\n\n### rules\n\nAvailable rules:\n\n- [maxChar](#maxChar)\n- [minChar](#minChar)\n- [endWithDot](#endWithDot)\n\n#### maxChar\n\n**Type:** `number`\n\n**Default:** `72`\n\nIf a number is set, it will not allow to commit messages **more than** the given number. If it is set to `-1` the rule is deactivated\n\nExample:\n```json\n{\n  \"rules\": {\n    \"maxChar\": -1\n  }\n}\n```\n\n#### minChar\n\n**Type:** `number`\n\n**Default:** `10`\n\nIf a number is set, it will not allow to commit messages **less than** the given number. If it is set to `-1` the rule is deactivated\n\nExample:\n```json\n{\n  \"rules\": {\n    \"minChar\": -1\n  }\n}\n```\n\n#### endWithDot\n\n**Type:** `boolean`\n\n**Default:** `true`\n\nIf it is set to false, it will not allow to commit messages with a dot at the\n\nExample:\n```json\n{\n  \"rules\": {\n    \"endWithDot\": false\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpeer264%2Fnode-semantic-git-commit-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpeer264%2Fnode-semantic-git-commit-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpeer264%2Fnode-semantic-git-commit-cli/lists"}