- TypeScript 100%
| .vscode | ||
| src | ||
| .gitignore | ||
| .vscodeignore | ||
| icon.png | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Commit Button
VS Code extension that adds a sparkle button to the Source Control title bar. The button generates a commit message via your chosen AI provider and writes it to the commit input box.
Pick the provider in Settings:
- Claude Code - runs
claude -p --no-session-persistence <prompt> - OpenAI Codex - runs
codex exec --skip-git-repo-check --ephemeral <prompt> - GitHub Copilot - delegates to the built-in
github.copilot.git.generateCommitMessage
Both Claude and Codex run "anonymous" - the prompt + response are not saved to ~/.claude/projects/ or ~/.codex/sessions/. Each commit-btn invocation is fully ephemeral.
Features
- Auto staged / unstaged: uses staged diff if anything is staged, otherwise falls back to unstaged.
- Recent commits as style reference: last N commit messages are passed to the model so its output matches your repo's style.
- Per-repo rules: each repo has its own rules file living outside the repo at
~/.config/vscode-commit-btn/rules/<repo-folder-name>.md(configurable viacommitBtn.rulesDir). Cannot be accidentally committed. RunCommit Button: Edit Repo Rulesfrom the command palette to open/create it.
Prompt placeholders
Available in commitBtn.promptTemplate and in any .commit-rules.md that uses override mode:
| Placeholder | Replaced with |
|---|---|
{{diff}} |
the diff being committed |
{{diffSource}} |
staged or unstaged |
{{branch}} |
current branch name |
{{recentCommits}} |
last N commit messages, separated by ---, prefixed with a header. Empty if recentCommitCount is 0 or the repo has no commits. |
{{repoRules}} |
contents of the per-repo rules file prefixed with a header. Empty if file is missing. |
Per-repo examples
Run Commit Button: Edit Repo Rules from the command palette - the extension creates ~/.config/vscode-commit-btn/rules/<repo-folder-name>.md if missing and opens it.
For a repo named kafka-migrations, the file is ~/.config/vscode-commit-btn/rules/kafka-migrations.md. Examples of what to put inside:
Russian commits:
Write the commit message in Russian.
Jira-style ticket IDs from branch names like feature/CORE-1234-foo:
- Extract the ticket ID (CORE-XXXX) from the branch name and put it as a prefix: "CORE-1234: short summary".
- If the branch has no ticket ID, omit the prefix.
Conventional commits:
Use conventional commits: feat:, fix:, chore:, docs:, refactor:, test:.
Pick the type that matches the diff.
Full override - file replaces the entire prompt:
<!-- mode: override -->
Write a short commit message in Russian. Branch: {{branch}}
Recent commits:
{{recentCommits}}
Diff:
{{diff}}
Settings
| Setting | Default | Notes |
|---|---|---|
commitBtn.provider |
claude |
claude / codex / copilot |
commitBtn.claude.command |
claude |
binary path |
commitBtn.claude.args |
["-p", "--no-session-persistence"] |
prompt appended as last positional arg |
commitBtn.claude.model |
"" |
--model <value> appended if non-empty (e.g. sonnet, opus) |
commitBtn.codex.command |
codex |
binary path |
commitBtn.codex.args |
["exec", "--skip-git-repo-check", "--ephemeral"] |
|
commitBtn.codex.model |
"" |
-m <value> appended if non-empty |
commitBtn.codex.reasoningEffort |
high |
-c model_reasoning_effort=<value> appended |
commitBtn.promptTemplate |
conventional-commit prompt with all placeholders | multiline editor in Settings UI |
commitBtn.recentCommitCount |
10 |
0 disables |
commitBtn.rulesDir |
~/.config/vscode-commit-btn/rules |
directory for per-repo rules files (key = repo folder name) |
commitBtn.timeoutMs |
120000 |
Build and install
npm install
npm run compile
npx --yes @vscode/vsce package --allow-missing-repository
code --install-extension commit-btn-0.0.1.vsix --force
Or press F5 in this folder for an Extension Development Host.
For full immersion: ditch Copilot
Modern VS Code ships with GitHub Copilot Chat as a built-in extension that you didn't install yourself. It contributes its own sparkle button to the SCM input box, which ends up sitting next to ours as a confusing dropdown. There is no Copilot setting and no VS Code right-click that reliably hides just that button.
The cleanest fix is to disable the whole built-in Copilot Chat extension:
Ctrl+Shift+X(Extensions view)- Search:
@builtin copilot - Find "GitHub Copilot Chat" (or "Copilot Chat") - the one marked as built-in
- Cog icon → Disable → reload window
After that:
- Copilot's sparkle next to the commit input disappears
- Our button shows alone, no dropdown shenanigans
- Copilot's chat panel goes away from the sidebar
- No more "Sign in to GitHub Copilot" popups
- ~100MB RAM freed from the Copilot host process
If you ever want it back, same place → Enable. Notably this only matters if you don't actually pay for / use Copilot - if you do, leave it on and live with the dropdown.
Notes
- The prompt is passed as a positional argv via
execFile, no shell, no escaping needed. - For
copilotprovider we just forward to their command - our prompt, recent-commits, and repo rules are not used in that mode (no API to inject them). - Multi-root workspace: when you click the sparkle inside a specific repo's SCM section, the extension uses that repo. Falls back to a QuickPick if the active repo is ambiguous.