From 9e93b496f173a90ce7e0b22475c0db14a633cba8 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Fri, 12 Dec 2025 12:10:01 +0545 Subject: [PATCH] update --- devgen/cli/setup.py | 13 +++++++++++-- devgen/modules/changelog_generator.py | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/devgen/cli/setup.py b/devgen/cli/setup.py index 44d86c9..630cf01 100644 --- a/devgen/cli/setup.py +++ b/devgen/cli/setup.py @@ -14,6 +14,7 @@ app = typer.Typer( @app.command("config") def setup_config() -> None: + """Interactively setup configuration.""" typer.secho("🛠️ Interactive Configuration Setup", fg=typer.colors.CYAN, bold=True) config_path = Path.home() / ".devgen.yaml" @@ -36,16 +37,22 @@ def setup_config() -> None: default=current_config.get("provider", "gemini"), style=style, ).ask() + if provider is None: + raise typer.Exit(code=130) model_default = current_config.get("model", "gemini-2.5-flash") model = questionary.text( "Enter Model Name:", default=model_default, style=style ).ask() + if model is None: + raise typer.Exit(code=130) api_key = questionary.password( "Enter API Key (leave empty to keep existing or none):", style=style ).ask() + if api_key is None: + raise typer.Exit(code=130) if not api_key: api_key = current_config.get("api_key", "") @@ -56,6 +63,8 @@ def setup_config() -> None: default="Yes" if current_config.get("emoji", True) else "No", style=style, ).ask() + if emoji_choice is None: + raise typer.Exit(code=130) emoji = emoji_choice == "Yes" # Save Config @@ -69,8 +78,8 @@ def setup_config() -> None: try: with config_path.open("w", encoding="utf-8") as f: yaml.dump(new_config, f, default_flow_style=False) - typer.secho(f"\n Configuration saved to {config_path}", fg=typer.colors.GREEN) + typer.secho(f"\nConfiguration saved to {config_path}", fg=typer.colors.GREEN) typer.echo(yaml.dump(new_config, default_flow_style=False)) except Exception as e: - typer.secho(f"\n Failed to save configuration: {e}", fg=typer.colors.RED) + typer.secho(f"\nFailed to save configuration: {e}", fg=typer.colors.RED) raise typer.Exit(code=1) diff --git a/devgen/modules/changelog_generator.py b/devgen/modules/changelog_generator.py index be5049d..e54bb27 100644 --- a/devgen/modules/changelog_generator.py +++ b/devgen/modules/changelog_generator.py @@ -12,7 +12,7 @@ class ChangelogGenerator: """Generates a changelog from git history using Semantic Release style.""" def __init__(self, logger=None): - self.logger = logger or configure_logger("devtools.changelog") + self.logger = logger or configure_logger("devgen.changelog") def _exec_git(self, args: List[str]) -> str: """Executes a git command."""