@@ -24,18 +24,23 @@ def get_summary(self, instruction: str, generate_description: bool) -> dict:
2424 This function retrieves the differences of the staged changes in the
2525 repository and generates a commit summary using the provided
2626 instruction. If there are no changes staged for commit, an exception is
27- raised. If an LLM client is provided, it will use that for generating
28- the summary, otherwise it will use the API client.
27+ raised. If a JIRA client is connected, it will attempt to extract issue
28+ keys from the current branch and use them to fetch context. The summary
29+ can be generated either with a Language Model (LLM) client or through
30+ the API client.
2931
3032 Args:
3133 instruction (str): A string containing instructions for generating the commit summary.
34+ generate_description (bool): Whether to include detailed descriptions in the summary.
3235
3336 Returns:
34- str: The generated commit summary based on the staged changes and provided
35- instruction.
37+ dict: The generated commit summary based on the staged changes, provided
38+ instruction, and any relevant JIRA context. The dictionary contains keys
39+ such as 'summary', 'description', etc., depending on whether a
40+ description was requested.
3641
3742 Raises:
38- Exception : If there are no changes staged for commit.
43+ ValueError : If there are no changes staged for commit.
3944 """
4045 diff = self .repo .git .diff ('--cached' )
4146 if not diff :
@@ -68,17 +73,17 @@ def get_summary(self, instruction: str, generate_description: bool) -> dict:
6873 def run (self , msg : Optional [str ], edit_commit_message : bool , generate_description : bool ):
6974 """Run the post-commit hook.
7075
71- This method retrieves the list of modified files from the last commit
72- and processes each file. It stages any files that have been modified
73- during processing and creates an auto-commit if changes were made. A
74- progress bar is displayed to indicate the processing status of each
75- file. If there is an error generating the commit summary, an exception
76- is raised.
76+ This method processes the modified files from the last commit, stages
77+ them, and creates an auto-commit with an optional message. It also
78+ handles JIRA integration if available. If there is an error generating
79+ the commit summary, an exception is raised.
7780
7881 Args:
7982 msg (Optional[str]): An optional message to include in the commit.
80- edit_commit_message (bool): A flag indicating whether to open the
81- git commit edit terminal after committing.
83+ edit_commit_message (bool): A flag indicating whether to open the git commit edit terminal after
84+ committing.
85+ generate_description (bool): A flag indicating whether to include a description in the commit
86+ message.
8287
8388 Raises:
8489 Exception: If there is an error generating the commit summary.
@@ -106,16 +111,16 @@ def run(self, msg: Optional[str], edit_commit_message: bool, generate_descriptio
106111 self ._amend_commit ()
107112
108113 def process_jira_integration (self , title : str , description : str , msg : str ) -> tuple :
109- """
110- Process JIRA integration for the commit message.
111-
114+ """Process JIRA integration for the commit message.
115+
112116 Args:
113- title: Generated commit title
114- description: Generated commit description
115- msg: Original user message that might contain JIRA references
116-
117+ title (str) : Generated commit title.
118+ description (str) : Generated commit description.
119+ msg (str) : Original user message that might contain JIRA references.
120+
117121 Returns:
118- tuple: (updated_title, updated_description) with JIRA information
122+ tuple: A tuple containing the updated commit title and description with
123+ included JIRA information.
119124 """
120125 # Look for JIRA issue keys in commit message, title, description and user message
121126 issue_keys = []
0 commit comments