fix: resolve CI/CD issues for Python project
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 11:16:12 +00:00
parent 9a8e3dc3df
commit f5805db351

View File

@@ -1,22 +1,24 @@
"""CLI interface for ShellGenius."""
import os
import sys
from typing import Any, Dict, Optional
from typing import Optional
import click
from prompt_toolkit import PromptSession
from prompt_toolkit.completion import WordCompleter
from rich.console import Console
from rich.panel import Panel
from rich.table import Table
from shellgenius.config import get_config
from shellgenius.explainer import ShellExplainer, explain_script
from shellgenius.explainer import explain_script
from shellgenius.generation import ShellSafetyChecker, generate_shell
from shellgenius.history import HistoryLearner, get_history_storage
from shellgenius.ollama_client import get_ollama_client
from shellgenius.refactoring import RefactoringAnalyzer, refactor_script
from shellgenius.refactoring import refactor_script
console = Console()
session: PromptSession[str] = PromptSession()
def print_header():
@@ -309,11 +311,10 @@ def interactive(ctx: click.Context):
while True:
try:
choice = console.ask(
choice = session.prompt(
"[bold cyan]ShellGenius[/bold cyan] > ",
choices=["g", "e", "r", "h", "m", "q", "?"],
default="?",
)
completer=WordCompleter(["g", "e", "r", "h", "m", "q", "?"]),
).strip() or "?"
if choice in ["q", "quit", "exit"]:
console.print("[cyan]Goodbye![/cyan]")
@@ -332,7 +333,7 @@ def interactive(ctx: click.Context):
)
)
elif choice == "g":
desc = console.ask("[cyan]Describe what you want:[/cyan]")
desc = session.prompt("[cyan]Describe what you want:[/cyan]")
if desc:
ctx.invoke(
generate,
@@ -340,11 +341,11 @@ def interactive(ctx: click.Context):
shell="bash",
)
elif choice == "e":
path = console.ask("[cyan]Path to script:[/cyan]")
path = session.prompt("[cyan]Path to script:[/cyan]")
if path and os.path.exists(path):
ctx.invoke(explain, script_path=path)
elif choice == "r":
path = console.ask("[cyan]Path to script:[/cyan]")
path = session.prompt("[cyan]Path to script:[/cyan]")
if path and os.path.exists(path):
ctx.invoke(refactor, script_path=path, show_safe=True)
elif choice == "h":