Skip to content

feat: add automatic commit message generation#11993

Draft
roomote-v0[bot] wants to merge 3 commits intomainfrom
feature/auto-commit-message-generation
Draft

feat: add automatic commit message generation#11993
roomote-v0[bot] wants to merge 3 commits intomainfrom
feature/auto-commit-message-generation

Conversation

@roomote-v0
Copy link
Contributor

@roomote-v0 roomote-v0 bot commented Mar 26, 2026

Related GitHub Issue

Closes: #11992

Description

This PR attempts to address Issue #11992 by adding automatic commit message generation to Roo Code.

What it does:

  • Adds a sparkle button ($(sparkle)) to the Source Control title bar that generates a commit message using the configured AI provider
  • Reads the staged diff (falls back to unstaged diff if nothing is staged)
  • Sends the diff to the AI with a prompt requesting Conventional Commits format
  • Sets the generated message in the SCM input box
  • Supports per-commit model selection via a quick pick that lets users choose from their configured API profiles (as requested by @KingingWang)

Key files changed:

  • packages/types/src/vscode.ts - Added generateCommitMessage command ID
  • src/utils/commit-message-generator.ts - Core logic for diff retrieval, AI completion, and SCM integration
  • src/activate/registerCommands.ts - Command registration with profile picker and progress notification
  • src/package.json - Command contribution and SCM title menu entry
  • src/package.nls.json - i18n string for the command title
  • src/i18n/locales/en/common.json - i18n strings for UI messages
  • src/utils/__tests__/commit-message-generator.spec.ts - Unit tests

Test Procedure

  1. Unit tests: cd src && npx vitest run utils/__tests__/commit-message-generator.spec.ts (5 tests pass)
  2. Manual: Open a git repo in VSCode with Roo Code, make changes, click the sparkle icon in the SCM title bar, optionally select a different API profile, and verify a commit message is generated and placed in the SCM input box

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue
  • Scope: Changes are focused on the linked issue
  • Self-Review: Performed self-review
  • Testing: Unit tests added (5 passing)
  • Documentation Impact: No documentation updates required for this feature
  • Contribution Guidelines: Read and agree

Documentation Updates

  • No documentation updates are required.

Additional Notes

Feedback and guidance are welcome.

Interactively review PR in Roo Code Cloud

@KingingWang
Copy link

@roomote Run node scripts/find-missing-translations.js
Starting translation check...

BACKEND - Checking 17 non-English locale(s): ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
Checking 7 translation file(s): common.json, embeddings.json, marketplace.json, mcp.json, skills.json, tools.json, worktrees.json

BACKEND Missing Translations Report:

📝 ca:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 de:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 es:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 fr:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 hi:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 id:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 it:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 ja:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 ko:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 nl:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 pl:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 pt-BR:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 ru:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 tr:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 vi:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 zh-CN:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

📝 zh-TW:

  • common.json: 6 missing translations
    commit.no_workspace: "No workspace folder found. Open a folder to generate a commit message."
    commit.generating: "Generating commit message..."
    commit.no_changes: "No changes detected. Stage or modify files before generating a commit message."
    commit.generation_failed: "Failed to generate commit message"
    commit.use_current_profile: "Use current profile"
    commit.select_profile: "Select an API profile for commit message generation"

FRONTEND - Checking 17 non-English locale(s): ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
Checking 10 translation file(s): chat.json, cloud.json, common.json, history.json, marketplace.json, mcp.json, prompts.json, settings.json, welcome.json, worktrees.json

FRONTEND Missing Translations Report:

✅ ca: No missing translations
✅ de: No missing translations
✅ es: No missing translations
✅ fr: No missing translations
✅ hi: No missing translations
✅ id: No missing translations
✅ it: No missing translations
✅ ja: No missing translations
✅ ko: No missing translations
✅ nl: No missing translations
✅ pl: No missing translations
✅ pt-BR: No missing translations
✅ ru: No missing translations
✅ tr: No missing translations
✅ vi: No missing translations
✅ zh-CN: No missing translations
✅ zh-TW: No missing translations

PACKAGE.NLS - Checking 17 locale file(s): ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
Checking against base package.nls.json with 48 keys

PACKAGE.NLS Missing Translations Report:

📝 ca:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 hi:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 de:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 id:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 fr:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 ja:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 it:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 es:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 ko:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 nl:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 pl:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 pt-BR:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 ru:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 tr:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 vi:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 zh-CN:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

📝 zh-TW:

  • package.nls.json: 1 missing translations
    command.generateCommitMessage.title: "Generate Commit Message"

✏️ To add missing translations:

  1. Add the missing keys to the corresponding locale files
  2. Translate the English values to the appropriate language
  3. Run this script again to verify all translations are complete

@roomote-v0
Copy link
Contributor Author

roomote-v0 bot commented Mar 27, 2026

Fixaroo Clock   See task

Added missing translations for all 17 non-English locales: 6 commit.* keys in backend common.json files and command.generateCommitMessage.title in package.nls.*.json files. Validation script confirms all translations are complete.

View commit | Revert commit

@KingingWang
Copy link

@roomote Please carefully review this code, do you think this commit can be merged into the main branch

@roomote-v0
Copy link
Contributor Author

roomote-v0 bot commented Mar 27, 2026

Fixaroo Clock   See task

Fixed code quality issues: rewrote incomplete getGitDiff tests with proper assertions (5 -> 8 tests), fixed markdown stripping regex for language-tagged code blocks, added --no-color to git diff commands, and internationalized hardcoded error strings. All lint and type checks pass.

View commit | Revert commit

- Rewrite getGitDiff tests with proper assertions (3 new tests)
- Fix markdown stripping regex to handle language-tagged code blocks
- Add --no-color flag to git diff commands for clean output
- Internationalize hardcoded error strings in setScmInputBoxMessage
- Add no_git_extension and no_git_repo i18n keys to all locales
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] automatic commit generation

2 participants