diff --git a/docs/html/README_8md.html b/docs/html/README_8md.html new file mode 100644 index 0000000..5ecc33f --- /dev/null +++ b/docs/html/README_8md.html @@ -0,0 +1,144 @@ + + +
+ + + + + + + + + + + + + + + +|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
| ▼Npenify_hook | |
| ▼Napi_client | |
| CAPIClient | |
| ▼Nbase_analyzer | |
| CBaseAnalyzer | |
| ▼Ncommit_analyzer | |
| CCommitDocGenHook | |
| ▼Nfile_analyzer | |
| CFileAnalyzerGenHook | |
| ▼Nfolder_analyzer | |
| CFolderAnalyzerGenHook | |
| ▼Ngit_analyzer | |
| CGitDocGenHook | |
| ▼Njira_client | |
| CJiraClient | |
| ▼Nllm_client | |
| CLLMClient | |
| ▼Nutils | |
| CGitRepoNotFoundError | |
| ▼Ntests | |
| ▼Ntest_commit_commands | |
| CTestCommitCommands | |
| ▼Ntest_config_commands | |
| CTestConfigCommands | |
| ▼Ntest_web_config | |
| CTestWebConfig | |
| CException |
|
+ penify-cli
+
+ |
+
+Classes | |
| class | penify_hook.api_client.APIClient |
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.api_client |
|
+ penify-cli
+
+ |
+
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.commands |
| namespace | penify_hook.commands.auth_commands |
+Functions | |
| penify_hook.commands.auth_commands.save_credentials (api_key) | |
| penify_hook.commands.auth_commands.login (api_url, dashboard_url) | |
|
+ penify-cli
+
+ |
+
+Classes | |
| class | penify_hook.base_analyzer.BaseAnalyzer |
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.base_analyzer |
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
This is the complete list of members for penify_hook.api_client.APIClient, including all inherited members.
+| __init__(self, api_url, str api_token=None, str bearer_token=None) | penify_hook.api_client.APIClient | |
| api_url | penify_hook.api_client.APIClient | |
| AUTH_TOKEN | penify_hook.api_client.APIClient | |
| BEARER_TOKEN | penify_hook.api_client.APIClient | |
| generate_commit_summary(self, git_diff, str instruction="", repo_details=None, dict jira_context=None) | penify_hook.api_client.APIClient | |
| generate_commit_summary_with_llm(self, diff, message, bool generate_description, repo_details, LLMClient llm_client, jira_context=None) | penify_hook.api_client.APIClient | |
| get_api_key(self) | penify_hook.api_client.APIClient | |
| get_supported_file_types(self) | penify_hook.api_client.APIClient | |
| send_file_for_docstring_generation(self, file_name, content, line_numbers, repo_details=None) | penify_hook.api_client.APIClient |
|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| __init__ (self, api_url, str api_token=None, str bearer_token=None) | |
| send_file_for_docstring_generation (self, file_name, content, line_numbers, repo_details=None) | |
| generate_commit_summary (self, git_diff, str instruction="", repo_details=None, dict jira_context=None) | |
| list[str] | get_supported_file_types (self) |
| generate_commit_summary_with_llm (self, diff, message, bool generate_description, repo_details, LLMClient llm_client, jira_context=None) | |
| get_api_key (self) | |
+Public Attributes | |
| api_url = api_url | |
| AUTH_TOKEN = api_token | |
| BEARER_TOKEN = bearer_token | |
| penify_hook.api_client.APIClient.__init__ | +( | +self, | +|
| + | + | api_url, | +|
| + | + | str | api_token = None, | +
| + | + | str | bearer_token = None ) | +
| penify_hook.api_client.APIClient.generate_commit_summary | +( | +self, | +|
| + | + | git_diff, | +|
| + | + | str | instruction = "", | +
| + | + | repo_details = None, | +|
| + | + | dict | jira_context = None ) | +
Generates a commit summary by sending a POST request to the API endpoint. + +This function constructs a payload containing the git diff and any additional +instructions provided. It then sends this payload to a specified API endpoint +to generate a summary of the commit. If the request is successful, it returns +the response from the API; otherwise, it returns None. The function also +handles optional repository details and JIRA context if they are provided. + +Args: + git_diff (str): The git diff of the commit. + instruction (str): Additional instruction for the commit. Defaults to "". + repo_details (dict): Details of the git repository. Defaults to None. + jira_context (dict): JIRA issue details to enhance the commit summary. Defaults to None. + +Returns: + dict: The response from the API if the request is successful, None otherwise. +
| penify_hook.api_client.APIClient.generate_commit_summary_with_llm | +( | +self, | +|
| + | + | diff, | +|
| + | + | message, | +|
| + | + | bool | generate_description, | +
| + | + | repo_details, | +|
| + | + | LLMClient | llm_client, | +
| + | + | jira_context = None ) | +
Generates a commit summary using a local LLM client; falls back to API on +error.
| penify_hook.api_client.APIClient.get_api_key | +( | +self | ) | ++ |
Fetch an API key from a specified URL using a Bearer token.+
| list[str] penify_hook.api_client.APIClient.get_supported_file_types | +( | +self | ) | ++ |
Retrieve supported file types from the API or return a default list.+
| penify_hook.api_client.APIClient.send_file_for_docstring_generation | +( | +self, | +|
| + | + | file_name, | +|
| + | + | content, | +|
| + | + | line_numbers, | +|
| + | + | repo_details = None ) | +
Send file content and modified lines to the API and return modified content.+
| penify_hook.api_client.APIClient.api_url = api_url | +
| penify_hook.api_client.APIClient.AUTH_TOKEN = api_token | +
| penify_hook.api_client.APIClient.BEARER_TOKEN = bearer_token | +
|
+ penify-cli
+
+ |
+
This is the complete list of members for penify_hook.base_analyzer.BaseAnalyzer, including all inherited members.
+|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| __init__ (self, str folder_path, APIClient api_client) | |
+Public Attributes | |
| folder_path = folder_path | |
| repo_path = recursive_search_git_folder(folder_path) | |
| repo = None | |
| repo_details = None | |
| relative_file_path = os.path.relpath(folder_path) | |
| api_client = api_client | |
| supported_file_types = set(api_client.get_supported_file_types()) | |
| penify_hook.base_analyzer.BaseAnalyzer.__init__ | +( | +self, | +|
| + | + | str | folder_path, | +
| + | + | APIClient | api_client ) | +
| penify_hook.base_analyzer.BaseAnalyzer.api_client = api_client | +
| penify_hook.base_analyzer.BaseAnalyzer.folder_path = folder_path | +
| penify_hook.base_analyzer.BaseAnalyzer.relative_file_path = os.path.relpath(folder_path) | +
| penify_hook.base_analyzer.BaseAnalyzer.repo = None | +
| penify_hook.base_analyzer.BaseAnalyzer.repo_details = None | +
| penify_hook.base_analyzer.BaseAnalyzer.repo_path = recursive_search_git_folder(folder_path) | +
| penify_hook.base_analyzer.BaseAnalyzer.supported_file_types = set(api_client.get_supported_file_types()) | +
|
+ penify-cli
+
+ |
+
This is the complete list of members for penify_hook.commit_analyzer.CommitDocGenHook, including all inherited members.
+|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| __init__ (self, str repo_path, APIClient api_client, llm_client=None, jira_client=None) | |
| dict | get_summary (self, str instruction, bool generate_description) |
| run (self, Optional[str] msg, bool edit_commit_message, bool generate_description) | |
| tuple | process_jira_integration (self, str title, str description, str msg) |
Public Member Functions inherited from penify_hook.base_analyzer.BaseAnalyzer | |
| __init__ (self, str folder_path, APIClient api_client) | |
+Public Attributes | |
| llm_client = llm_client | |
| JiraClient | jira_client = jira_client |
Public Attributes inherited from penify_hook.base_analyzer.BaseAnalyzer | |
| folder_path = folder_path | |
| repo_path = recursive_search_git_folder(folder_path) | |
| repo = None | |
| repo_details = None | |
| relative_file_path = os.path.relpath(folder_path) | |
| api_client = api_client | |
| supported_file_types = set(api_client.get_supported_file_types()) | |
+Protected Member Functions | |
| _amend_commit (self) | |
| penify_hook.commit_analyzer.CommitDocGenHook.__init__ | +( | +self, | +|
| + | + | str | repo_path, | +
| + | + | APIClient | api_client, | +
| + | + | llm_client = None, | +|
| + | + | jira_client = None ) | +
+
|
+ +protected | +
Amends the last commit message in the repository.
| dict penify_hook.commit_analyzer.CommitDocGenHook.get_summary | +( | +self, | +|
| + | + | str | instruction, | +
| + | + | bool | generate_description ) | +
Generate a summary for the commit based on the staged changes. + +This function retrieves the differences of the staged changes in the repository +and generates a commit summary using the provided instruction. If there are no +changes staged for commit, an exception is raised. If a JIRA client is +connected, it will attempt to extract issue keys from the current branch and +use them to fetch context. The summary can be generated either with a Language +Model (LLM) client or through the API client. + +Args: + instruction (str): A string containing instructions for generating the commit summary. + generate_description (bool): Whether to include detailed descriptions in the summary. + +Raises: + ValueError: If there are no changes staged for commit. +
| tuple penify_hook.commit_analyzer.CommitDocGenHook.process_jira_integration | +( | +self, | +|
| + | + | str | title, | +
| + | + | str | description, | +
| + | + | str | msg ) | +
Process JIRA integration by extracting issue keys from commit message +components and branch name. + +This function looks for JIRA issue keys in the provided commit title, +description, original user message, and the active branch name. It uses these +keys to update the commit message with JIRA information and adds comments to +the corresponding JIRA issues. If no keys are found, it logs a warning. + +Args: + title (str): The generated commit title. + description (str): The generated commit description. + msg (str): The original user message that might contain JIRA references. + +Returns: + tuple: A tuple containing the updated commit title and description with included JIRA + information. +
| penify_hook.commit_analyzer.CommitDocGenHook.run | +( | +self, | +|
| + | + | Optional[str] | msg, | +
| + | + | bool | edit_commit_message, | +
| + | + | bool | generate_description ) | +
Run the post-commit hook. + +This method processes the modified files from the last commit, stages them, and +creates an auto-commit with an optional message. It also handles JIRA +integration if available. If there is an error generating the commit summary, +an exception is raised. + +Args: + msg (Optional[str]): An optional message to include in the commit. + edit_commit_message (bool): A flag indicating whether to open the git commit + edit terminal after committing. + generate_description (bool): A flag indicating whether to include a description + in the commit message. +
| JiraClient penify_hook.commit_analyzer.CommitDocGenHook.jira_client = jira_client | +
| penify_hook.commit_analyzer.CommitDocGenHook.llm_client = llm_client | +
|
+ penify-cli
+
+ |
+
This is the complete list of members for penify_hook.file_analyzer.FileAnalyzerGenHook, including all inherited members.
+|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| __init__ (self, str file_path, APIClient api_client) | |
| process_file (self, file_path, pbar, str new_param="") | |
| print_processing (self, file_path) | |
| run (self) | |
Public Member Functions inherited from penify_hook.base_analyzer.BaseAnalyzer | |
| __init__ (self, str folder_path, APIClient api_client) | |
+Public Attributes | |
| file_path = file_path | |
Public Attributes inherited from penify_hook.base_analyzer.BaseAnalyzer | |
| folder_path = folder_path | |
| repo_path = recursive_search_git_folder(folder_path) | |
| repo = None | |
| repo_details = None | |
| relative_file_path = os.path.relpath(folder_path) | |
| api_client = api_client | |
| supported_file_types = set(api_client.get_supported_file_types()) | |
| penify_hook.file_analyzer.FileAnalyzerGenHook.__init__ | +( | +self, | +|
| + | + | str | file_path, | +
| + | + | APIClient | api_client ) | +
| penify_hook.file_analyzer.FileAnalyzerGenHook.print_processing | +( | +self, | +|
| + | + | file_path ) | +
Prints a message indicating that a file is being processed.+
| penify_hook.file_analyzer.FileAnalyzerGenHook.process_file | +( | +self, | +|
| + | + | file_path, | +|
| + | + | pbar, | +|
| + | + | str | new_param = "" ) | +
Processes a file by validating its extension, reading content, +generating documentation, and writing changes back to the file. The function +performs several stages of processing: 1. Validates the file's extension to +ensure it is supported. 2. Reads the content of the file. 3. Sends the file +content for documentation generation. 4. Writes the generated documentation +back to the file if there are changes. + +Args: + file_path (str): The path of the file to be processed. + pbar (tqdm.tqdm): A progress bar object to update the status of processing stages. + new_param (str?): An additional parameter for future use. Defaults to an empty string.
| penify_hook.file_analyzer.FileAnalyzerGenHook.run | +( | +self | ) | ++ |
Runs the documentation process with a progress bar. + +This method orchestrates the documentation process by creating a progress bar, +processing the file, and handling exceptions to ensure the progress bar +completes properly. It updates the progress bar through various stages and +provides feedback based on the result of the file processing. +
| penify_hook.file_analyzer.FileAnalyzerGenHook.file_path = file_path | +
|
+ penify-cli
+
+ |
+
This is the complete list of members for penify_hook.folder_analyzer.FolderAnalyzerGenHook, including all inherited members.
+|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| __init__ (self, str dir_path, APIClient api_client) | |
| list_all_files_in_dir (self, str dir_path) | |
| run (self) | |
Public Member Functions inherited from penify_hook.base_analyzer.BaseAnalyzer | |
| __init__ (self, str folder_path, APIClient api_client) | |
+Public Attributes | |
| dir_path = dir_path | |
Public Attributes inherited from penify_hook.base_analyzer.BaseAnalyzer | |
| folder_path = folder_path | |
| repo_path = recursive_search_git_folder(folder_path) | |
| repo = None | |
| repo_details = None | |
| relative_file_path = os.path.relpath(folder_path) | |
| api_client = api_client | |
| supported_file_types = set(api_client.get_supported_file_types()) | |
| penify_hook.folder_analyzer.FolderAnalyzerGenHook.__init__ | +( | +self, | +|
| + | + | str | dir_path, | +
| + | + | APIClient | api_client ) | +
| penify_hook.folder_analyzer.FolderAnalyzerGenHook.list_all_files_in_dir | +( | +self, | +|
| + | + | str | dir_path ) | +
List all non-hidden files in a directory and its subdirectories. + +This function recursively traverses the specified directory and its +subdirectories, collecting paths of all non-hidden files. It filters out hidden +directories and files (those starting with a dot) to ensure only visible files +are returned. + +Args: + dir_path (str): The path to the directory whose files and subdirectory files need to be listed. +
| penify_hook.folder_analyzer.FolderAnalyzerGenHook.run | +( | +self | ) | ++ |
Run the post-commit hook and process files with a progress bar.
| penify_hook.folder_analyzer.FolderAnalyzerGenHook.dir_path = dir_path | +
|
+ penify-cli
+
+ |
+
This is the complete list of members for penify_hook.git_analyzer.GitDocGenHook, including all inherited members.
+|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| __init__ (self, str repo_path, APIClient api_client) | |
| get_modified_files_in_last_commit (self) | |
| get_modified_lines (self, diff_text) | |
| process_file (self, file_path) | |
| run (self) | |
Public Member Functions inherited from penify_hook.base_analyzer.BaseAnalyzer | |
| __init__ (self, str folder_path, APIClient api_client) | |
+Additional Inherited Members | |
Public Attributes inherited from penify_hook.base_analyzer.BaseAnalyzer | |
| folder_path = folder_path | |
| repo_path = recursive_search_git_folder(folder_path) | |
| repo = None | |
| repo_details = None | |
| relative_file_path = os.path.relpath(folder_path) | |
| api_client = api_client | |
| supported_file_types = set(api_client.get_supported_file_types()) | |
| penify_hook.git_analyzer.GitDocGenHook.__init__ | +( | +self, | +|
| + | + | str | repo_path, | +
| + | + | APIClient | api_client ) | +
| penify_hook.git_analyzer.GitDocGenHook.get_modified_files_in_last_commit | +( | +self | ) | ++ |
Get the list of files modified in the last commit.
| penify_hook.git_analyzer.GitDocGenHook.get_modified_lines | +( | +self, | +|
| + | + | diff_text ) | +
Extract modified line numbers from a diff text. + +This function processes a diff text to identify and extract the line numbers +that have been modified. It distinguishes between added and deleted lines and +keeps track of the current line number as it parses through the diff. The +function handles hunk headers and ensures that any deletions at the end of the +file are also captured. + +Args: + diff_text (str): A string containing the diff text to be processed. ++
| penify_hook.git_analyzer.GitDocGenHook.process_file | +( | +self, | +|
| + | + | file_path ) | +
Processes a file by checking its type, reading its content, and sending it to +an API. + +This method constructs the absolute path of the specified file and verifies if +the file has a valid extension. If the file type is supported, it reads the +content of the file and retrieves the differences from the last commit in the +repository. If changes are detected, it sends the file content along with the +modified lines to an API for further processing. If the API response indicates +no changes, the original file will not be overwritten. + +Args: + file_path (str): The relative path to the file to be processed. +
| penify_hook.git_analyzer.GitDocGenHook.run | +( | +self | ) | ++ |
Run the post-commit hook. + +This method retrieves the list of modified files from the last commit and +processes each file. It stages any files that have been modified during +processing and creates an auto-commit if changes were made. A progress bar is +displayed to indicate the processing status of each file. The method handles +any exceptions that occur during file processing, printing an error message for +each file that fails to process. If any modifications are made to the files, an +auto-commit is created to save those changes. +
|
+ penify-cli
+
+ |
+
This is the complete list of members for penify_hook.jira_client.JiraClient, including all inherited members.
+|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| __init__ (self, str jira_url=None, str jira_user=None, str jira_api_token=None) | |
| bool | is_connected (self) |
| List[str] | extract_issue_keys_from_branch (self, str branch_name) |
| List[str] | extract_issue_keys (self, str text) |
| Optional[Dict[str, Any]] | get_issue_details (self, str issue_key) |
| bool | add_comment (self, str issue_key, str comment) |
| bool | update_issue_status (self, str issue_key, str transition_name) |
| tuple | format_commit_message_with_jira_info (self, str commit_title, str commit_description, List[str] issue_keys=None) |
| Dict[str, Any] | get_detailed_issue_context (self, str issue_key) |
| Dict[str, Any] | get_commit_context_from_issues (self, List[str] issue_keys) |
| tuple | enhance_commit_message (self, str title, str description, List[str] issue_keys) |
+Public Attributes | |
| jira_url = jira_url | |
| jira_user = jira_user | |
| jira_api_token = jira_api_token | |
| jira_client = None | |
Client for interacting with JIRA API +
| penify_hook.jira_client.JiraClient.__init__ | +( | +self, | +|
| + | + | str | jira_url = None, | +
| + | + | str | jira_user = None, | +
| + | + | str | jira_api_token = None ) | +
Initialize the JIRA client. + +Args: + jira_url: Base URL for JIRA instance (e.g., "https://your-domain.atlassian.net") + jira_user: JIRA username or email + jira_api_token: JIRA API token ++
| bool penify_hook.jira_client.JiraClient.add_comment | +( | +self, | +|
| + | + | str | issue_key, | +
| + | + | str | comment ) | +
Adds a comment to a JIRA issue.
| tuple penify_hook.jira_client.JiraClient.enhance_commit_message | +( | +self, | +|
| + | + | str | title, | +
| + | + | str | description, | +
| + | + | List[str] | issue_keys ) | +
Enhance a commit message with business and technical context from JIRA issues. + +This function first checks if the list of issue keys is empty or if there is no +connection. If so, it returns the original title and description without +modification. It then retrieves context information from the specified JIRA +issues. If the primary issue is missing, it formats the commit message with +basic JIRA info. The function enhances the commit title by prefixing it with +the primary issue key if not already included. It appends a business context +section to the description, including details like issue type, status, +priority, sprint, acceptance criteria, and a condensed issue description. If +comments are available, they are added as technical notes. Finally, related +issues are listed. + +Args: + title (str): Original commit title. + description (str): Original commit description. + issue_keys (List[str]): List of JIRA issue keys to include in the enhanced commit message. + +Returns: + tuple: A tuple containing the enhanced commit title and description with added + context from JIRA issues. +
| List[str] penify_hook.jira_client.JiraClient.extract_issue_keys | +( | +self, | +|
| + | + | str | text ) | +
Extract unique JIRA issue keys from the given text.
| List[str] penify_hook.jira_client.JiraClient.extract_issue_keys_from_branch | +( | +self, | +|
| + | + | str | branch_name ) | +
Extracts unique JIRA issue keys from a branch name.+
| tuple penify_hook.jira_client.JiraClient.format_commit_message_with_jira_info | +( | +self, | +|
| + | + | str | commit_title, | +
| + | + | str | commit_description, | +
| + | + | List[str] | issue_keys = None ) | +
Format commit message with JIRA issue information. + +This function updates the provided commit title and description by +incorporating JIRA issue keys. If no issue keys are supplied, it extracts them +from the commit title and description. It then formats the commit title to +include the first issue key if not already present and appends detailed +information about each issue to the commit description. + +Args: + commit_title (str): The original commit title. + commit_description (str): The original commit description. + issue_keys (List[str]?): A list of JIRA issue keys to include in the commit message. If not + provided, issue keys will be extracted from both the title and the description. + +Returns: + tuple: A tuple containing the updated commit title and description with JIRA + information included. +
| Dict[str, Any] penify_hook.jira_client.JiraClient.get_commit_context_from_issues | +( | +self, | +|
| + | + | List[str] | issue_keys ) | +
Gather contextual information from JIRA issues to improve commit messages. + +This function processes a list of JIRA issue keys, retrieves detailed context +for each issue, and aggregates it into a dictionary that can be used to enhance +commit messages. It first retrieves the primary issue (the first key in the +list) and then gathers basic details for any related issues. The resulting +context includes information from both the primary and related issues, along +with all issue keys. + +Args: + issue_keys: List of JIRA issue keys to gather information from + +Returns: + Dict containing business and technical context from the issues +
| Dict[str, Any] penify_hook.jira_client.JiraClient.get_detailed_issue_context | +( | +self, | +|
| + | + | str | issue_key ) | +
Retrieve comprehensive details about a JIRA issue including context for better +commit messages. + +This function fetches detailed information from a specified JIRA issue and +constructs a dictionary containing various context fields such as the issue +summary, description, type, status, priority, comments, URL, and additional +custom fields like acceptance criteria and sprint information. It handles +errors by logging appropriate warnings or errors. + +Args: + issue_key (str): The JIRA issue key (e.g., "PROJECT-123"). + +Returns: + Dict[str, Any]: A dictionary containing business and technical context from the issue. +
| Optional[Dict[str, Any]] penify_hook.jira_client.JiraClient.get_issue_details | +( | +self, | +|
| + | + | str | issue_key ) | +
Retrieve details of a JIRA issue based on its key. + +This function fetches detailed information about a specified JIRA issue using +the provided issue key. It first checks if the JIRA client is connected; if +not, it logs a warning and returns `None`. If connected, it attempts to +retrieve the issue from the JIRA server. On success, it constructs and returns +a dictionary containing various details such as the issue's key, summary, +status, description, assignee, reporter, type, priority, and URL. Errors during +this process are logged, and `None` is returned. + +Args: + issue_key (str): The JIRA issue key (e.g., "PROJECT-123"). +
| bool penify_hook.jira_client.JiraClient.is_connected | +( | +self | ) | ++ |
Check if the JIRA client is connected.
| bool penify_hook.jira_client.JiraClient.update_issue_status | +( | +self, | +|
| + | + | str | issue_key, | +
| + | + | str | transition_name ) | +
Update the status of a JIRA issue. + +This method checks if the JIRA client is connected, retrieves available +transitions for the given issue, finds the transition ID by name, and updates +the issue's status accordingly. If any step fails or the specified transition +is not found, appropriate logs are generated, and False is returned. + +Args: + issue_key (str): The key of the JIRA issue to be updated. + transition_name (str): The name of the desired transition. + +Returns: + bool: True if the status was successfully updated, False otherwise. +
| penify_hook.jira_client.JiraClient.jira_api_token = jira_api_token | +
| penify_hook.jira_client.JiraClient.jira_client = None | +
| penify_hook.jira_client.JiraClient.jira_url = jira_url | +
| penify_hook.jira_client.JiraClient.jira_user = jira_user | +
|
+ penify-cli
+
+ |
+
This is the complete list of members for penify_hook.llm_client.LLMClient, including all inherited members.
+| __init__(self, str model=None, str api_base=None, str api_key=None) | penify_hook.llm_client.LLMClient | |
| _litellm | penify_hook.llm_client.LLMClient | protected |
| generate_commit_summary(self, str diff, str message, bool generate_description, Dict repo_details, Dict jira_context=None) | penify_hook.llm_client.LLMClient | |
| litellm(self) | penify_hook.llm_client.LLMClient | |
| model | penify_hook.llm_client.LLMClient |
|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| __init__ (self, str model=None, str api_base=None, str api_key=None) | |
| litellm (self) | |
| Dict | generate_commit_summary (self, str diff, str message, bool generate_description, Dict repo_details, Dict jira_context=None) |
+Public Attributes | |
| model = model | |
+Protected Attributes | |
| _litellm = None | |
Client for interacting with LLM models using LiteLLM. +
| penify_hook.llm_client.LLMClient.__init__ | +( | +self, | +|
| + | + | str | model = None, | +
| + | + | str | api_base = None, | +
| + | + | str | api_key = None ) | +
Initialize the LLM client. + +Args: + model: LLM model to use (e.g., "gpt-4", "ollama/llama2", etc.) + api_base: Base URL for API requests (e.g., "http://localhost:11434" for Ollama) + api_key: API key for the LLM service ++
| Dict penify_hook.llm_client.LLMClient.generate_commit_summary | +( | +self, | +|
| + | + | str | diff, | +
| + | + | str | message, | +
| + | + | bool | generate_description, | +
| + | + | Dict | repo_details, | +
| + | + | Dict | jira_context = None ) | +
Generate a concise and descriptive commit summary based on Git diff, user +instructions, repository details, and optional JIRA context. + +This function constructs a prompt for an LLM to produce a commit title and, if +requested, a detailed description. The summary adheres to Semantic Commit +Messages guidelines. If JIRA context is provided, it enriches the prompt with +relevant issue information. + +Args: + diff (str): Git diff of changes. + message (str): User-provided commit message or instructions. + generate_description (bool): Flag indicating whether to include a detailed description in the summary. + repo_details (Dict): Details about the repository. + jira_context (Dict?): Optional JIRA issue context to enhance the summary. + +Returns: + Dict: A dictionary containing the title and description for the commit. If + `generate_description` is False, the 'description' key may be absent. + +Raises: + ValueError: If the LLM model is not configured. +
| penify_hook.llm_client.LLMClient.litellm | +( | +self | ) | ++ |
Returns the litellm module, loading it if necessary.
+
|
+ +protected | +
| penify_hook.llm_client.LLMClient.model = model | +
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
This is the complete list of members for tests.test_commit_commands.TestCommitCommands, including all inherited members.
+|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| mock_api_client (self) | |
| mock_llm_client (self) | |
| mock_jira_client (self) | |
| mock_commit_doc_gen (self) | |
| mock_git_folder_search (self) | |
| mock_print_functions (self) | |
| test_commit_code_with_llm_client (self, mock_error, mock_warning, mock_info, mock_git_folder_search, mock_doc_gen, mock_llm_client, mock_api_client) | |
| test_commit_code_with_jira_client (self, mock_error, mock_warning, mock_info, mock_git_folder_search, mock_doc_gen, mock_jira_client, mock_llm_client, mock_api_client) | |
| test_commit_code_with_jira_connection_failure (self, mock_error, mock_warning, mock_info, mock_git_folder_search, mock_doc_gen, mock_jira_client, mock_api_client) | |
| test_commit_code_error_handling (self, mock_print, mock_exit, mock_git_folder_search, mock_doc_gen, mock_api_client) | |
| test_setup_commit_parser (self) | |
| test_handle_commit (self, mock_print_info, mock_commit_code, mock_get_token, mock_get_llm_config, mock_get_jira_config) | |
| tests.test_commit_commands.TestCommitCommands.mock_api_client | +( | +self | ) | ++ |
Mocks an instance of APIClient using unittest.mock. + +This function creates a mock object for APIClient and yields it along +with the mocked instance. It is useful for testing purposes where real +API calls should be avoided. + +Yields: + tuple: A tuple containing the mock of APIClient and the mocked instance of + APIClient. ++
| tests.test_commit_commands.TestCommitCommands.mock_commit_doc_gen | +( | +self | ) | ++ |
Mocks the CommitDocGenHook class and returns a MagicMock instance. + +This function uses the `patch` decorator from the `unittest.mock` module +to create a mock of the `CommitDocGenHook` class. It then sets up this +mock to return a new `MagicMock` instance when invoked. The function +yields both the mock object and the mocked instance, allowing for easy +testing of functions that rely on `CommitDocGenHook`. + +Returns: + tuple: A tuple containing two elements: + - mock (patch): The patch object used to mock the `CommitDocGenHook` + class. + - doc_gen_instance (MagicMock): The mocked instance of + `CommitDocGenHook`. ++
| tests.test_commit_commands.TestCommitCommands.mock_git_folder_search | +( | +self | ) | ++ |
Mock the `recursive_search_git_folder` function to return a predefined +git folder path. + +This function uses the `patch` decorator from the `unittest.mock` module +to intercept calls to `penify_hook.utils.recursive_search_git_folder`. +When called, it will return '/mock/git/folder' instead of performing an +actual search. This is useful for testing purposes where you need a +consistent response without interacting with the file system. + +Yields: + MagicMock: A mock object that simulates the `recursive_search_git_folder` function. ++
| tests.test_commit_commands.TestCommitCommands.mock_jira_client | +( | +self | ) | ++ |
Create a mock JIRA client for testing purposes. + +This function yields a tuple containing a mock JIRA client instance and +its `is_connected` method. The mock client is configured to simulate an +active connection. This is useful for unit tests that require +interaction with a JIRA client without making actual network calls. + +Yields: + tuple: A tuple containing the mocked JIRA client instance and its + `is_connected` method. ++
| tests.test_commit_commands.TestCommitCommands.mock_llm_client | +( | +self | ) | ++ |
Mock an instance of LLMClient for testing purposes. + +This function yields a mock object representing an instance of +LLMClient, which can be used to simulate interactions with a language +model during testing. The mock is patched to replace the actual +LLMClient class from the penify_hook module. + +Yields: + tuple: A tuple containing two elements: + - mock (MagicMock): The mock object for LLMClient. + - llm_client_instance (MagicMock): An instance of the mocked LLMClient. ++
| tests.test_commit_commands.TestCommitCommands.mock_print_functions | +( | +self | ) | ++ |
Mocks the print functions from `penify_hook.ui_utils` for testing +purposes. + +This function uses Python's `unittest.mock.patch` to replace the actual +print functions (`print`, `print_warning`, and `print_error`) with mock +objects. These mock objects can be used in tests to capture calls made +to these print functions without actually printing anything. + +Yields: + tuple: A tuple containing three mock objects corresponding to `print_info`, + `print_warning`, + and `print_error`. ++
| tests.test_commit_commands.TestCommitCommands.test_commit_code_error_handling | +( | +self, | +|
| + | + | mock_print, | +|
| + | + | mock_exit, | +|
| + | + | mock_git_folder_search, | +|
| + | + | mock_doc_gen, | +|
| + | + | mock_api_client ) | +
Test the error handling in the test_commit_code function. + +This function sets up mocks to simulate exceptions and test the error +handling of the commit_code function. It verifies that the function +correctly prints an error message and exits with a status code of 1 when +an exception occurs during documentation generation. + +Args: + mock_print (MagicMock): Mock for the print function, used to verify error message output. + mock_exit (MagicMock): Mock for the sys.exit function, used to verify exit behavior. + mock_git_folder_search (MagicMock): Mock for the git_folder_search function, returning a mock Git folder + path. + mock_doc_gen (MagicMock): Mock for the doc_gen function, simulating an exception during + documentation generation. + mock_api_client (MagicMock): Mock for the API client class, not directly used but referenced in the + function signature. ++
| tests.test_commit_commands.TestCommitCommands.test_commit_code_with_jira_client | +( | +self, | +|
| + | + | mock_error, | +|
| + | + | mock_warning, | +|
| + | + | mock_info, | +|
| + | + | mock_git_folder_search, | +|
| + | + | mock_doc_gen, | +|
| + | + | mock_jira_client, | +|
| + | + | mock_llm_client, | +|
| + | + | mock_api_client ) | +
Test committing code using a JIRA client. + +This function tests the commit_code function with various parameters, +including API and JIRA credentials. It sets up mock objects for +dependencies such as the JIRA client, LLM client, and doc generator to +simulate the behavior of the real classes. The function then calls +commit_code and verifies that the JIRA client and doc generator are +called with the correct parameters. + +Args: + mock_error (MagicMock): A MagicMock object for simulating error logging. + mock_warning (MagicMock): A MagicMock object for simulating warning logging. + mock_info (MagicMock): A MagicMock object for simulating info logging. + mock_git_folder_search (MagicMock): A MagicMock object for simulating the git folder search function. + mock_doc_gen (MagicMock): A MagicMock object for simulating the doc generator function. + mock_jira_client (MagicMock): A MagicMock object for simulating the JIRA client class. + mock_llm_client (MagicMock): A MagicMock object for simulating the LLM client class. + mock_api_client (MagicMock): A MagicMock object for simulating the API client class. ++
| tests.test_commit_commands.TestCommitCommands.test_commit_code_with_jira_connection_failure | +( | +self, | +|
| + | + | mock_error, | +|
| + | + | mock_warning, | +|
| + | + | mock_info, | +|
| + | + | mock_git_folder_search, | +|
| + | + | mock_doc_gen, | +|
| + | + | mock_jira_client, | +|
| + | + | mock_api_client ) | +
Test the commit_code function when JIRA connection fails. + +This function tests the scenario where the JIRA connection fails during +a code commit. It sets up various mocks to simulate different components +of the system and then calls the `commit_code` function with specific +parameters. The function is expected to handle the JIRA connection +failure gracefully by logging an appropriate warning. + +Args: + mock_error (MagicMock): Mock for error logging. + mock_warning (MagicMock): Mock for warning logging. + mock_info (MagicMock): Mock for info logging. + mock_git_folder_search (MagicMock): Mock for searching the Git folder. + mock_doc_gen (MagicMock): Mock for generating documentation. + mock_jira_client (MagicMock): Mock for creating a JIRA client. + mock_api_client (MagicMock): Mock for creating an API client. ++
| tests.test_commit_commands.TestCommitCommands.test_commit_code_with_llm_client | +( | +self, | +|
| + | + | mock_error, | +|
| + | + | mock_warning, | +|
| + | + | mock_info, | +|
| + | + | mock_git_folder_search, | +|
| + | + | mock_doc_gen, | +|
| + | + | mock_llm_client, | +|
| + | + | mock_api_client ) | +
Test committing code using an LLM client. + +This function sets up mock objects for various components and then calls +the `commit_code` function with specified parameters. It verifies that +the correct mocks are created and called with the appropriate arguments. + +Args: + mock_error (MagicMock): Mock object for error handling. + mock_warning (MagicMock): Mock object for warning logging. + mock_info (MagicMock): Mock object for info logging. + mock_git_folder_search (MagicMock): Mock object to simulate git folder search. + mock_doc_gen (MagicMock): Mock object for document generation. + mock_llm_client (MagicMock): Mock object for LLM client interaction. + mock_api_client (MagicMock): Mock object for API client interaction. ++
| tests.test_commit_commands.TestCommitCommands.test_handle_commit | +( | +self, | +|
| + | + | mock_print_info, | +|
| + | + | mock_commit_code, | +|
| + | + | mock_get_token, | +|
| + | + | mock_get_llm_config, | +|
| + | + | mock_get_jira_config ) | +
Test the handle_commit function with various mock objects. + +This function sets up mocks for retrieving LLM configuration, JIRA +configuration, and commit code. It then creates an argument object and +calls the handle_commit function. Finally, it verifies that the mock +functions were called with the expected arguments. + +Args: + mock_print_info (MagicMock): Mock object for printing information. + mock_commit_code (MagicMock): Mock object for committing code. + mock_get_token (MagicMock): Mock object for retrieving API token. + mock_get_llm_config (MagicMock): Mock object for retrieving LLM configuration. + mock_get_jira_config (MagicMock): Mock object for retrieving JIRA configuration. ++
| tests.test_commit_commands.TestCommitCommands.test_setup_commit_parser | +( | +self | ) | ++ |
Set up the argument parser for the commit command. + +This function configures an argument parser to handle various options +for committing changes. It adds three arguments: - '-m' or '--message': +An optional argument to specify a contextual commit message with a +default value of "N/A". - '-e' or '--terminal': A boolean flag to open +an edit terminal before committing. - '-d' or '--description': A boolean +flag that, when set to False, indicates the generation of a commit +message with title and description. + +Args: + parser (MagicMock): The argument parser to be configured. ++
|
+ penify-cli
+
+ |
+
This is the complete list of members for tests.test_config_commands.TestConfigCommands, including all inherited members.
+|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| test_get_penify_config_existing_dir (self, mock_file_open, mock_makedirs, mock_path, mock_git_folder) | |
| test_get_penify_config_new_dir (self, mock_file_open, mock_makedirs, mock_path, mock_git_folder) | |
| test_get_llm_config_exists (self, mock_file_open, mock_get_config) | |
| test_get_llm_config_empty (self, mock_file_open, mock_get_config) | |
| test_get_llm_config_invalid_json (self, mock_print, mock_file_open, mock_get_config) | |
| test_get_jira_config_exists (self, mock_file_open, mock_get_config) | |
| test_save_llm_config_success (self, mock_print, mock_json_dump, mock_file_open, mock_get_config) | |
| test_save_llm_config_failure (self, mock_print, mock_file_open, mock_get_config) | |
| test_save_jira_config_success (self, mock_print, mock_json_dump, mock_file_open, mock_path) | |
| test_get_token_from_env (self, mock_file_open, mock_path, mock_getenv) | |
| test_get_token_from_config (self, mock_file_open, mock_path, mock_getenv) | |
| test_get_token_not_found (self, mock_file_open, mock_path, mock_getenv) | |
| tests.test_config_commands.TestConfigCommands.test_get_jira_config_exists | +( | +self, | +|
| + | + | mock_file_open, | +|
| + | + | mock_get_config ) | +
Test that get_jira_config returns the correct JIRA configuration when +the configuration file exists. + +It sets up a mock for the configuration file to simulate its existence +and verifies that the function reads from the correct file and returns +the expected JIRA configuration dictionary. Additionally, it checks that +the mock file open is called with the appropriate arguments. + +Args: + mock_file_open (MagicMock): A mock for the `open` function. + mock_get_config (MagicMock): A mock for the `get_config` function, which is expected to return a mock + configuration file object. + +Returns: + None: This test function does not explicitly return anything. Its assertions + serve as the verification of its correctness. ++
| tests.test_config_commands.TestConfigCommands.test_get_llm_config_empty | +( | +self, | +|
| + | + | mock_file_open, | +|
| + | + | mock_get_config ) | +
Test the behavior of get_llm_config when called with an empty +configuration file. + +This function sets up a mock configuration file that exists but returns +no content. It then calls the `get_llm_config` function and asserts that +it returns an empty dictionary and that the file open method was called +exactly once with the correct arguments. + +Args: + mock_file_open (MagicMock): A MagicMock object simulating the built-in open function. + mock_get_config (MagicMock): A MagicMock object simulating the get_config function. ++
| tests.test_config_commands.TestConfigCommands.test_get_llm_config_exists | +( | +self, | +|
| + | + | mock_file_open, | +|
| + | + | mock_get_config ) | +
Test the get_llm_config function when the configuration file exists. + +This function sets up a mock configuration file that exists and returns +it when called. It then calls the get_llm_config function and asserts +that it returns the correct configuration dictionary. Additionally, it +checks that the mock_file_open function was called with the correct +arguments. + +Args: + mock_file_open (MagicMock): A mock for the open() function. + mock_get_config (MagicMock): A mock for the get_config() function. ++
| tests.test_config_commands.TestConfigCommands.test_get_llm_config_invalid_json | +( | +self, | +|
| + | + | mock_print, | +|
| + | + | mock_file_open, | +|
| + | + | mock_get_config ) | +
Test function to verify the behavior of get_llm_config when reading an +invalid JSON file. + +It sets up a mock configuration file that exists but contains invalid +JSON. The function is expected to handle this gracefully by printing an +error message and returning an empty dictionary. + +Args: + mock_print (MagicMock): Mock for the print function. + mock_file_open (MagicMock): Mock for the open function. + mock_get_config (MagicMock): Mock for the get_config function, which returns the mock configuration + file. ++
| tests.test_config_commands.TestConfigCommands.test_get_penify_config_existing_dir | +( | +self, | +|
| + | + | mock_file_open, | +|
| + | + | mock_makedirs, | +|
| + | + | mock_path, | +|
| + | + | mock_git_folder ) | +
Test the get_penify_config function when the .penify config directory +exists. + +It should not create a new directory and assert that all mocked +functions were called correctly. + +Args: + mock_file_open (MagicMock): A MagicMock object simulating the open() function. + mock_makedirs (MagicMock): A MagicMock object simulating the os.makedirs() function. + mock_path (MagicMock): A MagicMock object simulating the Path class from pathlib module. + mock_git_folder (MagicMock): A MagicMock object simulating the git_folder_search() function. ++
| tests.test_config_commands.TestConfigCommands.test_get_penify_config_new_dir | +( | +self, | +|
| + | + | mock_file_open, | +|
| + | + | mock_makedirs, | +|
| + | + | mock_path, | +|
| + | + | mock_git_folder ) | +
Test the behavior of get_penify_config when the .penify directory does +not exist. + +This function mocks various system calls to simulate a scenario where +the .penify directory is not present. It then asserts that the +appropriate actions are taken to create the directory and write an empty +JSON file. + +Args: + mock_file_open (MagicMock): A MagicMock object simulating the `open` function. + mock_makedirs (MagicMock): A MagicMock object simulating the `os.makedirs` function. + mock_path (MagicMock): A MagicMock object simulating the `Path` class from `pathlib`. + mock_git_folder (MagicMock): A MagicMock object simulating a git folder search function. ++
| tests.test_config_commands.TestConfigCommands.test_get_token_from_config | +( | +self, | +|
| + | + | mock_file_open, | +|
| + | + | mock_path, | +|
| + | + | mock_getenv ) | +
Test retrieving a token from the configuration. + +This function sets up mocks for environment variables and configuration +files, calls the `get_token` function, and asserts its behavior. It +verifies that when the environment variable is not found, the function +reads a token from a configuration file located in the user's home +directory. + +Args: + mock_file_open (MagicMock): A mock for the `open` function. + mock_path (MagicMock): A mock for the `pathlib.Path` class. + mock_getenv (MagicMock): A mock for the `os.getenv` function. ++
| tests.test_config_commands.TestConfigCommands.test_get_token_from_env | +( | +self, | +|
| + | + | mock_file_open, | +|
| + | + | mock_path, | +|
| + | + | mock_getenv ) | +
Test retrieving a token from the environment variable. + +This function tests the behavior of `get_token` when an environment +variable is set. It verifies that if the 'PENIFY_API_TOKEN' environment +variable exists, the function returns its value without attempting to +read a file. + +Args: + mock_file_open (MagicMock): A MagicMock object for simulating file operations. + mock_path (MagicMock): A MagicMock object for simulating path operations. + mock_getenv (MagicMock): A MagicMock object for simulating environment variable retrieval. ++
| tests.test_config_commands.TestConfigCommands.test_get_token_not_found | +( | +self, | +|
| + | + | mock_file_open, | +|
| + | + | mock_path, | +|
| + | + | mock_getenv ) | +
Test the get_token function when the API token environment variable is +not found. + +This function tests the scenario where the `PENIFY_API_TOKEN` +environment variable is not set. It mocks the environment variable to +return `None`, and verifies that the function returns `None`. The test +also checks that the environment variable is accessed once and that a +file open operation is attempted on a configuration file located in the +user's home directory. + +Args: + mock_file_open (MagicMock): Mock for the built-in `open` function. + mock_path (MagicMock): Mock for the `pathlib.Path` module. + mock_getenv (MagicMock): Mock for the `os.getenv` function. + +Returns: + None: The function does not return anything; it asserts conditions to verify + correctness. ++
| tests.test_config_commands.TestConfigCommands.test_save_jira_config_success | +( | +self, | +|
| + | + | mock_print, | +|
| + | + | mock_json_dump, | +|
| + | + | mock_file_open, | +|
| + | + | mock_path ) | +
Test the save_jira_config function to ensure it saves JIRA configuration +successfully. + +This function sets up mocks for various dependencies and tests the +functionality of saving a JIRA configuration. It asserts that the +function returns `True`, the JSON dump is called with the correct +configuration, and the print statement contains the expected message. + +Args: + mock_print (MagicMock): Mock for the print function. + mock_json_dump (MagicMock): Mock for the json.dump function. + mock_file_open (MagicMock): Mock for the open function. + mock_path (MagicMock): Mock for the path module. ++
| tests.test_config_commands.TestConfigCommands.test_save_llm_config_failure | +( | +self, | +|
| + | + | mock_print, | +|
| + | + | mock_file_open, | +|
| + | + | mock_get_config ) | +
Test function to verify that the save_llm_config function returns False +and prints an error message when it fails to save the LLM configuration +due to a permission error. + +It sets up a mock configuration file that exists and calls the +save_llm_config function with valid parameters. The function is expected +to return False and print "Error saving LLM configuration: Permission +denied" in case of a failure. + +Args: + self (TestLLMConfig): An instance of the test class. + mock_print (MagicMock): A MagicMock object representing the print function, which will be used + to assert that it was called with the expected error message. + mock_file_open (MagicMock): A MagicMock object representing the open function, which is not used in + this test but is included as a parameter for completeness. + mock_get_config (MagicMock): A MagicMock object representing the get_config function, which will be + used to return the mock configuration file. ++
| tests.test_config_commands.TestConfigCommands.test_save_llm_config_success | +( | +self, | +|
| + | + | mock_print, | +|
| + | + | mock_json_dump, | +|
| + | + | mock_file_open, | +|
| + | + | mock_get_config ) | +
Test the save_llm_config function successfully. + +This function tests that the save_llm_config function correctly saves an +LLM configuration and handles various mock objects and side effects. It +ensures that the function returns True upon successful execution, writes +the expected configuration to a file, and prints a confirmation message. + +Args: + mock_print (MagicMock): A mock object for the print function. + mock_json_dump (MagicMock): A mock object for json.dump. + mock_file_open (MagicMock): A mock object for file opening. + mock_get_config (MagicMock): A mock object to return a configuration file mock. ++
|
+ penify-cli
+
+ |
+
This is the complete list of members for tests.test_web_config.TestWebConfig, including all inherited members.
+| test_config_jira_web_server_setup(self, mock_resource_filename, mock_server, mock_webbrowser) | tests.test_web_config.TestWebConfig | |
| test_config_llm_web_server_setup(self, mock_resource_filename, mock_server, mock_webbrowser) | tests.test_web_config.TestWebConfig |
|
+ penify-cli
+
+ |
+
+Public Member Functions | |
| test_config_llm_web_server_setup (self, mock_resource_filename, mock_server, mock_webbrowser) | |
| test_config_jira_web_server_setup (self, mock_resource_filename, mock_server, mock_webbrowser) | |
| tests.test_web_config.TestWebConfig.test_config_jira_web_server_setup | +( | +self, | +|
| + | + | mock_resource_filename, | +|
| + | + | mock_server, | +|
| + | + | mock_webbrowser ) | +
Test the configuration and setup of a JIRA web server. + +This function tests the entire process of setting up a JIRA web server, +including mocking necessary resources, configuring the server to shut +down after handling one request, and verifying that the web browser is +opened with the correct URL. The function uses several mocks to simulate +external dependencies such as resource files, servers, and web browsers. + +Args: + mock_resource_filename (MagicMock): A MagicMock object for simulating the `resource_filename` function. + mock_server (MagicMock): A MagicMock object for simulating the server setup. + mock_webbrowser (MagicMock): A MagicMock object for simulating the web browser opening. ++
| tests.test_web_config.TestWebConfig.test_config_llm_web_server_setup | +( | +self, | +|
| + | + | mock_resource_filename, | +|
| + | + | mock_server, | +|
| + | + | mock_webbrowser ) | +
Set up and test the web server configuration for an LLM (Large Language +Model) web interface. + +This function configures a mock web server for testing purposes, +including setting up resource filenames, mocking server behavior, and +verifying that the web browser is opened and the server starts +correctly. The function uses various mocks to simulate external +dependencies such as `resource_filename` and `server`. + +Args: + mock_resource_filename (MagicMock): A MagicMock object simulating the `resource_filename` function. + mock_server (MagicMock): A MagicMock object simulating the context manager for the web server. + mock_webbrowser (MagicMock): A MagicMock object simulating the `webbrowser` module. ++
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Classes | |
| class | penify_hook.commit_analyzer.CommitDocGenHook |
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.commit_analyzer |
|
+ penify-cli
+
+ |
+
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.commands |
| namespace | penify_hook.commands.commit_commands |
+Functions | |
| penify_hook.commands.commit_commands.commit_code (api_url, token, message, open_terminal, generate_description, llm_model=None, llm_api_base=None, llm_api_key=None, jira_url=None, jira_user=None, jira_api_token=None) | |
| penify_hook.commands.commit_commands.setup_commit_parser (parser) | |
| penify_hook.commands.commit_commands.handle_commit (args) | |
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.config_command |
+Functions | |
| penify_hook.config_command.setup_config_parser (parent_parser) | |
| penify_hook.config_command.handle_config (args) | |
|
+ penify-cli
+
+ |
+
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.commands |
| namespace | penify_hook.commands.config_commands |
+Functions | |
| None | penify_hook.commands.config_commands.load_env_files () |
| Path | penify_hook.commands.config_commands.get_penify_config () |
| Any | penify_hook.commands.config_commands.get_env_var_or_default (str env_var, Any default=None) |
| penify_hook.commands.config_commands.save_llm_config (model, api_base, api_key) | |
| penify_hook.commands.config_commands.save_jira_config (url, username, api_token) | |
| Dict[str, str] | penify_hook.commands.config_commands.get_llm_config () |
| Dict[str, str] | penify_hook.commands.config_commands.get_jira_config () |
| penify_hook.commands.config_commands.config_llm_web () | |
| penify_hook.commands.config_commands.config_jira_web () | |
| Optional[str] | penify_hook.commands.config_commands.get_token () |
+Variables | |
| bool | penify_hook.commands.config_commands.DOTENV_AVAILABLE = True |
| str | penify_hook.commands.config_commands.path = "/": |
|
+ penify-cli
+
+ |
+
+Namespaces | |
| namespace | tests |
| namespace | tests.conftest |
|
+ penify-cli
+
+ |
+
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.constants |
+Variables | |
| str | penify_hook.constants.API_URL = 'http://localhost:8000/api' |
| str | penify_hook.constants.DASHBOARD_URL = "https://dashboard.penify.dev/auth/localhost/login" |
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Files | |
| __init__.py | |
| conftest.py | |
| test_commit_commands.py | |
| test_config_commands.py | |
| test_doc_commands.py | |
| test_web_config.py | |
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Files | |
| __init__.py | |
| auth_commands.py | |
| commit_commands.py | |
| config_commands.py | |
| doc_commands.py | |
| hook_commands.py | |
|
+ penify-cli
+
+ |
+
+Directories | |
| docs | |
| penify_hook | |
| tests | |
+Files | |
| setup.py | |
A CLI tool to generate smart commit messages, code documentation, and more.
+Install from PyPI:
+Penify CLI provides several subcommands for different functionalities, organized into basic commands (no login required) and advanced commands (login required).
+Generate smart commit messages using local LLM:
+Options:
-m, --message: Optional custom commit message-e, --terminal: Open editor to modify commit message before committing-d, --description: Generate commit message with both title and description (without this flag, only title is generated)Configure local LLM and JIRA settings:
+To log in and obtain an API token:
+This command will open a browser window for authentication. After successful login, the API key will be saved locally for future use.
+Generate documentation for Git diff, files or folders:
+Options:
-l, --location: Path to specific file or folder for documentation generation (defaults to current directory)Install or uninstall Git post-commit hooks:
+Options:
-l, --location: Path to the Git repository (defaults to current directory)Penify CLI uses an API token for authentication with advanced features.
+If no token is available and you try to access an advanced feature, you'll be prompted to log in.
+For commit message generation, Penify can use a local LLM. Configure it using:
+Common configurations:
--model gpt-3.5-turbo --api-base https://api.openai.com/v1 --api-key YOUR_KEY--model claude-2 --api-base https://api.anthropic.com --api-key YOUR_KEYConfigure JIRA integration to enhance commit messages with issue details:
+To set up the development environment:
+This project is licensed under the MIT License.
+Suman Saurabh (ss.su.nosp@m.mans.nosp@m.aurab.nosp@m.h92@.nosp@m.gmail.nosp@m..com)
+Contributions are welcome! Please feel free to submit a Pull Request.
+If you encounter any problems or have suggestions, please file an issue on the GitHub repository.
+For automated API Documentation, Architecture Documentation, Code Documentation, Pull Request Documentation, or if you need a demo, please join our Discord support channel.
+|
+ penify-cli
+
+ |
+
+Directories | |
| commands | |
+Files | |
| __init__.py | |
| api_client.py | |
| base_analyzer.py | |
| commit_analyzer.py | |
| config_command.py | |
| constants.py | |
| file_analyzer.py | |
| folder_analyzer.py | |
| git_analyzer.py | |
| jira_client.py | |
| llm_client.py | |
| login_command.py | |
| main.py | |
| ui_utils.py | |
| utils.py | |
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.commands |
| namespace | penify_hook.commands.doc_commands |
+Functions | |
| penify_hook.commands.doc_commands.generate_doc (api_url, token, location=None) | |
| penify_hook.commands.doc_commands.setup_docgen_parser (parser) | |
| penify_hook.commands.doc_commands.handle_docgen (args) | |
+Variables | |
| str | penify_hook.commands.doc_commands.docgen_description |
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Classes | |
| class | penify_hook.file_analyzer.FileAnalyzerGenHook |
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.file_analyzer |
+Variables | |
| penify_hook.file_analyzer.logger = logging.getLogger(__name__) | |
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Classes | |
| class | penify_hook.folder_analyzer.FolderAnalyzerGenHook |
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.folder_analyzer |
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Classes | |
| class | penify_hook.git_analyzer.GitDocGenHook |
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.git_analyzer |
+Variables | |
| penify_hook.git_analyzer.logger = logging.getLogger(__name__) | |
|
+ penify-cli
+
+ |
+
This page explains how to interpret the graphs that are generated by doxygen.
+Consider the following example:
This will result in the following graph:
+The boxes in the above graph have the following meaning:
+The arrows have the following meaning:
+|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.commands |
| namespace | penify_hook.commands.hook_commands |
+Functions | |
| penify_hook.commands.hook_commands.install_git_hook (location, token) | |
| penify_hook.commands.hook_commands.uninstall_git_hook (location) | |
+Variables | |
| str | penify_hook.commands.hook_commands.HOOK_FILENAME = "post-commit" |
| str | penify_hook.commands.hook_commands.HOOK_TEMPLATE |
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
|
+ penify-cli
+
+ |
+
+Classes | |
| class | penify_hook.jira_client.JiraClient |
+Namespaces | |
| namespace | penify_hook |
| namespace | penify_hook.jira_client |
+Variables | |
| bool | penify_hook.jira_client.JIRA_AVAILABLE = True |