AI-powered git commit message generator that writes your commit messages for you!
tcxcommit is a command-line tool that uses artificial intelligence to generate meaningful and conventional git commit messages. Simply stage your changes and let tcxcommit create the perfect commit message for you. It supports both free trials and your own OpenRouter API key.
- AI-powered commit message generation
- Conventional commit format support (feat:, fix:, docs:, refactor:, etc.)
- Free to start with 10 trial commits (requires
OPENROUTER_TRIAL_KEY) - Option to use your own OpenRouter API key for unlimited usage
- Automatic change staging
- Git push support after commit
- Clean and beautiful terminal interface
- Rate limit handling
- Network error handling
- Node.js 18 or higher
- Git installed and configured
- Internet connection (for AI API calls)
npm install -g tcxcommitnpx tcxcommit- Navigate to your git repository
- Make some changes to your files
- Run the following command:
tcxcommit- Follow the interactive prompts:
- Press Enter to continue
- Choose API option (free trials or your own key)
- Wait for AI to generate commit message
- Accept, regenerate, or exit
- Choose to push to remote after commit
tcxcommit automatically stages your changes before generating the commit message. You can also manually stage files:
# Stage specific file
git add filename.js
# Stage all changes
git add .
# Stage specific folder
git add src/By default, tcxcommit provides 10 free trial commits powered by a trial key you configure—this is useful for testing or occasional use.
- No personal API key is required: just point
OPENROUTER_TRIAL_KEYat the shared key you want to reuse. - Prompts still show remaining trials on each run when configured.
- When the trial count hits zero, tcxcommit asks you to add your own key.
- Run
tcxcommit --free-trialor setTCXCOMMIT_FORCE_TRIAL=1to force the trial menu even if a saved key exists.
For unlimited commits, you can use your own OpenRouter API key:
- Visit OpenRouter.ai to get a free API key
- Run
tcxcommit - Select "Use my own API key" when prompted
- Enter your API key
- The key is saved locally for future use
Your API key is stored securely on your machine and is never shared with anyone except OpenRouter for generating commit messages.
# Start tcxcommit
tcxcommit
# Or use npx without installing
npx tcxcommittcxcommit follows this simple flow:
- Checks for git repository in current directory
- Stages all changes automatically using
git add . - Gets the staged diff using
git diff --cached - Sends the diff to OpenRouter AI API
- AI generates a conventional commit message
- Displays the suggested message
- User accepts, regenerates, or exits
- If accepted, commits with the generated message
- Optionally pushes to remote repository
Error: No changes found
Solution: Make some changes to your files and try again. tcxcommit requires at least one staged change to generate a commit message.
Error: Rate limit exceeded
Solution: Use your own OpenRouter API key for unlimited commits. The free trials have rate limits.
Error: Network error. Please check your internet connection.
Solution: Ensure you have an active internet connection and try again.
Error: Git is not installed or not in PATH
Solution: Install Git and ensure it's available in your system PATH.
Error: Not a git repository
Solution: Initialize a git repository first:
git initIf you get permission errors during installation:
sudo npm install -g tcxcommitOr fix npm permissions:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g tcxcommittcxcommit stores its configuration in the following location:
- Linux/macOS:
~/.tcxcommit/config.json - Windows:
C:\Users\YourUsername\.tcxcommit\config.json
The configuration file contains:
- Your API key (if set)
- Number of free trials remaining
tcxcommit also relies on these environment variables when the config has no saved key:
-- OPENROUTER_API_KEY: optional personal key to use instead of entering it interactively.
-- OPENROUTER_TRIAL_KEY: the key to reuse for free trial runs; leave unset to disable the trial path.
tcxcommit/
├── src/
│ ├── cli.ts # Entry point
│ ├── index.ts # Main application logic
│ ├── api/
│ │ └── openrouter.ts # OpenRouter API integration
│ ├── ui/
│ │ ├── header.ts # Terminal header display
│ │ └── spinner.ts # Loading spinner
│ └── utils/
│ ├── apiKey.ts # API key management
│ └── git.ts # Git operations
├── dist/ # Compiled JavaScript (published)
├── package.json
├── tsconfig.json
└── README.md
- Your API key is stored locally in the configuration file
- Keys are never sent to any server except OpenRouter
- Free trials require you to set
OPENROUTER_TRIAL_KEYso no secret is checked into this project - No data is collected or analytics are sent anywhere
- Node.js - JavaScript runtime
- TypeScript - Programming language
- OpenRouter - AI API provider
- Chalk - Terminal string styling
- Prompts - Interactive CLI prompts
completed 1k+ download in 1 day
ISC License
tcxcommit is created and maintained by the community.
If you encounter any issues or have suggestions:
- Open an issue on GitHub: https://github.com/sahilcodexx/tcxcommit/issues
- Check the source code on GitHub: https://github.com/sahilcodexx/tcxcommit
- OpenRouter for providing the AI API
- Chalk for beautiful terminal colors
- Prompts for interactive CLI prompts