Commit Graph
61 Commits
Author SHA1 Message Date
sankalp 261d04c56f refactor(devgen/providers): centralize retry and quota handling in BaseProvider
Move retry logic and quota detection from provider-specific code to BaseProvider to reduce duplication and simplify error handling.
2026-07-03 18:07:43 +05:45
sankalp f7001d4243 feat(devgen/modules): streamline provider guard and enhance ManifestInspector flexibility
Add token‑limit error handling and switch git diff to null‑delimited output for reliable file detection.
2026-07-03 18:07:26 +05:45
sankalp 11a9db7986 feat(devgen): extend header regex to include deps and wip scopes and ignore markdown fences
Prevent false positives on markdown fences and enable parsing of dependency-related commit types.
2026-07-03 17:02:18 +05:45
sankalp 34f5d090ce chore(devgen): extend commit message regex to include perf and revert
Update the regex in devgen/utils.py to recognize `perf` and `revert` as valid Conventional Commit types, ensuring alignment with the specification and preventing false negatives in automated analysis.
2026-07-03 16:46:05 +05:45
sankalp d20a31bf38 feat(devgen/templates/commit): update commit_message.tpl with expanded conventional commit format
Add detailed format description, examples, and diff handling to improve commit message clarity.
2026-07-03 16:45:47 +05:45
sankalp c4992cce57 formating 2026-06-16 15:05:07 +05:45
sankalp 957dda9d49 refactor: remove jinja2 dependency, use simple template engine
- Replace jinja2 with custom render_template() helper
- Support {{ var }} substitution and {% if %}...{% endif %} conditionals
- Remove jinja2 from pyproject.toml and requirements.txt
- Simplifies dependency tree and reduces install size
2026-06-16 14:58:25 +05:45
sankalp 869aa37f0c update 2026-06-16 14:45:55 +05:45
sankalp 51ede1a7da fix: address 7 security and reliability issues
- Prevent path traversal in gitignore template names (Critical)
- Fix TOCTOU races in file operations with try/except pattern (High)
- Add timeout to HuggingFace API requests (Medium)
- Add missing %x00 separator in changelog fallback format (Medium)
- Filter unsanitized kwargs before passing to OpenAI SDK (High)
- Use context managers for proper client cleanup in providers (High)
- Exit with non-zero code on commit engine failure (Low)
2026-06-16 14:43:52 +05:45
sankalp ede489c219 fix: resolve 8 bugs affecting real users
- Fix KeyError 'root' in FileGrouper when merging groups with no root-level files
- Fix changelog commit parsing breaking on multiline bodies (use %x00 separator)
- Add empty choices/content checks in OpenAI, Anthropic, OpenRouter providers
- Fix config edit crash when config is empty
- Fix validate command using wrong color for 'no staged files'
- Add type check for corrupted YAML config (non-dict returns empty dict)
2026-06-16 14:36:19 +05:45
sankalp cb3a1662d9 refactor(devgen/cli): reorder config merge to preserve key order
Preserves insertion order and prevents accidental overwriting of existing keys
2026-06-06 21:36:37 +05:45
sankalp 70e9068082 fix: None crash in providers, _merge_deepest loop, lock-file false positives, stage() race, cache TTL, config merge, changelog indent, template check 2026-06-06 21:33:51 +05:45
sankalp fb87bfa146 fix: handle deleted files in stage() — use git rm for missing paths 2026-06-06 21:21:10 +05:45
sankalp 69bd79e0fa bump version to 0.2.6 2026-06-06 20:57:00 +05:45
sankalp f70b5208ec refactor(devgen/providers): shared provider base class
Abstract out generate validation and error handling into BaseProvider, eliminating duplicated logic across Anthropic, OpenRouter, and OpenAI providers.
2026-06-06 17:10:30 +05:45
sankalp e2ec269f16 refactor(modules): restructure changelog and release note generation
Refactor to improve readability and separate concerns,
use Section enum and ordered traversal for consistent output.
2026-06-06 17:10:30 +05:45
sankalp 90ca0c0f59 refactor(devgen/modules): rename commit_message template from .j2 to .tpl
Bug Fixes:
- Updated template reference to use .tpl extension, resolving missing template error.
2026-06-06 16:56:14 +05:45
sankalp 9781523e8e refactor(devgen/modules): streamline manifest context generation
Enhancements:
- Replaced verbose scanning of many manifest files with targeted parsing of key project manifests (pyproject.toml, package.json, requirements.txt).
- Generated a compact one‑line‑per‑file summary, reducing token usage.
- Improved clarity and readability of the AI‑provided context.
2026-06-06 16:48:28 +05:45
sankalp 96b2499ecf chore(devgen/templates/commit): streamline commit template to Conventional Commits format
Clarify output format and remove redundant guidance.

New Features:
- Added explicit format and type list

Enhancements:
- Simplified instructions, removed unnecessary guidance

