refactor(changelog): improve changelog generation and formatting logic

This commit is contained in:
sankalp committed 2025-08-25 15:55:28 +05:45
1 parent 048f970db5
commit 3f342af07d
4 files changed
+90 -56

No files matched your search

+33 -36
View File
@@ -2,54 +2,51 @@
## v0.1.1
# Changelog
✨ Added
- ✨ Added pyproject.toml for PEP 517/518 build support.
- ✨ Added `--no-verify` option to bypass git hooks during commit.
- ✨ Added per-file commit generation option.
- ✨ Added git hooks management and auto-fix on pre-commit.
- ✨ Added git hooks management CLI.
- ✨ Added emoji option to CLI and config to control emoji prefixes.
- Added pyproject.toml for PEP 517/518 build support and update installation instructions
- Added initial todo list for project improvements
- Added `--no-verify` option to bypass git hooks during commit
- Added per-file commit generation option
- Added git hooks management and auto-fix on pre-commit
- Added git hooks management CLI
- Added emoji option to CLI and config to control emoji prefixes
🔄 Changed
- 🔄 Replaced ruff linter with black.
- Improved installation instructions and package metadata for PyPI release
- Updated README with new features, aliases, and configuration details
- Improved emoji handling and sanitization in commit message generation
- Improved changelog generation and sanitization of AI output
- Improved changelog generation to handle existing files and duplicate headers
- Replaced ruff linter with black
🐛 Fixed
- 🐛 Removed duplicate changelog entries.
- Removed duplicate changelog entries
🚀 Performance
📝 Documentation
- 📝 Added initial todo list for project improvements.
- 📝 Updated README with new features, aliases, and configuration details.
- 📝 Recommended installation using pipx and uv.
🔧 Maintenance
- 🔧 Improved installation instructions and package metadata for PyPI release.
Refactor
- 🔄 Improved emoji handling and sanitization in commit message generation.
- 🔄 Improved changelog generation and sanitization of AI output.
- 🔄 Improved changelog generation to handle existing files and duplicate headers.
📚 Documentation
- Recommended installation using pipx and uv
## v0.1.0
✨ Added
- Updated changelog format and added ChangelogGenerator class documentation 📚
- Updated `README.md` file with the new commit message format and ChangelogGenerator class usage 📝
- ✨ docs(changelog): Add ChangelogGenerator class documentation
- 🐛 docs(changelog): Updated changelog format and added ChangelogGenerator class documentation
- Updated changelog format and added ChangelogGenerator class documentation
- Updated `README.md` file with the new commit message format and ChangelogGenerator class usage
- docs(changelog): Add ChangelogGenerator class documentation
- docs(changelog): Updated changelog format and added ChangelogGenerator class documentation
🔄 Changed
- Changes for version 0.1.0:
- Updated commit message and changelog generation using AI 👨‍💻
- Updated `GitService` to return exit code from `_run_git_command` and improved `get_commit_history` method signature and docstring 📝
- Updated changelog format for clarity and consistency 📚
- Updated `LICENSE` 📄
- 🔄 refactor(generator): Update commit message and changelog generation using AI
- 🔄 refactor(devtools/shared/git.py): Update GitService to return exit code from `_run_git_command` and improve `get_commit_history` method signature and docstring
- 🔄 docs(changelog): Updated changelog format for clarity and consistency
- 📚 Update `README.md` file
- 📚 Update `LICENSE`
- Updated commit message and changelog generation using AI
- Updated `GitService` to return exit code from `_run_git_command` and improved `get_commit_history` method signature and docstring
- Updated changelog format for clarity and consistency
- Updated `LICENSE`
- refactor(generator): Update commit message and changelog generation using AI
- refactor(devtools/shared/git.py): Update GitService to return exit code from `_run_git_command` and improve `get_commit_history` method signature and docstring
- docs(changelog): Updated changelog format for clarity and consistency
- Update `README.md` file
- Update `LICENSE`
🗑️ Removed
- Removed unused variable in `_run_git_command` calls 🗑️
- Removed unused variable in `_run_git_command` calls
+8 -3
View File
@@ -72,7 +72,7 @@ class ChangelogGenerator(AIService):
2. Keep descriptions concise but informative
3. Use past tense
4. Start each entry with a verb
5. Use emojis for each type:
5. Use emojis ONLY in section headers, not in bullet items:
- ✨ Added
- 🔄 Changed
- 🐛 Fixed
@@ -81,8 +81,9 @@ class ChangelogGenerator(AIService):
- 🔧 Maintenance
- 🗑️ Removed
- 🔒 Security
6. Only include PR references if they exist in the original commit message
7. Keep the changelog clean and professional"""
6. Do NOT prefix individual bullet points with emojis. Bullets should start with a dash and text.
7. Only include PR references if they exist in the original commit message
8. Keep the changelog clean and professional"""
# Format changes for the prompt, preserving PR references
changes_text = "\n".join(f"{change['message']}" for change in changes)
@@ -108,9 +109,13 @@ class ChangelogGenerator(AIService):
normalized_version = version.lstrip("vV")
inner_header_pattern = rf"^##\s+v?{re.escape(normalized_version)}\s*$"
lines = []
emoji_prefix_pattern = r"^\-\s*[✨🔄🐛🚀📝🔧🗑️🔒]\s+"
for line in cleaned.splitlines():
if re.match(inner_header_pattern, line.strip()):
continue
# Strip emojis from bullet items while keeping header emojis
if re.match(emoji_prefix_pattern, line):
line = re.sub(emoji_prefix_pattern, "- ", line)
lines.append(line)
return "\n".join(lines).strip()
+48 -17
View File
@@ -4,7 +4,10 @@ Version: 0.1.0
Summary: A collection of developer tools
Home-page: https://github.com/S4NKALP/DevTools
Author: Sankalp Tharu
Author-email: sankalptharu50028@gmail.com
Author-email: Sankalp Tharu <sankalptharu50028@gmail.com>
License: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/S4NKALP/DevTools
Keywords: devtools,cli,git,changelog,gitignore,license
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
@@ -22,15 +25,9 @@ Requires-Dist: rich>=10.0.0
Requires-Dist: requests>=2.25.0
Requires-Dist: pyyaml>=5.0.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary
# DevTools
@@ -39,15 +36,22 @@ A collection of developer tools to enhance your workflow. This package includes
## Installation
```bash
# Clone the repository
$ git clone https://github.com/S4NKALP/DevTools.git
$ cd DevTools
# Stable release from PyPI
pip install devtools-utils
# Install in editable mode
$ pipx install .
# Using pipx (recommended for isolated CLI)
pipx install devtools-utils
# Using Uv
$ uv tool install .
# Using uv (fast Python package manager)
uv tool install devtools-utils
```
Arch Linux prerequisites (for pipx/uv):
```bash
sudo pacman -S --needed python python-pip python-pipx git
# optional: uv via pipx
pipx install uv
```
## Configuration
@@ -487,14 +491,41 @@ python3 scripts/lintfix.py
## Development
```bash
# Install dependencies
pip install -r requirements.txt
# Clone the repository
git clone https://github.com/S4NKALP/DevTools.git
cd DevTools
# (Optional) Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install package in editable (dev) mode
pip install -e .
# Install dev tools (optional but recommended)
pip install pytest black ruff
# Run tests
pytest
# Lint
# Lint and format
black .
# Or use the helper scripts (if present)
python3 scripts/format.py
python3 scripts/lintfix.py
# Run the CLI locally after editable install
devtools --help
```
Build from source (PEP 517):
```bash
# Requires pyproject.toml
python -m build
# or with uv
uv build
```
## Contributing
+1
View File
@@ -1,5 +1,6 @@
LICENSE
README.md
pyproject.toml
setup.py
devtools/__init__.py
devtools/cli.py