This commit is contained in:
sankalp committed 2025-12-12 12:10:01 +05:45
1 parent 6aede08b0d
commit 9e93b496f1
2 files changed
+12 -3

No files matched your search

+11 -2
View File
@@ -14,6 +14,7 @@ app = typer.Typer(
@app.command("config") @app.command("config")
def setup_config() -> None: def setup_config() -> None:
"""Interactively setup configuration."""
typer.secho("🛠️ Interactive Configuration Setup", fg=typer.colors.CYAN, bold=True) typer.secho("🛠️ Interactive Configuration Setup", fg=typer.colors.CYAN, bold=True)
config_path = Path.home() / ".devgen.yaml" config_path = Path.home() / ".devgen.yaml"
@@ -36,16 +37,22 @@ def setup_config() -> None:
default=current_config.get("provider", "gemini"), default=current_config.get("provider", "gemini"),
style=style, style=style,
).ask() ).ask()
if provider is None:
raise typer.Exit(code=130)
model_default = current_config.get("model", "gemini-2.5-flash") model_default = current_config.get("model", "gemini-2.5-flash")
model = questionary.text( model = questionary.text(
"Enter Model Name:", default=model_default, style=style "Enter Model Name:", default=model_default, style=style
).ask() ).ask()
if model is None:
raise typer.Exit(code=130)
api_key = questionary.password( api_key = questionary.password(
"Enter API Key (leave empty to keep existing or none):", style=style "Enter API Key (leave empty to keep existing or none):", style=style
).ask() ).ask()
if api_key is None:
raise typer.Exit(code=130)
if not api_key: if not api_key:
api_key = current_config.get("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", default="Yes" if current_config.get("emoji", True) else "No",
style=style, style=style,
).ask() ).ask()
if emoji_choice is None:
raise typer.Exit(code=130)
emoji = emoji_choice == "Yes" emoji = emoji_choice == "Yes"
# Save Config # Save Config
@@ -69,8 +78,8 @@ def setup_config() -> None:
try: try:
with config_path.open("w", encoding="utf-8") as f: with config_path.open("w", encoding="utf-8") as f:
yaml.dump(new_config, f, default_flow_style=False) 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)) typer.echo(yaml.dump(new_config, default_flow_style=False))
except Exception as e: 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) raise typer.Exit(code=1)
+1 -1
View File
@@ -12,7 +12,7 @@ class ChangelogGenerator:
"""Generates a changelog from git history using Semantic Release style.""" """Generates a changelog from git history using Semantic Release style."""
def __init__(self, logger=None): 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: def _exec_git(self, args: List[str]) -> str:
"""Executes a git command.""" """Executes a git command."""