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.
97 lines
2.4 KiB
Python
97 lines
2.4 KiB
Python
from typing import Annotated
|
|
|
|
import typer
|
|
|
|
from devgen.modules.commit_generator import run_commit_engine
|
|
from devgen.utils import (
|
|
configure_logger,
|
|
delete_file,
|
|
get_commit_dry_run_path,
|
|
get_git_staged_files,
|
|
get_main_log_path,
|
|
read_file_content,
|
|
)
|
|
|
|
app = typer.Typer(
|
|
name="commit",
|
|
help="🚀 AI-powered semantic commit message generator.",
|
|
no_args_is_help=True,
|
|
rich_markup_mode="markdown",
|
|
)
|
|
|
|
|
|
@app.command("run")
|
|
def run_commit(
|
|
dry_run: Annotated[
|
|
bool,
|
|
typer.Option(
|
|
"--dry-run",
|
|
help="Simulate the commit process without making changes.",
|
|
),
|
|
] = False,
|
|
push: Annotated[
|
|
bool,
|
|
typer.Option(
|
|
"--push",
|
|
help="Automatically push changes to the remote repository.",
|
|
),
|
|
] = False,
|
|
debug: Annotated[
|
|
bool,
|
|
typer.Option(
|
|
"--debug",
|
|
help="Enable debug mode for detailed logging.",
|
|
),
|
|
] = False,
|
|
force_rebuild: Annotated[
|
|
bool,
|
|
typer.Option(
|
|
"--force-rebuild",
|
|
help="Force regeneration of commit messages.",
|
|
),
|
|
] = False,
|
|
) -> None:
|
|
log_file = get_main_log_path()
|
|
logger = configure_logger("devgen.cli.commit", log_file, console=debug)
|
|
logger.info(f"Log file: {log_file}")
|
|
logger.info(
|
|
f"Options: dry_run={dry_run}, push={push}, debug={debug}, force={force_rebuild}"
|
|
)
|
|
|
|
run_commit_engine(
|
|
dry_run=dry_run,
|
|
push=push,
|
|
debug=debug,
|
|
force_rebuild=force_rebuild,
|
|
logger=logger,
|
|
)
|
|
|
|
|
|
@app.command("clear-cache")
|
|
def clear_cache() -> None:
|
|
if delete_file(get_commit_dry_run_path()):
|
|
typer.secho("Cache cleared.", fg=typer.colors.GREEN)
|
|
else:
|
|
typer.secho("[i] No cache found.", fg=typer.colors.YELLOW)
|
|
|
|
|
|
@app.command("list-cached")
|
|
def list_cached() -> None:
|
|
content = read_file_content(get_commit_dry_run_path())
|
|
if content:
|
|
typer.secho("--- Cached Dry-Run ---", fg=typer.colors.CYAN)
|
|
typer.echo(content)
|
|
else:
|
|
typer.secho("[i] No cache found.", fg=typer.colors.YELLOW)
|
|
|
|
|
|
@app.command("validate")
|
|
def validate() -> None:
|
|
staged = get_git_staged_files()
|
|
if staged:
|
|
typer.secho(f"{len(staged)} staged file(s):", fg=typer.colors.GREEN)
|
|
for f in staged:
|
|
typer.echo(f"- {f}")
|
|
else:
|
|
typer.secho("[i] No staged files.", fg=typer.colors.RED)
|