Commit Composer
A minimal VS Code extension that generates commit messages with a custom OpenAI-compatible model and a customizable prompt.
Features
- Adds a commit message button to the Source Control title bar
- Lets you edit global and project model config files from the Command Palette
- Lets you edit global and project prompt templates from the Command Palette
- Uses staged changes first and falls back to unstaged changes when needed
- Silently does nothing when the repository has no changes
- Switches the Source Control button to a loading state while generating
- Writes the generated message directly into the Git commit input box
Configuration
Run Commit Composer: Edit Global Model Config to open the global config file.
Run Commit Composer: Edit Project Model Config to create or open the project config file at .vscode/commit-composer/model-config.json.
Global default content:
{
"baseUrl": "https://api.openai.com/v1",
"apiKey": "",
"model": "gpt-4o-mini"
}
Project config fields are optional overrides. Leave a field empty or omit it to inherit the global value:
{
"baseUrl": "",
"apiKey": "",
"model": ""
}
Save the file and run commit generation again to apply the changes. Project config is used first, then global config fills missing values.
Prefer keeping apiKey in the global config so project files can be shared without secrets.
Prompt Template
Run Commit Composer: Edit Global Prompt Template to open the global template file.
Run Commit Composer: Edit Project Prompt Template to create or open the project template at .vscode/commit-composer/commit-prompt.md.
The project template is used when it exists. Otherwise, the global template is used.
Supported variables:
{{diff}}
{{gitStatus}}
{{recentCommitMessages}}
If the template does not include {{diff}}, the extension appends the selected diff automatically so the model still receives the required context.
If the template does not include {{recentCommitMessages}}, the extension appends the latest commit subjects automatically and asks the model to reference their style when appropriate.
Development
make install
make test
make compile
make package
Open the project in VS Code and press F5 to launch an Extension Development Host.
If the code CLI is available on your machine, you can also run:
make install-vsix