{"id":17435638,"url":"https://github.com/tab/cmt","last_synced_at":"2026-01-23T18:18:45.791Z","repository":{"id":257898271,"uuid":"871746052","full_name":"tab/cmt","owner":"tab","description":"command-line utility that generates Conventional Commit messages using OpenAI's GPT","archived":false,"fork":false,"pushed_at":"2025-10-26T22:08:39.000Z","size":6875,"stargazers_count":3,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T00:13:01.007Z","etag":null,"topics":["changelog","conventional-commits","go","golang","openai-api","semver"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"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/tab.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":".github/CODEOWNERS","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":"2024-10-12T20:20:22.000Z","updated_at":"2025-07-29T12:15:09.000Z","dependencies_parsed_at":"2024-11-01T09:22:43.723Z","dependency_job_id":"54713d38-91bb-4666-9e94-de164aaf4927","html_url":"https://github.com/tab/cmt","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.050000000000000044","last_synced_commit":"bff5022eb46d46e70e4da2158a72362be3c5585f"},"previous_names":["tab/cmt"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/tab/cmt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab%2Fcmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab%2Fcmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab%2Fcmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab%2Fcmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tab","download_url":"https://codeload.github.com/tab/cmt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tab%2Fcmt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"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":["changelog","conventional-commits","go","golang","openai-api","semver"],"created_at":"2024-10-17T10:00:55.384Z","updated_at":"2026-01-23T18:18:45.785Z","avatar_url":"https://github.com/tab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cmt\n\n**cmt** is a command-line utility that generates [Conventional Commit](https://www.conventionalcommits.org/) messages using OpenAI's GPT models based on staged Git changes.\n\nIt automates the process of writing clear and structured commit messages, enhancing your Git workflow and ensuring consistency across projects.\n\n![screenshot](assets/screenshot.png)\n\n## Features\n\n- **Commit Message Generation**: Generates commit messages following the [Conventional Commits](https://www.conventionalcommits.org/) specification using GPT.\n- **Changelog Generation**: Generates changelogs based on your commit history and outputs to console.\n- **Interactive TUI**: Modern terminal user interface with split-panel view showing file tree and commit message for review and editing.\n- **Editor**: Built-in editor for commit message editing.\n- **Custom Prefixes**: Supports adding custom prefixes to commit messages (e.g., task IDs, issue numbers).\n- **Logging**: Built-in TUI log viewer with ring buffer for debugging and troubleshooting.\n\n## Prerequisites\n\nBefore installing and using **cmt**, ensure you have the following:\n\n- **Go**: Version 1.24 or higher is recommended.\n- **Git**: Ensure Git is installed and initialized in your project.\n- **OpenAI API Key**: Obtain an API key from [OpenAI](https://platform.openai.com/account/api-keys) to use GPT models.\n\n## Installation\n\n1. **Clone the Repository**\n\n   ```sh\n   git clone https://github.com/tab/cmt.git\n   ```\n\n2. **Navigate to the Project Directory**\n\n   ```sh\n   cd cmt\n   ```\n\n3. **Set Up Environment Variables**\n\n\n   ```sh\n   export OPENAI_API_KEY=your-api-key-here\n   ```\n\n_For permanent setup, add the above line to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.)._\n\n4. **Build the Binary**\n\n   ```sh\n   go build -o cmd/cmt cmd/main.go\n    ```\n\n5. **Make the Binary Executable**\n\n   ```sh\n   chmod +x cmd/cmt\n   ```\n\n6. **Move the Binary to Your PATH**\n\n   ```sh\n   sudo ln -s $(pwd)/cmd/cmt /usr/local/bin/cmt\n   ```\n\n7. **Verify Installation**\n\n   ```sh\n    cmt --version\n    ```\n\n## Configuration\n\nCreate a `cmt.yaml` file in the current directory:\n\n```yaml\napi:\n  retry_count: 3  # Number of retry attempts for API requests\n  timeout: 60s    # Timeout duration for API requests\n\nmodel:\n  name: gpt-4.1-nano # OpenAI model to use\n  max_tokens: 500    # Maximum tokens for the model response\n  temperature: 0.7   # Controls randomness of the model output\n\nlogging:\n  level: info        # Logging level (debug, info, warn, error)\n```\n\n## Usage\n\nNavigate to your git repository and stage the changes you want to commit:\n\n```sh\ngit add .\n```\n\nRun the `cmt` command to generate a commit message:\n\n```sh\ncmt\n```\n\nReview the generated commit message in an interactive split-panel TUI:\n\n- **Left Panel**: File tree showing staged files (scrollable)\n- **Right Panel**: Generated commit message (scrollable)\n- **Focus Indicator**: The focused pane has a blue border\n\n**Key Bindings:**\n- `Tab` - Switch focus between panes\n- `j`/`k` or `↑`/`↓` - Scroll focused pane\n- `a` - Accept and commit\n- `e` - Edit message (opens vim-style modal editor)\n- `r` - Refresh (regenerate from GPT)\n- `l` - Toggle application logs\n- `q` or `Ctrl+C` - Quit without committing\n\nIf you accept (`a`), the changes will be committed:\n\n```sh\n🚀 Changes committed:\n[feature/jwt 29ca12d] feat(core): Add user authentication\n 2 files changed, 106 insertions(+), 68 deletions(-)\n```\n\n### Custom Prefix\n\nAdd a custom prefix to your commit message (e.g., issue tracker ID):\n\n```sh\ncmt --prefix \"JIRA-123\"\n# or\ncmt prefix \"JIRA-123\"\n# or\ncmt -p \"JIRA-123\"\n```\n\nThe prefix will be prepended to the generated commit message:\n\n```\nJIRA-123 feat(core): Add user authentication\n```\n\n### Changelog Generation\n\nGenerate a changelog from your commit history and output directly to console:\n\n```sh\ncmt changelog                 # From first commit to HEAD\ncmt changelog v1.0.0..v1.1.0  # Between version tags\ncmt changelog SHA1..SHA2      # Between specific commits\ncmt changelog SHA..HEAD       # From commit to HEAD\n```\n\nThe changelog is generated using GPT and output in Markdown format:\n\nExample output:\n\n```markdown\n# CHANGELOG\n\n## [1.1.0]\n\n### Features\n\n- **feat(jwt):** Add user authentication\n- **feat(api):** Implement rate limiting for API endpoints\n\n### Bug Fixes\n\n- **fix(auth):** Resolve token expiration issue\n```\n\n### Log Viewer\n\nThe TUI includes a built-in log viewer for debugging and troubleshooting.\n\n**Accessing Logs:**\n\nPress `l` repeatedly to cycle through views:\n1. **Commit Message** (default) - Shows the generated commit message\n2. **Diff View** - Shows the staged changes (git diff)\n3. **Application Logs** - Shows structured application logs with timestamps and context\n\n**Log Levels:**\n\nSet the log level to control verbosity:\n\n```sh\n# config file (cmt.yaml)\nlogging:\n  level: debug\n```\n\n## FAQ\n\n**Q:** How do I obtain an OpenAI API key?\n\n**A:** You can obtain an API key by signing up at [OpenAI's website](https://platform.openai.com/account/api-keys). After signing in, navigate to the API keys section to generate a new key.\n\n---\n\n**Q:** How can I ensure that private information isn't shared with OpenAI?\n\n**A:** Here are some best practices to prevent sharing private information with OpenAI:\n\n1. **Review Staged Changes**: Before running the `cmt` command, carefully review the changes you have staged using `git diff --staged`. Ensure that no sensitive information (like passwords, API keys, or personal data) is included.\n2. **Exclude Sensitive Files**: Use `.gitignore` to exclude files that contain sensitive information from being tracked and staged. For example:\n\n   ```gitignore\n   .env\n   secrets/\n   ```\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n## Acknowledgements\n\n- [OpenAI](https://openai.com/) for providing the GPT models.\n- [Conventional Commits](https://www.conventionalcommits.org/) for the commit message specification.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftab%2Fcmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftab%2Fcmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftab%2Fcmt/lists"}