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.
- Keeps your commit input safe: if it changes while generation is running, the
generated message opens in a separate editor instead of replacing it.
- Bundles the MoonBit runtime. The standalone
genmit CLI is not required.
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
The built-in Codex harness reuses this login but ignores the Codex user
configuration, rules, and project instructions. It also disables shell access,
hooks, apps, subagents, and web search so generation uses the prompt prepared by
genmit. Configure the model and reasoning effort in the genmit configuration.
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-5.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.
The status-bar spinner is the cancellation control while generation is active.
There is no separate setup command: providers and harnesses are configured in
TOML.
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
[providers.codex.config]
model = "gpt-5.6-luna"
reasoning_effort = "low"
External TOML can define several named providers, choose one
with the top-level provider field, or add custom command-line harnesses. The
extension reads the file but never modifies it. Choose genmit: Select Provider
from the Source Control … menu or Command Palette. The extension remembers
your choice for the repository and config path without rewriting the
file. If that provider is later removed, the file's default provider is used.
Choose Use configuration default to clear the saved selection and follow
the top-level provider field again. The file is loaded anew for each generation
and provider selection.
Custom providers and harnesses
The shared defaults include codex, openai, and anthropic providers.
Override an existing provider by its name, or define your own in TOML. Each
provider keeps its own model and reasoning effort. A new API provider requires
its own endpoint and model; it does not inherit them from another provider with
the same API kind. Reasoning effort is optional and model-specific.
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"
Harness args come before parameter arguments, and tail_args after them.
A parameter argument group is added for a non-empty value; ${value} is
replaced with that value. Additional prompt instructions go in [prompt].extra,
and generation limits in [generation].max_provider_calls and timeout_ms.
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 and API kinds
genmit includes three ready-to-select provider names:
| Provider |
Kind |
Required setup |
codex |
codex |
Install Codex, sign in, and expose codex through PATH |
openai |
openai-responses |
Set OPENAI_API_KEY |
anthropic |
anthropic-messages |
Set ANTHROPIC_API_KEY |
codex is the name of the built-in harness as well as the default provider;
custom harness names become valid provider kinds in the same way. The HTTP API
kinds implemented by genmit are openai-responses, openai-compatible, and
anthropic-messages. You may create any number of named providers using those
kinds, each with its own endpoint, model, and credentials environment variable.
Custom harnesses run in the selected repository root and receive the prepared
prompt through standard input. They should remain in the foreground and clean
up any deliberately detached child processes.
What is sent to the provider
genmit collects the staged file list, staged diff, current
branch, and recent commit subjects. Small diffs are sent in one request. Large
diffs are split losslessly, summarized in several provider calls, and reduced
before the final commit-message request. By default, one generation may make at
most 32 provider calls and run for at most 600000 milliseconds. If the initial
lossless split exceeds the call budget, generation stops before contacting the
provider rather than sampling or truncating the diff.
Review git diff --cached before generation: staged content can contain secrets
and is sent to the selected provider. HTTP credentials are read from environment
variables and should not be stored in TOML. A custom harness executes with the
permissions of its executable; genmit's staged-only rule limits the data genmit
collects, not what an external process can read on its own.
The extension rejects Git output above 16 MiB, provider output above 4 MiB, and
process stderr above 1 MiB. Each individual Git or provider operation has a
180-second timeout, in addition to the whole-generation timeout.
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.