{"id":45805665,"url":"https://github.com/eL1fe/smart-commit","last_synced_at":"2026-03-11T22:01:09.341Z","repository":{"id":278184085,"uuid":"934789336","full_name":"eL1fe/smart-commit","owner":"eL1fe","description":"Smart Commit is a customizable CLI tool for creating consistent Git commits using interactive prompts. It offers automatic commit type suggestions, CI integration, GPG signing, push support, and local configuration for a streamlined commit workflow.","archived":false,"fork":false,"pushed_at":"2025-12-15T11:56:32.000Z","size":180,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-24T18:19:38.049Z","etag":null,"topics":["cli","cli-tool","developer-tools","git","git-commit"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/eL1fe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-18T12:07:32.000Z","updated_at":"2025-02-27T21:57:28.000Z","dependencies_parsed_at":"2025-02-18T13:24:22.405Z","dependency_job_id":"b0e8a173-beb7-4e07-b421-afd388468132","html_url":"https://github.com/eL1fe/smart-commit","commit_stats":null,"previous_names":["el1fe/smart-commit"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/eL1fe/smart-commit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eL1fe%2Fsmart-commit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eL1fe%2Fsmart-commit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eL1fe%2Fsmart-commit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eL1fe%2Fsmart-commit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eL1fe","download_url":"https://codeload.github.com/eL1fe/smart-commit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eL1fe%2Fsmart-commit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30404068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T21:51:19.558Z","status":"ssl_error","status_checked_at":"2026-03-11T21:50:57.892Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","cli-tool","developer-tools","git","git-commit"],"created_at":"2026-02-26T14:00:19.342Z","updated_at":"2026-03-11T22:01:09.310Z","avatar_url":"https://github.com/eL1fe.png","language":"TypeScript","funding_links":[],"categories":["\u003ca name=\"git\"\u003e\u003c/a\u003eGit and accessories","Git \u0026 Version Control"],"sub_categories":[],"readme":"# Smart Commit\n\n![npm version](https://img.shields.io/npm/v/%40el1fe/smart-commit)\n![npm downloads](https://img.shields.io/npm/dm/%40el1fe/smart-commit)\n![license](https://img.shields.io/npm/l/%40el1fe/smart-commit)\n![build](https://github.com/el1fe/smart-commit/actions/workflows/nodejs.yml/badge.svg)\n\nSmart Commit is a highly customizable CLI utility for creating Git commits interactively. It helps you produce consistent, well-formatted commit messages and branch names that integrate seamlessly with your development workflow.\n\n## Features\n\n- **Interactive Prompts**\n  - Customize which prompts appear during commit creation (commit type, scope, summary, body, footer, ticket, and CI tests).\n  - Automatically suggest commit types based on staged changes.\n\n- **Template-Based Commit Messages**\n  - Define your commit message format using placeholders:\n    - {type}: The commit type (e.g., feat, fix, docs, etc.)\n    - {ticketSeparator}: A separator inserted if a ticket ID is provided.\n    - {ticket}: The ticket ID (entered by the user or auto-extracted).\n    - {summary}: A short summary of the commit.\n    - {body}: A detailed description of the commit.\n    - {footer}: Additional footer text.\n    \n- **CI Integration**\n  - Optionally run a specified CI command (e.g., tests) before creating the commit.\n\n- **Auto Ticket Extraction**\n  - Automatically extract a ticket ID from the current branch name using a custom regular expression.\n\n- **Push and Signed Commits**\n  - Automatically push commits after creation using the --push flag.\n  - Create GPG-signed commits with the --sign flag.\n\n- **Commit Statistics and History Search**\n  - View commit statistics as ASCII graphs (shortlog by author, activity graphs) with the `sc stats` command.\n  - Search commit history by keyword, author, or date range using the `sc history` command.\n\n- **Additional Commands**\n  - **Amend:** Interactively edit the last commit message (with optional linting).\n  - **Rollback:** Rollback the last commit, with options for soft (keeping changes staged) or hard (discarding changes) resets.\n  - **Rebase Helper:** Launch an interactive rebase session with guidance on modifying recent commits.\n\n- **Advanced Branch Creation**\n  - **sc branch** creates a new branch from a base branch (or current HEAD) using a naming template and autocomplete.\n  - **Universal Placeholders:** Use placeholders (e.g., {type}, {ticketId}, {shortDesc}, or any custom placeholder) in your branch template.\n  - **Branch Type Selection:** Define a list of branch types in your configuration; if defined, you can select one or provide a custom input.\n  - **Custom Sanitization Options:** For each placeholder, you can set custom sanitization rules:\n    - **lowercase:** (default true) Converts the value to lowercase unless set to false.\n    - **separator:** (default \"-\") Character to replace spaces.\n    - **collapseSeparator:** (default true) Collapses multiple consecutive separators into one.\n    - **maxLength:** Limits the maximum length of the sanitized value.\n  - The branch name is built from the template by replacing placeholders with sanitized inputs. Extraneous separators are removed, and if the final branch name is empty, a random fallback name is generated.\n  - After branch creation, you are prompted whether to remain on the new branch or switch back to the base branch.\n\n## Commands\n\n- **sc commit (or sc c)**\n  - Initiates the interactive commit process.\n  - Prompts for commit type, scope, summary, body, footer, ticket, and CI test execution.\n  - Supports manual file staging or auto-add, GPG signing (--sign), and pushing (--push).\n  - Applies commit message linting if enabled.\n  - **Linting Behavior and Overrides:**\n\n    By default, commit message linting is disabled (i.e. `enableLint` is set to `false` in your configuration). This means that if you don’t specify any command‑line flag, your commit will be created without linting the message.\n\n    If you want to enable linting for a specific commit—even if your configuration has it disabled—you can pass the `--lint` flag. Conversely, if linting is enabled in your configuration but you want to skip it for one commit, you can pass the standard Commander flag `--no-lint` (which sets the option to false).\n\n    For example:\n\n    ```bash\n    sc commit --lint\n    sc commit --no-lint\n    ```\n\n    The command‑line flags override the configuration settings, giving you flexibility on a per‑commit basis.\n\n- **sc amend**\n  - Opens the last commit message in your default editor for amendment.\n  - Validates the amended message using linting rules (if enabled) before updating the commit.\n\n- **sc rollback**\n  - Rolls back the last commit.\n  - Offers a choice between a soft reset (keep changes staged) or a hard reset (discard changes).\n\n- **sc rebase-helper (or sc rebase)**\n  - Launches an interactive rebase session.\n  - Guides you through modifying recent commits with options like pick, reword, edit, squash, fixup, exec, and drop.\n\n- **sc stats**\n  - Displays commit statistics as ASCII graphs.\n  - Choose between a shortlog by author or an activity graph over a specified period (Day, Week, Month).\n\n- **sc history**\n  - Searches commit history.\n  - Offers search options by keyword, author, or date range.\n  - Provides different view modes via interactive prompt:\n    - **All commits:** Shows complete commit history\n    - **Current branch only:** Shows commits unique to the current branch\n\n- **sc config (or sc cfg)**\n  - View and update Smart Commit settings.\n  - Reset Configuration\n  - Configure options such as:\n    - Auto-add (automatically stage changes)\n    - Emoji usage in commit type prompts\n    - CI command\n    - Commit message template\n    - Prompt toggles for scope, body, footer, ticket, and CI\n    - Ticket extraction regex\n    - Commit linting rules\n    - Branch configuration (template, types, and custom sanitization options)\n  - **Examples:**\n    - Enable auto-add: `sc config --auto-add true`\n    - Set CI command: `sc config --ci-command \"npm test\"`\n    - View current configuration: `sc config`\n    - Reset configuration to default: `sc config --reset`\n\n- **sc setup**\n  - Launches an interactive setup wizard to configure your Smart Commit preferences step by step.\n  - Walks you through each configuration option.\n\n- **sc branch (or sc b)**\n  - Creates a new branch from a base branch (or current HEAD) using a naming template and autocomplete.\n  - **Key Features:**\n    - **Universal Placeholders:** Customize branch names with placeholders such as {type}, {ticketId}, {shortDesc}, or any custom placeholder.\n    - **Branch Type Selection:** If branch types are defined in the configuration, you can select from a list or enter a custom type.\n    - **Custom Sanitization Options:** For each placeholder, set options to control:\n      - Conversion to lowercase (default true)\n      - Replacement of spaces with a specific separator (default \"-\")\n      - Collapsing of consecutive separators (default true)\n      - Maximum length of the sanitized value\n    - **Final Name Assembly:** Constructs the branch name from the template by replacing placeholders with sanitized values and cleaning extraneous separators.\n    - **Fallback Mechanism:** Generates a random branch name if the final name is empty.\n    - **Stay on Branch Prompt:** After creation, decide whether to remain on the new branch or switch back to the base branch.\n\n## Configuration File\n\nGlobal configuration is stored in your home directory as `~/.smart-commit-config.json`. To override these settings for a specific project, create a `.smartcommitrc.json` file in the project root. Use the `sc setup` or `sc config` commands to modify your settings.\n\n### Detailed Configuration Options\n\n| Option                         | Type    | Default                                                                                                   | Description                                                                                                                                                             | Example                          |\n|--------------------------------|---------|-----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------|\n| **commitTypes**                | Array   | List of commit types (feat, fix, docs, style, refactor, perf, test, chore)                                 | Each type includes an emoji, a value, and a description used in commit prompts.                                                                                         | [{\"emoji\": \"✨\", \"value\": \"feat\", \"description\": \"A new feature\"}, ...] |\n| **autoAdd**                    | Boolean | false                                                                                                     | If true, automatically stage all changed files before committing.                                                                                                     | true                             |\n| **useEmoji**                   | Boolean | true                                                                                                      | If true, display emojis in commit type prompts.                                                                                                                       | false                            |\n| **ciCommand**                  | String  | \"\"                                                                                                        | Command to run CI tests before committing.                                                                                                                             | \"npm test\"                       |\n| **templates.defaultTemplate**  | String  | \"[{type}]{ticketSeparator}{ticket}: {summary}\\n\\nBody:\\n{body}\\n\\nFooter:\\n{footer}\"                      | Template for commit messages; placeholders are replaced with user input or auto-generated content.                                                                     | \"[{type}]: {summary}\"             |\n| **steps.scope**                | Boolean | false                                                                                                     | Whether to prompt for a commit scope.                                                                                                                                   | true                             |\n| **steps.body**                 | Boolean | false                                                                                                     | Whether to prompt for a detailed commit body.                                                                                                                           | true                             |\n| **steps.footer**               | Boolean | false                                                                                                     | Whether to prompt for additional footer information.                                                                                                                  | true                             |\n| **steps.ticket**               | Boolean | false                                                                                                     | Whether to prompt for a ticket ID. If enabled and left empty, the ticket may be auto-extracted using the regex.                                                         | true                             |\n| **steps.runCI**                | Boolean | false                                                                                                     | Whether to prompt for running CI tests before committing.                                                                                                             | true                             |\n| **ticketRegex**                | String  | \"\"                                                                                                        | Regular expression for extracting a ticket ID from the branch name.                                                                                                    | \"^(DEV-\\\\d+)\"                   |\n| **enableLint**                 | Boolean | false                                                                                                     | If true, enable commit message linting.                                                                                                                               | true                             |\n| **lintRules.summaryMaxLength** | Number  | 72                                                                                                        | Maximum allowed length for the commit summary.                                                                                                                        | 72                               |\n| **lintRules.typeCase**         | String  | \"lowercase\"                                                                                               | Required case for the first character of the commit summary.                                                                                                          | \"lowercase\"                      |\n| **lintRules.requiredTicket**   | Boolean | false                                                                                                     | If true, a ticket ID is required in the commit message.                                                                                                               | true                             |\n| **branch.template**            | String  | \"{type}/{ticketId}-{shortDesc}\"                                                                           | Template for branch names; supports placeholders replaced by user input.                                                                                                | \"{type}/{ticketId}-{shortDesc}\"  |\n| **branch.types**               | Array   | List of branch types (feature, fix, chore, hotfix, release, dev)                                            | Provides options for branch types during branch creation.                                                                                                             | [{\"value\": \"feature\", \"description\": \"New feature\"}, ...]  |\n| **branch.placeholders**        | Object  | { ticketId: { lowercase: false } }                                                                        | Custom sanitization options for branch placeholders. Options include: lowercase (default true), separator (default \"-\"), collapseSeparator (default true), maxLength. | {\"ticketId\": {\"lowercase\": false}} |\n\n### Example Local Configuration File (.smartcommitrc.json)\n\n```json\n{\n  \"autoAdd\": true,\n  \"useEmoji\": true,\n  \"ciCommand\": \"npm test\",\n  \"templates\": {\n    \"defaultTemplate\": \"[{type}]: {summary}\"\n  },\n  \"steps\": {\n    \"scope\": true,\n    \"body\": true,\n    \"footer\": true,\n    \"ticket\": true,\n    \"runCI\": true\n  },\n  \"ticketRegex\": \"^(DEV-\\\\d+)\",\n  \"enableLint\": true,\n  \"lintRules\": {\n    \"summaryMaxLength\": 72,\n    \"typeCase\": \"lowercase\",\n    \"requiredTicket\": true\n  },\n  \"branch\": {\n    \"template\": \"{type}/{ticketId}-{shortDesc}\",\n    \"types\": [\n      { \"value\": \"feature\", \"description\": \"New feature\" },\n      { \"value\": \"fix\", \"description\": \"Bug fix\" },\n      { \"value\": \"chore\", \"description\": \"Chore branch\" },\n      { \"value\": \"hotfix\", \"description\": \"Hotfix branch\" },\n      { \"value\": \"release\", \"description\": \"Release branch\" },\n      { \"value\": \"dev\", \"description\": \"Development branch\" }\n    ],\n    \"placeholders\": {\n      \"ticketId\": {\n        \"lowercase\": false,\n        \"separator\": \"-\",\n        \"collapseSeparator\": true,\n        \"maxLength\": 10\n      }\n    }\n  }\n}\n```\n\n## Custom Sanitization Options\n\nWhen creating branch names, each placeholder can be sanitized using custom options defined in the configuration. The available options are:\n- **lowercase:** Converts input to lowercase (default true; set to false to preserve original case).\n- **separator:** Character to replace spaces (default is \"-\").\n- **collapseSeparator:** If true, collapses multiple consecutive separator characters into one (default true).\n- **maxLength:** Limits the maximum length of the sanitized string. Note that the fallback branch name (generated randomly) is appended and should be considered when setting this value.\n\n## Installation\n\nInstall Smart Commit globally using npm:\n\n```bash\nnpm install -g @el1fe/smart-commit\n```\n\nAfter installation, the commands `smart-commit` and `sc` will be available in your terminal.\n\n## Installation via Homebrew\n\nFor macOS (and Linux with Homebrew), you can install Smart Commit using the Homebrew tap:\n\n```bash\nbrew tap el1fe/homebrew-smart-commit\nbrew install smart-commit\n```\n\nThis will download the pre-built binary from the GitHub Releases and install it as sc.\n\n## Usage Examples\n\n- **Creating a Commit:**\n\n```bash\n  sc commit [--push] [--sign]\n```\n\n- **Amending the Last Commit:**\n\n```bash\n  sc amend\n```\n\n- **Rolling Back the Last Commit:**\n\n```bash\n  sc rollback\n```\n\n- **Launching the Interactive Rebase Helper:**\n\n```bash\n  sc rebase-helper\n```\n\n- **Viewing Commit Statistics:**\n\n```bash\n  sc stats\n```\n\n- **Searching Commit History:**\n\n```bash\n  sc history\n```\n\n- **Configuring Settings:**\n    \n```bash\n  sc config  \n  sc setup\n```\n\n- **Creating a Branch:**\n\n```bash\n  sc branch  \n```\n  - Select the base branch via autocomplete or enter manually.\n  - When prompted, choose a branch type from the list (if defined) or provide a custom value.\n  - Enter values for placeholders (e.g., ticket ID, short description, or any custom placeholder).\n  - The branch name is constructed from your branch template with custom sanitization applied.\n  - After branch creation, choose whether to remain on the new branch or switch back to the base branch.\n\n## Configuration File\n\nGlobal configuration is stored in `~/.smart-commit-config.json`. To override global settings for a project, create a `.smartcommitrc.json` file in the project directory. Use the `sc setup` or `sc config` commands to update your settings.\n\n### Detailed Configuration Options\n\n- **commitTypes:** Array of commit types (each with emoji, value, and description).\n- **autoAdd:** Boolean indicating whether changes are staged automatically.\n- **useEmoji:** Boolean to enable emoji display in commit type prompts.\n- **ciCommand:** Command to run CI tests before committing.\n- **templates.defaultTemplate:** Template for commit messages.\n- **steps:** Object with booleans for each prompt: scope, body, footer, ticket, and runCI.\n- **ticketRegex:** Regular expression to extract a ticket ID from the branch name.\n- **enableLint:** Boolean to enable commit message linting.\n- **lintRules:** Object defining linting rules (summaryMaxLength, typeCase, requiredTicket).\n- **branch:** Branch configuration including:\n  - **template:** Template for branch names (e.g., \"{type}/{ticketId}-{shortDesc}\").\n  - **types:** Array of branch types (each with value and description).\n  - **placeholders:** Custom sanitization options for branch placeholders. For each placeholder, you can set:\n    - **lowercase:** Whether to convert the value to lowercase (default true).\n    - **separator:** Character to replace spaces (default \"-\").\n    - **collapseSeparator:** Whether to collapse multiple separators (default true).\n    - **maxLength:** Maximum length for the sanitized value.\n\n## License\n\nMIT\n\nFor more information and to contribute, please visit the GitHub repository.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FeL1fe%2Fsmart-commit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FeL1fe%2Fsmart-commit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FeL1fe%2Fsmart-commit/lists"}