Skip to content

feat(prompts): add commit prompt for conventional commit generation#307

Open
aek676 wants to merge 2 commits into
nickjvandyke:mainfrom
aek676:main
Open

feat(prompts): add commit prompt for conventional commit generation#307
aek676 wants to merge 2 commits into
nickjvandyke:mainfrom
aek676:main

Conversation

@aek676

@aek676 aek676 commented Jun 26, 2026

Copy link
Copy Markdown

Add a commit prompt to the select prompts that generates conventional commit messages from staged git diff output. Include a <leader>oc keymap example and a tip for copying the result in the README.

Tasks

  • I read CONTRIBUTING.md
  • I ensured my changes pass automated checks
  • I reviewed and understand the AI-generated code in my changes (if any)

Description

This PR introduces a new commit prompt to the selection menu that automatically generates conventional commit messages based on the staged git diff output. Generating commit messages is a very common and useful workflow in other AI assistants (like copilot.nvim), so adding this native capability will greatly enhance the developer experience in opencode.nvim.

Additionally, I've updated the README to include an example keymap (<leader>oc) and a quick tip on how to copy the generated result.

Testing

  1. Stage some changes in the repository using git add.
  2. Open the prompt menu (e.g., using <leader>ox).
  3. Select the commit prompt from the list.
  4. Verify that Opencode reads the staged diff and successfully generates a conventional commit message.
  5. Copy the generated message using C-x y.

Add a `commit` prompt to the select prompts that generates conventional
commit messages from staged `git diff` output. Include a `<leader>oc`
keymap example and a tip for copying the result in the README.
Copilot AI review requested due to automatic review settings June 26, 2026 22:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new built-in commit select prompt that asks OpenCode to generate a Conventional Commit message from staged changes, and documents how to use it (including an example keymap and a copy tip) in the README.

Changes:

  • Add select.prompts.commit default prompt text for Conventional Commit message generation.
  • Document the new prompt in the README’s select-prompts list.
  • Add <leader>oc keymap examples and a note on copying the generated message.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
README.md Adds keymap examples, documents the new commit prompt, and adds a copy tip for the generated message.
lua/opencode/config.lua Introduces the commit prompt under select.prompts defaults.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread README.md
Comment on lines +79 to +81
vim.keymap.set("n", "<leader>oc", function()
require("opencode").prompt(require("opencode.config").opts.select.prompts.commit)
end, { desc = "Generate conventional commit" })
Comment thread README.md
Comment on lines +225 to +226
> [!TIP]
> After generating a commit message, copy it from the OpenCode TUI with `<leader>y` (press `ctrl+x` then `y`).
Comment thread lua/opencode/config.lua
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants