fix: resolve CI linting and type errors
Some checks failed
CI / test (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / type-check (push) Has been cancelled

This commit is contained in:
2026-02-04 12:58:08 +00:00
parent 48edd1a9e0
commit 1f9d843207

View File

@@ -1,4 +1,7 @@
"""Version control commands."""
import click
from promptforge.core.git_manager import GitManager
@@ -32,7 +35,13 @@ def history(ctx, prompt_name: str):
click.echo(f" {commit['date']} by {commit['author']}")
else:
for commit in commits:
click.echo(f"{commit.hexsha[:7]} - {commit.message.strip()}")
hexsha = commit.hexsha
if isinstance(hexsha, bytes):
hexsha = hexsha.decode('utf-8')
message = commit.message
if isinstance(message, bytes):
message = message.decode('utf-8')
click.echo(f"{hexsha[:7]} - {message.strip()}")
click.echo(f" {commit.author.name} - {commit.committed_datetime.isoformat()}")
except Exception as e:
click.echo(f"Error: {e}", err=True)
@@ -75,6 +84,22 @@ def branch(ctx, branch_name: str):
raise click.Abort()
@version.command("switch")
@click.argument("branch_name")
@click.pass_obj
def switch(ctx, branch_name: str):
"""Switch to a branch."""
prompts_dir = ctx["prompts_dir"]
git_manager = GitManager(prompts_dir)
try:
git_manager.switch_branch(branch_name)
click.echo(f"Switched to branch: {branch_name}")
except Exception as e:
click.echo(f"Error: {e}", err=True)
raise click.Abort()
@version.command("list")
@click.pass_obj
def list_branches(ctx):
@@ -121,4 +146,4 @@ def status(ctx):
click.echo(status_output)
except Exception as e:
click.echo(f"Error: {e}", err=True)
raise click.Abort()
raise click.Abort()