- Improve header detection by stripping bolding and cleaning labels like "1. Title:", "### Message:", etc.
- Stop processing lines when encountering a sponsor section
```
- Simplify and clarify the structure of commit message generation guidelines.
- Replace "Format" with "Guidelines" for better readability.
- Remove redundant section numbering.
- Streamline emoji usage instruction into a single line.
- Clarify that the output should exclude labels like "Title:" or "Format:".
**Enhancements:**
- Improved template structure for better maintainability.
- More concise and direct instructions for users.
The `sanitize_ai_commit_message` function in `devgen/utils.py` has been enhanced for better readability and maintainability. The changes include minor formatting improvements and a more consistent regex pattern definition.
**Enhancements & Refinements:**
- Improved code formatting by removing trailing whitespace and adding a comma after `re.IGNORECASE` in the regex pattern for better readability.
- Enhanced comment clarity by fixing a minor typo in the regex examples section.
```
This update introduces improvements to the changelog generator's file handling logic, including proper prepending of new entries and automatic header management. It also refines the license generator's template directory structure and cleans up minor formatting issues in the commit generator.
**New Features**
- Added intelligent changelog prepending logic that preserves existing headers and maintains proper formatting when updating files
- Implemented automatic `# CHANGELOG` header insertion for new changelog files
**Enhancements & Refinements**
- Changed changelog version headers from `#` to `##` for better markdown hierarchy
- Updated license generator to use `templates/licenses` directory instead of `prompt_templates/licenses`
- Removed unnecessary whitespace and improved code formatting in commit generator
- Enhanced changelog file writing logic to handle both new and existing files more robustly
```
The `sanitize_ai_commit_message` function has been significantly improved to better handle AI-generated commit messages, including support for bolded headers, more robust header detection, and a fallback mechanism for non-conventional messages.
**Enhancements & Refinements:**
- Added comprehensive docstring explaining the function's purpose and behavior
- Improved regex pattern to match conventional commit headers with optional bolding (e.g., **feat: ...**)
- Added case-insensitive matching for commit types
- Implemented a state-based approach with `found_header` flag for clearer logic
- Added automatic removal of bold markers (**) from headers
- Introduced fallback behavior to return the first non-empty line if no conventional header is found
- Improved code structure with better variable naming and comments
- Added early return for empty input strings
**Bug Fixes:**
- Fixed potential issue where the function could return empty strings for non-conventional messages
- Resolved edge case handling for messages without proper headers
```
The debug argument is used internally by devgen but is not accepted by the OpenAI API client. This change filters it out from kwargs before the API call to prevent TypeError.
**Enhancements & Refinements**
* Dry run commit messages are now displayed directly on the console during execution.
* Utilizes rich `Panel` and `Markdown` to provide a structured and readable console output for dry run messages.
* Offers immediate visual feedback for generated commits when performing a dry run.
This commit introduces a new `run_git_command` utility function within `devgen.utils` to centralize and standardize the execution of Git commands. This improves code reusability and error handling for Git-related operations.
* **New Features**
* Add `run_git_command` to `devgen/utils.py` to provide a standardized, robust way to execute Git commands, capture output, and handle errors.
* Expose `run_git_command` in `__all__` for public use.
* **Enhancements & Refinements**
* Refactor `get_git_staged_files` to utilize the new `run_git_command` utility, reducing code duplication and improving consistency.
This commit refactors the way git commands are executed across the `changelog_generator` and `commit_generator` modules, leveraging a shared utility function and enhancing error handling.
* **Enhancements & Refinements**
* Replaced the internal `_exec_git` method in both `ChangelogGenerator` and `CommitEngine` with the common `run_git_command` utility from `devgen.utils`.
* Standardized and improved error handling for git command failures by wrapping `run_git_command` calls in `try-except subprocess.CalledProcessError` blocks, providing more precise logging and raising `CommitEngineError` where applicable.
* Adjusted error handling for `git reset HEAD` operations to gracefully ignore potential failures, ensuring smoother execution for non-critical resets.
* Refined the `is_ahead_of_remote` check in `CommitEngine` to correctly handle scenarios with no upstream configured by using `check=False` for `run_git_command` and broadening error catch.
Minor code cleanup to enhance readability and adhere to styling conventions.
* **Enhancements & Refinements**:
* Wrapped long lines for better readability in logger configuration, console theme definition, commit message panel printing, and dry run output.
* Removed an unnecessary f-string from the commit generation status message.
The commit engine now leverages the `rich` library to provide a more visually appealing and informative console experience during various stages of the commit generation and execution process.
* **New Features**
* Integrate the `rich` library for enhanced and structured console output.
* Introduce a custom `rich` theme for consistent styling of info, warning, and danger messages.
* **Enhancements & Refinements**
* Display visual feedback with `rich` status spinners during AI message generation and remote push operations.
* Present generated commit messages in a formatted `rich` Panel with Markdown rendering for improved readability.
* Provide clearer, color-coded `rich` console messages for staging files, dry run completion, overall process completion, and identifying failed groups.
* Propagate the `debug` flag to the logger to control console output during debugging sessions, aligning logger and console behavior.
The commit engine now leverages the `rich` library to provide a more visually appealing and informative console experience during various stages of the commit generation and execution process.
* **New Features**
* Integrate the `rich` library for enhanced and structured console output.
* Introduce a custom `rich` theme for consistent styling of info, warning, and danger messages.
* **Enhancements & Refinements**
* Display visual feedback with `rich` status spinners during AI message generation and remote push operations.
* Present generated commit messages in a formatted `rich` Panel with Markdown rendering for improved readability.
* Provide clearer, color-coded `rich` console messages for staging files, dry run completion, overall process completion, and identifying failed groups.
* Propagate the `debug` flag to the logger to control console output during debugging sessions, aligning logger and console behavior.
Release v0.2.1 of DevGen CLI, a comprehensive toolkit automating common Git and project management tasks through AI. This initial packaging defines the project's metadata and a wide array of developer-centric features.
* **New Features**
* **AI-Powered Commit Messages:** Automatically generate semantic commit messages based on staged changes, adhering to Conventional Commits format.
* **Changelog Generation:** Create detailed changelogs from Git history, with categories for BREAKING CHANGES, Features, Bug Fixes, Documentation, and Other Changes.
* **Release Note Generation:** Produce structured release notes from Git history, ready for publication.
* **Gitignore File Generation:** Generate `.gitignore` files by selecting from GitHub's official templates, supporting interactive selection, multiple templates, and offline mode.
* **License File Generation:** Interactively generate various open-source license files (e.g., MIT, Apache-2.0, GPL-3.0), customizable with author name and year.
* **Multi-Provider AI Support:** Seamless integration with leading AI providers including Gemini, OpenAI, Anthropic, HuggingFace, and OpenRouter.
* **Enhancements & Refinements**
* **Unified CLI:** Provides a single command-line interface for all development automation tools.
* **Interactive Configuration:** Simple setup process for AI providers, models, and API keys via `devgen setup config`, stored persistently in `~/.devgen.yaml`.
* **Flexible Commit Workflow:** Offers options for dry runs, direct commits, automatic pushes, and force rebuilding of AI-generated commit messages.
* **Commit Caching:** Includes commands to list and clear cached commit messages for improved workflow.
* **Detailed Command Reference:** Comprehensive documentation for all `devgen` commands and their specific options.
* **Project Metadata:** Updated `PKG-INFO` with project summary, homepage, author details, license, keywords, classifiers, and Python requirements.
* **Dependency Management:** Specifies required Python packages including `anthropic`, `google-generativeai`, `openai`, `typer`, and `rich`.
* **Python 3.10+ Compatibility:** Ensures support for modern Python environments.