From 286c46d2b58acd61636401a04c37007b6688c90d Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 25 Dec 2025 00:04:44 +0545 Subject: [PATCH] feat(root): enhance commit generation with context-aware features - Add shell completion support for bash/zsh/fish via `devgen --install-completion` - Introduce `devgen commit undo` to revert the last AI-generated commit while preserving staged changes - Implement context-aware commit generation by analyzing project manifests (`package.json`, `pyproject.toml`, etc.) and lock files for accurate dependency updates - Add support for custom Jinja2 templates in `~/.devgen.yaml` with `custom_template` configuration - Update documentation to reflect new features and provide template variable reference This release significantly improves commit accuracy by leveraging project context and offers greater customization through templates and shell integration. ``` --- README.md | 32 ++++++++++++++++++++++++++++++-- TODO.md | 4 ++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8585275..adc7cd6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ ## ⚡ Why DevGen? **🧠 AI Brain** -Semantic commit messages powered by Gemini, OpenAI, Claude, HuggingFace, and OpenRouter. It reads your diffs and understands your code. +Semantic, context-aware commit messages powered by Gemini, OpenAI, Claude, HuggingFace, and OpenRouter. It reads your diffs, identifies project manifests, and understands your code. **🚀 Battle Tested** Generates **Conventional Commits** and **Semantic Versioning** compliant changelogs that actually make sense. @@ -47,6 +47,9 @@ uv tool install devgen-cli # Standard pip install pip install devgen-cli + +# Enable Shell Completion (bash/zsh/fish) +devgen --install-completion ``` ## 🚀 Quick Start @@ -80,8 +83,18 @@ devgen commit run --dry-run # Commit and push in one go devgen commit run --push + +# Made a mistake? Undo the last AI commit and keep changes staged +devgen commit undo ``` +### 🧠 Context Awareness +DevGen isn't just looking at the code changes; it's looking at the big picture. It automatically detects and analyzes: +- **Manifests**: `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, etc. +- **Lock Files**: `uv.lock`, `package-lock.json`, `poetry.lock`, etc. + +This allows the AI to understand *exactly* which library versions were updated, leading to hyper-accurate dependency commit messages. + ### 📝 Changelogs & Release Notes Turn your git history into beautiful, readable documentation. @@ -114,7 +127,22 @@ Your settings live in `~/.devgen.yaml`. You can tweak your AI provider, model, a | :--------- | :----------------------------------------------------------- | | `provider` | `gemini`, `openai`, `anthropic`, `huggingface`, `openrouter` | | `model` | Specific model name (e.g., `gemini-2.5-flash`, `gpt-4o`) | -| `emoji` | Enable/disable gitmojis in commits (`true`/`false`) | +| `emoji` | Enable/disable gitmojis in commits (`true`/`false`) | +| `custom_template` | Custom Jinja2 template for commit messages. | + +### 🎨 Custom Templates +You can define your own commit message structure in `~/.devgen.yaml`. Use `devgen config info` to see available variables like `{{ group_name }}`, `{{ diff_text }}`, and `{{ context }}`. + +Example: +```yaml +custom_template: | + {{ group_name }}: {{ diff_text }} + --- + Manifests: {{ context }} +``` + +> [!TIP] +> Use `devgen config info` to see a full list of available variables and a template tip! ## 🤝 Contributing diff --git a/TODO.md b/TODO.md index 309882b..0e71222 100644 --- a/TODO.md +++ b/TODO.md @@ -9,8 +9,8 @@ This document outlines future improvements, features, and technical debt for `de - [ ] **Improved Gitignore Detection**: Auto-detect project type (Python, Node, Go) and suggest relevant `.gitignore` templates during `devgen gitignore run`. ## 🤖 AI & Intelligence -- [ ] **Custom Prompts**: Allow users to define their own Jinja2 templates for commits in the config file. -- [ ] **Context-Aware Commits**: Send the manifest file (`package.json`, `pyproject.toml`) to the AI to provide better context for dependency changes. +- [x] **Custom Prompts**: Allow users to define their own Jinja2 templates for commits in the config file(~/.devgen.yaml). +- [x] **Context-Aware Commits**: Send the manifest file (`package.json`, `pyproject.toml`) to the AI to provide better context for dependency changes. - [ ] **Token Usage Dashboard**: Add a `devgen config tokens` command to estimate or track AI token consumption. - [ ] **More Providers**: Add support for **Mistral**, **Cohere**, and **Groq** for faster/cheaper generations.