AI-powered git commit message generator using opencode.ai
npm install ocmtAI-powered git commit message, changelog & documentation generator using opencode.ai
```
┌ oc
│
◆ Staged changes:
│ + src/index.ts
│ + src/utils/git.ts
│
● Diff: 42 lines
│
◇ Commit message generated
│
◇ Proposed commit message:
│ "feat: add git status parsing utilities"
│
◆ What would you like to do?
│ ● Commit with this message
│ ○ Edit message
│ ○ Regenerate message
│ ○ Cancel
└
- AI-powered commit messages - Generates conventional commit messages from your staged changes
- Changelog generation - Create changelogs from your commit history
- Interactive CLI - Beautiful terminal UI with confirmation prompts
- Customizable - Edit .oc/config.md to customize commit message rulesoc
- Multiple aliases - Use , ocmt, or opencommit
- Node.js >= 18.0.0
- OpenCode installed and authenticated
#### Install OpenCode
`bashnpm
npm install -g opencode
Then authenticate:
`bash
opencode auth
`$3
`bash
bun (recommended)
bun install -g ocmtnpm
npm install -g ocmtpnpm
pnpm install -g ocmtyarn
yarn global add ocmt
`Usage
$3
`bash
Interactive commit flow
ocStage all changes first
oc -aSkip confirmation prompts
oc -yStage all and skip prompts
oc -ayUse provided message directly (skips AI)
oc "feat: add new feature"
`$3
`bash
Interactive changelog generation
oc changelogShorthand aliases
oc cl
oc --changelog
oc -clSpecify range
oc changelog --from v1.0.0 --to HEAD
oc changelog -f v1.0.0 -t v2.0.0
`Configuration
On first run, ocmt creates a
.oc/ directory in your repository root with configuration files:$3
Controls how AI generates commit messages. Default uses Conventional Commits:
`markdown
Commit Message Guidelines
Types
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- refactor: Code change that neither fixes a bug nor adds a feature
...Rules
1. Use lowercase for the type
2. No scope (e.g., use feat: not feat(api):)
3. Use imperative mood ("add" not "added")
...
`$3
Controls changelog generation format. Default uses Keep a Changelog format.
Edit these files to customize AI behavior for your project.
Commands
| Command | Aliases | Description |
|---------|---------|-------------|
|
oc | ocmt, opencommit | Generate commit message from staged changes |
| oc changelog | oc cl | Generate changelog from commits |Options
$3
| Option | Description |
|--------|-------------|
|
-a, --all | Stage all changes before committing |
| -y, --yes | Skip confirmation prompts |
| -V, --version | Show version number |
| -h, --help | Show help |$3
| Option | Description |
|--------|-------------|
|
-f, --from | Starting commit/tag reference |
| -t, --to | Ending commit/tag reference (default: HEAD) |How It Works
1. Connects to OpenCode - Tries to connect to an existing OpenCode server, or spawns a new one
2. Analyzes your changes - Reads the staged git diff
3. Generates message - Sends diff to AI with your configured rules
4. Confirms with you - Shows the proposed message for approval/editing
5. Commits - Creates the commit with the final message
$3
| Feature | Provider | Model |
|---------|----------|-------|
| Commit messages | opencode | gpt-5-nano |
| Changelogs | opencode | claude-sonnet-4-5 |
Examples
$3
`bash
$ oc
┌ oc
│
◆ Staged changes:
│ + src/utils/parser.ts
│ + src/index.ts
│
● Diff: 127 lines
│
◇ Commit message generated
│
◇ Proposed commit message:
│ "feat: add expression parser with AST support"
│
◆ What would you like to do?
│ ● Commit with this message
└
`$3
`bash
$ oc changelog
┌ changelog
│
◇ Found releases and commits
│
◆ Select starting point for changelog:
│ ○ v1.0.0 (release)
│ ○ v0.9.0 (release)
│ ● abc1234 feat: add user authentication
│ ○ def5678 fix: resolve memory leak
└
`Troubleshooting
$3
Install OpenCode first:
`bash
npm install -g opencode
or
brew install sst/tap/opencode
`$3
Run authentication:
`bash
opencode auth
`$3
Make sure you're in a git repository:
`bash
git init
`$3
Stage your changes first:
`bash
git add .
or
oc -a # stages all changes automatically
`Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the repository
2. Create your feature branch (
git checkout -b feat/amazing-feature)
3. Commit your changes (oc 😉)
4. Push to the branch (git push origin feat/amazing-feature)
5. Open a Pull RequestDevelopment
`bash
Clone the repo
git clone https://github.com/yourusername/ocmt.git
cd ocmtInstall dependencies
bun installRun in development mode
bun run devBuild for production
bun run buildType check
bun run typecheck
``MIT
- OpenCode - AI coding assistant
- OpenCode Docs - Documentation
- Conventional Commits - Commit message specification
- Keep a Changelog - Changelog format