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