genmit for VS Code
Generate an AI-assisted Git commit message from your staged changes without
leaving VS Code.
genmit adds its own action to Source Control. It reads the staged diff,
generates a commit message with the provider you configured, and places the
result in the Source Control commit input. It never stages files and never
creates the commit for you.
Features
- Uses only staged Git changes. Unstaged and untracked content is not included
in the prompt generated by genmit.
- Supports Conventional Commits, plain messages, and gitmoji.
- Switches between named providers from your TOML configuration.
- Works with Codex CLI, the OpenAI Responses API, OpenAI-compatible Chat
Completions APIs, Anthropic Messages, and custom command-line harnesses.
- Handles large staged diffs without silently dropping parts of them.
- Shows generation progress and logs for troubleshooting.
- Keeps your commit input safe: if it changes while generation is running, the
generated message opens in a separate editor instead of replacing it.
- Works without the standalone
genmit CLI.
Quick start with Codex
The default configuration uses Codex CLI. Install Codex, sign in, and make sure
the codex executable is available on the PATH inherited by VS Code:
codex login
codex login status
genmit reuses this login. Configure the model and reasoning effort in genmit's
TOML configuration; Codex rules and project instructions are not used.
Then:
- Open a Git repository in VS Code.
- Stage the changes that should be described by the commit message.
- Click the genmit button in the Source Control view, or run
genmit: Generate Commit Message from the Command Palette.
- Review and edit the generated message, then commit normally.
If no external configuration file exists, genmit uses its bundled Codex
defaults: model gpt-6-luna with low reasoning effort.
While generation is running, a spinner is shown in the VS Code status bar.
Click it to cancel all active generations.
Starting another generation for the same repository cancels the previous one.
When several Git repositories are open, the Source Control action targets the
repository where it was invoked. Commands without repository context ask you to
choose a repository instead of guessing from the active editor.
Commands
- genmit: Generate Commit Message generates a message for the selected Git
repository and places it in the Source Control input.
- genmit: Select Provider switches between providers from the active TOML
configuration without editing the file. It is available from the Source
Control
… menu and the Command Palette.
- genmit: Show Generation Log opens the generation log in Output → genmit.
Configuration
The extension and CLI use the same TOML configuration format. Open VS Code
Settings and search for genmit to set Genmit: Config Path, the extension's
only setting. The path is machine-specific; workspace settings cannot override
it. Edit provider definitions and generation settings directly in TOML.
When Genmit: Config Path is empty, the extension looks for:
$GENMIT_HOME/config.toml, when GENMIT_HOME is set;
- otherwise
<home>/.config/genmit/config.toml.
If neither file exists, the bundled Codex defaults are used. A non-empty config
path disables automatic discovery. Relative paths are resolved from the
selected repository root.
A minimal Codex configuration looks like this:
provider = "codex"
language = "en"
style = "conventional"
include_body = true
max_subject_length = 72
body_wrap_width = 72
[providers.codex.config]
model = "gpt-6-luna"
reasoning_effort = "low"
body_wrap_width defaults to 72 characters. Set it to 0 to disable body wrapping.
Choose genmit: Select Provider from the Source Control … menu or Command
Palette to switch providers. The extension remembers your choice for the
repository without changing the TOML file. Choose Use configuration default
to follow the file's provider setting again.
Custom providers and harnesses
Override a built-in provider by name, or define your own with its endpoint and
model in TOML.
For example, add a local OpenAI-compatible server:
provider = "local"
[providers.local]
kind = "openai-compatible"
[providers.local.config]
endpoint = "http://localhost:11434/v1/chat/completions"
model = "my-model"
max_tokens = 1024
To use another command-line tool, describe its reusable harness and then create
a provider with concrete parameter values:
provider = "local"
[harnesses.pi]
executable = "pi"
args = ["--print"]
[harnesses.pi.parameters.model]
required = true
args = ["--model", "${value}"]
[providers.local]
kind = "pi"
[providers.local.config]
model = "my-model"
See the CLI configuration guide
for shared message settings and generation limits.
For HTTP providers, set the required API key in the environment before starting
VS Code. Restart VS Code after changing its environment. The standard variable
is OPENAI_API_KEY for OpenAI Responses and ANTHROPIC_API_KEY for Anthropic;
each API provider can select a different variable name.
Built-in providers
genmit includes three ready-to-select provider names:
| Provider |
Required setup |
codex |
Install Codex, sign in, and put codex on PATH |
openai |
Set OPENAI_API_KEY |
anthropic |
Set ANTHROPIC_API_KEY |
What is sent to the provider
genmit sends the staged file list and diff, current branch, and recent commit
subjects to the selected provider. Large diffs may require several requests.
The default limits are 32 requests and 10 minutes; exceeding them produces an
error instead of silently omitting changes.
Review git diff --cached before generation: staged content can contain secrets
and is sent to the selected provider. API keys belong in environment variables,
not TOML. Custom command-line tools run with their own permissions and may
access files beyond the staged changes.
Generation logging
Open Output → genmit, or run genmit: Show Generation Log, to check
progress and investigate slow or failed generation. Logs show stages and timings
with local timestamps and highlighted severity levels. They do not record
staged content or credentials.
The status bar shows the current stage. Click its spinner to cancel generation.
Troubleshooting
- No staged changes found: stage at least one change in Source Control and
run generation again.
- Failed to run
codex: check codex login status, verify that codex is
on PATH, and restart VS Code after changing PATH.
- Missing environment variable: define the variable named by the provider's
api_key_env field in TOML, then restart VS Code.
- Endpoint is empty: set
endpoint in the provider's TOML configuration.
OpenAI-compatible providers require the complete Chat Completions URL.
- Generated message opened in an editor: the Source Control input changed
while generation was running, so genmit preserved it instead of overwriting
it.
Development
Development requires Node.js 24 or newer, an up-to-date MoonBit toolchain, and
Git:
npm install
npm test
npm run package
npm test builds the embedded MoonBit JavaScript runtime, checks TypeScript,
and runs the extension tests. npm run package creates a
genmit-<version>.vsix file. Install it with VS Code's
Extensions: Install from VSIX... command.