Gitwise is a terminal-first CLI that uses AI to help with two repetitive git tasks:
- writing commit messages
- naming branches
The current MVP focuses on fast suggestions, explicit confirmation before git mutations, and support for OpenAI-compatible APIs using gpt-5-mini or gpt-5-nano.
Gitwise is available under the MIT License. See LICENSE.
Implemented today:
gitwise commitsuggestion flow from staged changesgitwise branchsuggestion flow from natural-language intent- interactive choose, edit, confirm, and regenerate actions
- actual
git commit -mandgit switch -cexecution after confirmation - config loading from global and repo config files
- schema validation for AI responses
- basic secret detection for staged diffs and file names
- test suite for core modules and CLI safety behavior
- Bun 1.3+
- git installed and available in
PATH - an OpenAI-compatible API key
bun installbun run dev --help
bun run check
bun run test
bun run buildGitwise reads config from:
- global:
~/.gitwise/config.json - repo:
.gitwise.json
To set up the machine-level config interactively, run:
gitwise configThat command writes defaults to ~/.gitwise/config.json and can also store your API key in ~/.gitwise/.env.
Gitwise also loads environment variables from:
- global:
~/.gitwise/.env - repo:
.env
Repo config overrides global config.
Repo .env values override ~/.gitwise/.env values.
Existing shell environment variables still win over both.
You can copy the starter file from .gitwise.json.example.
Example config:
{
"provider": "openai-compatible",
"model": "gpt-5-mini",
"apiBaseUrl": "https://api.openai.com/v1",
"apiKeyEnv": "OPENAI_API_KEY",
"commitStyle": "conventional",
"branchNaming": "{type}/{slug}",
"includeRecentCommits": true,
"maxDiffLines": 300
}Lower-cost model option:
{
"model": "gpt-5-nano"
}Export your API key before running the CLI:
export OPENAI_API_KEY="your-api-key"Or keep the secret in a project .env file while keeping .gitwise.json for non-secret settings:
printf 'OPENAI_API_KEY="your-api-key"\n' > .envExample split setup:
/.gitwise.json
{
"apiKeyEnv": "OPENAI_API_KEY",
"model": "gpt-5-mini"
}/.env
OPENAI_API_KEY="your-api-key"For a machine-wide setup, you can also use ~/.gitwise/.env.
Stage your changes first, then run:
gitwise commitUseful variants:
gitwise commit --dry-run
gitwise commit --json
gitwise commit --no-history
gitwise commit --skip-safety
gitwise commit -d -j -H -Sgitwise branch "add github oauth login"Useful variants:
gitwise branch --dry-run "fix config parsing"
gitwise branch --json "set up release workflow"
gitwise branch -d "fix config parsing"
gitwise branch -j "set up release workflow"gitwise configGitwise is built to assist, not silently mutate git state.
- it checks that you are in a git repository before running git-dependent commands
- it refuses
commitwhen nothing is staged - it blocks obvious secret-like content from being sent to the AI provider
- you can bypass that check with
gitwise commit --skip-safetywhen you intentionally want to send the staged diff anyway - it only runs
git commit -morgit switch -cafter interactive confirmation
src/
ai/
commands/
config/
git/
safety/
ui/
cli.ts
tests/
docs/
The test suite covers:
- config defaults and override precedence
.envparsing and precedence- branch name sanitization
- secret detection
- AI response schema validation
- provider response parsing compatibility
- diff truncation
- CLI safety behavior outside a repo and with no staged changes
- mocked provider-backed branch dry-run flow
Run tests with:
bun run testTo build the lightweight Bun bundle locally:
bun run buildThat produces dist/gitwise, which uses the Bun installed on the target machine instead of bundling the Bun runtime.
To use the JS build locally:
bun run build
bun run start -- --help
./dist/gitwise --helpTo install the package globally from this repo with Bun:
bun install -g .GitHub Actions automation is included for binary builds and releases:
.github/workflows/ci.ymlruns tests and typechecks on macOS, Linux, and Windows for pushes tomainand for pull requests.github/workflows/release.ymlbuilds a lightweight Bun bundle for tags likev0.1.0and attachesgitwise-bun.tar.gzandgitwise-bun.zipto the GitHub Release automatically
The release bundle expects Bun to already be installed on the destination machine.
To publish a release bundle:
git tag v0.1.0
git push origin v0.1.0Planned improvements include:
- tighter provider compatibility across OpenAI-style backends
- richer non-interactive automation flags
- more tests around full command execution flows
- PR title and body generation after the commit/branch MVP is solid
MIT. See LICENSE.