Bug Fixes:
- None
2026-06-06 16:48:21 +05:45
sankalp 4f8e358a60 feat(devgen/modules): expose max_groups and max_diff_size as CLI override flags
- Add CLI flags to override `max_groups` and `max_diff_size` limits
- Update file grouping logic to respect override values
- Improve truncation logging with configurable size and guidance
- Remove unused imports and streamline rich console setup
2026-06-06 16:45:18 +05:45
sankalp 72c57f0d33 feat(devgen):add token limit error detection and friendly formatting utilities 2026-06-06 16:45:13 +05:45
sankalp 0b023482d7 feat(devgen/cli): introduce --max-groups and --max-diff-size options for commit command
Add limits to prevent token‑limit errors during commit generation.
- New `--max-groups` option to cap the number of commit groups.
- New `--max-diff-size` option to set maximum diff size per group (default 8000 chars).
Update logging to reflect the new options and pass them to the engine.
2026-06-06 16:45:07 +05:45
sankalp 8069895bc7 feat(devgen/providers): normalize token limit error handling
Add token limit error detection and formatting across all provider modules to surface clear diagnostics when context windows are exceeded, improving error messages and preventing silent failures.

New Features
- Introduce `is_token_limit_error` checks in Anthropic, Gemini, Hugging Face, Ollama, OpenAI, and OpenRouter providers.
- Use `format_token_limit_error` to generate user‑friendly error messages for token limit overs.

Enhancements
- Centralize token limit error handling for consistent diagnostics across providers.
- Explicitly re‑raise `RuntimeError` in Hugging Face to preserve original behavior.

Bug Fixes
- None
2026-06-06 16:45:05 +05:45
sankalp d991af9c47 feat(devgen/cli): introduce Ollamaprovider support and interactive host configuration
- Add "ollama" to AI provider choices in config prompts
- Prompt user for Ollama server URL when selecting the Ollama provider
- Store the configured Ollama host in the config under the "ollama_host" key
- Update config saving logic in both edit_config and setup_config functions
2026-06-06 16:31:09 +05:45
sankalp aad3703ea3 feat(devgen/modules): add configurable Ollama host- New Features
- Added `ollama_host` configuration option.
- Enhancements
  - Use the configured host when calling the Ollama provider.
2026-06-06 16:31:02 +05:45
sankalp a8b48e9f07 feat(devgen/providers): add OllamaProvider for local Ollama integration
Add a new provider that wraps the local Ollama server using an OpenAI‑compatible client, enabling generation via `ollama_host` configuration. This introduces the first provider for local LLM inference.

New Features
- Implement OllamaProvider with a `generate()` method, supporting custom host, model selection, and robust error handling.
2026-06-06 16:30:56 +05:45
sankalp 7016cff3a7 feat(devgen): add Ollama provider and host configuration
Add support for the Ollama provider in the AI generation pipeline and expose a configurable host address.

New Features:
- Introduce `ollama` as a selectable provider.
- Add `ollama_host` configuration option with default `http://localhost:11434`.

Enhancements:
- Extend provider list in error message to include Ollama.
2026-06-06 16:30:52 +05:45
sankalp 55ebbaef15 feat(devgen/cli): improve version callback error messages
- Enhanced error messages when version cannot be determined, providing clearer guidance.
- Added explicit handling for missing pyproject.toml and TOML parsing errors.
- Improved user feedback for installation corruption issues.
2026-06-06 16:27:20 +05:45
sankalp 80f68a6ccd feat(devgen): enhance provider import error handling
Enhancements:
- Split ModuleNotFoundError and AttributeError handling to deliver clearer diagnostics
- Explicitly list available providers and flag missing provider classes as packaging bugs

Bug Fixes:
- Provide specific guidance when a provider module is not a built‑in module
- Clarify that a missing provider class indicates a packaging issue rather than user error
2026-06-06 16:27:17 +05:45
sankalp fd3ce03484 feat(devgen/modules): categorize committypes and improve changelog/release note formattingAdd separate categories for Performance, Refactor, Tests, Style, and Chore; update ordering and emojis; improve remote push detection and fetch strategy; enhance error logging.
- New Features  - Introduced distinct sections for Performance, Refactor, Tests, Style, and Chore in changelog generation.
  - Added dedicated emojis for each new category.
  - Updated section ordering to reflect the new categories.
- Enhancements
  - Enhanced push logic to fetch upstream before push, avoiding non‑fast‑forward rejections.
  - Refactored `is_ahead_of_remote` with a fetch flag to reduce network calls and TOCTOU windows.
  - Improved error logging with full traceback for group processing failures.
- Bug Fixes
  - Fixed emoji mappings for "Style" and "Other Changes".
  - Corrected handling of empty upstream ref to prevent errors.
  - Ensured proper exception handling when remote branch is missing.
