[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ellama a7abe668f5 4/7: Add commit message generation
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ellama a7abe668f5 4/7: Add commit message generation |
Date: |
Wed, 10 Jul 2024 15:58:18 -0400 (EDT) |
branch: externals/ellama
commit a7abe668f5cff0914baf573fc188521db8e65ace
Author: Sergey Kostyaev <sskostyaev@gmail.com>
Commit: Sergey Kostyaev <sskostyaev@gmail.com>
Add commit message generation
Add a new customizable variable
`ellama-generate-commit-message-template` and a function
`ellama-generate-commit-message` to generate commit messages based on
diffs using ellama.
---
ellama.el | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/ellama.el b/ellama.el
index 609d6ce46e..ebae39c0d6 100644
--- a/ellama.el
+++ b/ellama.el
@@ -5,7 +5,7 @@
;; Author: Sergey Kostyaev <sskostyaev@gmail.com>
;; URL: http://github.com/s-kostyaev/ellama
;; Keywords: help local tools
-;; Package-Requires: ((emacs "28.1") (llm "0.6.0") (spinner "1.7.4"))
+;; Package-Requires: ((emacs "28.1") (llm "0.6.0") (spinner "1.7.4") (compat
"29.1"))
;; Version: 0.11.6
;; SPDX-License-Identifier: GPL-3.0-or-later
;; Created: 8th Oct 2023
@@ -42,6 +42,8 @@
(require 'info)
(require 'shr)
(require 'eww)
+(require 'vc)
+(require 'compat)
(eval-when-compile (require 'rx))
(defgroup ellama nil
@@ -266,6 +268,17 @@ PROMPT is a prompt string."
:group 'ellama
:type 'string)
+(defcustom ellama-generate-commit-message-template "You are professional
software developer.
+Write concise commit message based on diff. First line should
+contain short title described major change in functionality. Then
+one empty line. Then detailed description of all changes. Reply
+with commit message only. Diff:
+
+%s"
+ "Prompt template for `ellama-generate-commit-message'."
+ :group 'ellama
+ :type 'string)
+
(defcustom ellama-make-format-prompt-template "Render the following text as a
%s:\n%s"
"Prompt template for `ellama-make-format'."
:group 'ellama
@@ -1626,6 +1639,26 @@ the full response text when the request completes (with
BUFFER current)."
(text (buffer-substring-no-properties beg end)))
(ellama-stream text)))
+;;;###autoload
+(defun ellama-generate-commit-message ()
+ "Generate commit message based on diff."
+ (interactive)
+ (let* ((default-directory
+ (if (string= ".git"
+ (car (reverse
+ (cl-remove
+ ""
+ (file-name-split default-directory)
+ :test #'string=))))
+ (file-name-parent-directory default-directory)
+ default-directory))
+ (diff (with-temp-buffer
+ (vc-diff-internal
+ nil (vc-deduce-fileset t) nil nil nil (current-buffer))
+ (buffer-substring-no-properties (point-min) (point-max)))))
+ (ellama-stream
+ (format ellama-generate-commit-message-template diff))))
+
;;;###autoload
(defun ellama-ask-line ()
"Send current line to ellama chat."
- [elpa] externals/ellama updated (811d6aa821 -> d6d38df99d), ELPA Syncer, 2024/07/10
- [elpa] externals/ellama d32e76c1f2 3/7: Bump version, ELPA Syncer, 2024/07/10
- [elpa] externals/ellama a7abe668f5 4/7: Add commit message generation,
ELPA Syncer <=
- [elpa] externals/ellama 7528e4346e 5/7: Add emacs 29.4 to CI pipelines, ELPA Syncer, 2024/07/10
- [elpa] externals/ellama d3cc009816 2/7: Merge pull request #140 from s-kostyaev/improve-quotes, ELPA Syncer, 2024/07/10
- [elpa] externals/ellama 23bcd19613 6/7: Merge pull request #141 from s-kostyaev/add-commit-message-generation, ELPA Syncer, 2024/07/10
- [elpa] externals/ellama d6d38df99d 7/7: Bump version, ELPA Syncer, 2024/07/10
- [elpa] externals/ellama ac523d9f23 1/7: Add link to quoted content in a separate buffer, ELPA Syncer, 2024/07/10