fix: resolve CI/CD issues - fixed linting and type errors
Some checks failed
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
2026-01-31 06:07:04 +00:00
parent 4373978adb
commit 15e6e7e0b2

View File

@@ -1,15 +1,13 @@
"""Main CLI entry point for shell-speak."""
import os
import sys
from typing import Optional
import typer
from rich.panel import Panel
from rich.text import Text
from shell_speak import __version__
from shell_speak.config import DEFAULT_TOOLS, ensure_data_dir, get_history_file
from shell_speak.config import DEFAULT_TOOLS, ensure_data_dir
from shell_speak.history import get_history_manager
from shell_speak.interactive import run_interactive_mode
from shell_speak.library import get_loader
@@ -21,7 +19,6 @@ from shell_speak.output import (
display_history,
display_info,
)
from shell_speak.models import CommandMatch
app = typer.Typer(
name="shell-speak",
@@ -30,7 +27,7 @@ app = typer.Typer(
)
def version_callback(value: bool):
def version_callback(value: bool) -> None:
"""Show version information."""
if value:
console.print(f"Shell Speak v{__version__}")
@@ -47,14 +44,14 @@ def main(
is_eager=True,
help="Show version information",
),
):
) -> None:
pass
@app.command()
def convert(
query: str = typer.Argument(..., help="Natural language description of the command"),
tool: Optional[str] = typer.Option(
tool: str | None = typer.Option(
None,
"--tool",
"-t",
@@ -72,7 +69,7 @@ def convert(
"-n",
help="Preview the command without executing",
),
):
) -> None:
"""Convert natural language to a shell command."""
ensure_data_dir()
@@ -100,7 +97,7 @@ def interactive(
is_eager=True,
help="Enter interactive mode",
),
):
) -> None:
"""Enter interactive mode with history and auto-completion."""
run_interactive_mode()
@@ -113,19 +110,19 @@ def history(
"-l",
help="Number of entries to show",
),
tool: Optional[str] = typer.Option(
tool: str | None = typer.Option(
None,
"--tool",
"-t",
help=f"Filter by tool: {', '.join(DEFAULT_TOOLS)}",
),
search: Optional[str] = typer.Option(
search: str | None = typer.Option(
None,
"--search",
"-s",
help="Search history for query",
),
):
) -> None:
"""View command history."""
ensure_data_dir()
history_manager = get_history_manager()
@@ -152,7 +149,7 @@ def learn(
"-t",
help=f"Tool category: {', '.join(DEFAULT_TOOLS)}",
),
):
) -> None:
"""Learn a new command pattern from your correction."""
ensure_data_dir()
loader = get_loader()
@@ -170,7 +167,7 @@ def forget(
"-t",
help="Tool category",
),
):
) -> None:
"""Forget a learned pattern."""
ensure_data_dir()
loader = get_loader()
@@ -183,7 +180,7 @@ def forget(
@app.command()
def reload():
def reload() -> None:
"""Reload command libraries and corrections."""
ensure_data_dir()
loader = get_loader()
@@ -192,7 +189,7 @@ def reload():
@app.command()
def tools():
def tools() -> None:
"""List available tools."""
console.print(Panel(
Text("Available Tools", justify="center", style="bold cyan"),
@@ -202,7 +199,7 @@ def tools():
console.print(f" [tool]{tool}[/]")
def main_entry():
def main_entry() -> None:
"""Entry point for the CLI."""
try:
app()