2026-06-06 16:27:12 +05:45
sankalp 51d2b7549f feat(devgen/providers):improve provider error handling and response parsing 2026-06-06 16:27:03 +05:45
sankalp daa6f203c3 refactor(devgen/modules): reformat time.sleep block for readability 2026-03-06 19:43:19 +05:45
sankalp 1b36c3f2d7 feat(devgen/providers): improve error detection for rate‑limiting and quota exceeded responses
Enhancements:
- Extend error message parsing to capture additional throttling indicators such as "RESOURCE_EXHAUSTED", "QUOTA_EXCEEDED", and "THROTTLED".
- Refactor the conditional logic for better readability and maintainability.
- Keep existing retry behavior while increasing resilience to API rate‑limit errors.
2026-03-06 19:43:16 +05:45
sankalp 9554f7af2a feat(devgen/providers): bump default Gemini model to gemini-2.5-flash and add retry handling for quota errors
The update changes the default model, refactors imports, and implements robust retry logic with exponential back‑off and clearer error messages. This improves resilience and clarifies usage.

New Features
- Exponential back‑off retry on 429/quota exhausted responses.
- Configurable max_retries and retry_delay parameters.

Enhancements
- Default model set to gemini-2.5-flash.
- Improved error output with actionable troubleshooting steps.
2026-01-30 22:36:31 +05:45
sankalp b09de402cc feat(devgen): add max_groups config option 2025-12-25 09:36:05 +05:45
sankalp c121a7fa59 feat(devgen/modules): add interactive commit review and smart file grouping
- New Features:
  - Added `check` parameter to enable interactive commit message review
  - Implemented user confirmation/editing/abort workflow using questionary
  - Added smart file grouping with configurable max_groups limit
  - Files are now merged into parent directories when group count exceeds limit

- Enhancements:
  - Improved `group_files()` method with hierarchical merging logic
  - Added graceful KeyboardInterrupt handling during user review
  - Enhanced logging for group merging operations
```
2025-12-25 09:35:33 +05:45
sankalp 525aebadf4 feat(devgen/modules): enhance commit generation with manifest context and custom templates
- New Features:
  - Added `_get_manifest_context()` to extract project metadata from manifest files (pyproject.toml, package.json, etc.) for richer commit message context.
  - Added support for custom commit message templates via `custom_template` config.
  - Added emoji instruction toggle based on global `use_emoji` setting.

- Enhancements:
  - Improved error handling for git push failures with specific hints for "no upstream branch" scenarios.
  - Optimized manifest context extraction by truncating large files to avoid token bloat.
  - Refactored prompt generation to dynamically include manifest context and custom templates.
```
2025-12-25 00:04:54 +05:45
sankalp 1219c1ad81 feat(devgen/templates/commit): add context to commit message template
- New Features:
  - Added `{{ context }}` variable to the commit message template to provide additional context.
- Enhancements:
  - Removed the emoji usage line from the template to simplify the output.
```
2025-12-25 00:04:50 +05:45
sankalp cfa891dcde feat(devgen/cli): add config info command and improve undo commit message formatting 2025-12-25 00:04:48 +05:45
sankalp f2ff3327c3 feat(devgen): add custom template rendering function
- New Features:
  - Introduced `render_custom_template()` function to render Jinja2 templates from strings.
  - Enables dynamic template rendering without requiring file-based templates.
```
2025-12-25 00:04:40 +05:45
sankalp 37e5d94373 feat(devgen): enhance sanitize_ai_commit_message to handle bolding and labels
- Improve header detection by stripping bolding and cleaning labels like "1. Title:", "### Message:", etc.
- Stop processing lines when encountering a sponsor section
```
2025-12-24 23:49:37 +05:45
sankalp 40c9b3ca57 refactor(devgen/templates/commit): update commit message template guidelines
- 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.
2025-12-24 23:49:34 +05:45
sankalp 4d309c313d 1. Title: feat(root): add TODO.md for project roadmap and tasks 2025-12-24 23:44:23 +05:45
sankalp ba747c727c feat(devgen): improve sanitize_ai_commit_message function
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.
```
2025-12-24 23:34:35 +05:45
sankalp 3635887a85 feat(devgen/modules): enhance changelog and license generation with improved file handling
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
```
2025-12-24 23:34:32 +05:45
sankalp d373f95388 refactor(devgen): enhance AI commit message sanitization
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
```
2025-12-24 23:29:45 +05:45
sankalp 407458149b fix: remove invalid debug argument from OpenAI and OpenRouter providers
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.
2025-12-14 07:57:16 +05:45
sankalp f85da0461f feat(dry-run): Display dry run messages on console
**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.
2025-12-13 21:42:33 +05:45
sankalp a2f3657269 feat(git): Introduce a robust utility for running git commands
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.
2025-12-13 21:19:18 +05:45
sankalp c50f8a4b89 refactor(modules): Standardize git command execution
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.
2025-12-13 21:19:18 +05:45