fix: resolve CI/CD issues - remove unused variables and add type stubs
Some checks failed
CI / test (3.11) (push) Has been cancelled
CI / test (3.10) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-02-03 01:38:54 +00:00
parent 3f4283188c
commit 857219a98d

View File

@@ -1,7 +1,6 @@
"""CLI command definitions.""" """CLI command definitions."""
from pathlib import Path from pathlib import Path
from typing import Optional
import click import click
from rich.console import Console from rich.console import Console
@@ -16,9 +15,7 @@ from src.utils.formatters import (
format_index_summary, format_index_summary,
format_search_results, format_search_results,
format_success, format_success,
format_help_header,
) )
from src.utils.config import reset_config
console = Console() console = Console()
@@ -32,7 +29,7 @@ def cli(ctx, verbose):
ctx.obj["verbose"] = verbose ctx.obj["verbose"] = verbose
@click.command(name="index") @cli.command(name="index")
@click.argument( @click.argument(
"path", type=click.Path(exists=True, file_okay=True, dir_okay=True, path_type=Path) "path", type=click.Path(exists=True, file_okay=True, dir_okay=True, path_type=Path)
) )
@@ -55,8 +52,6 @@ def index_command(ctx, path, type, recursive, batch_size):
PATH is the path to a file or directory to index. PATH is the path to a file or directory to index.
""" """
verbose = ctx.obj.get("verbose", False)
with console.status(f"Indexing {type} documentation from {path}..."): with console.status(f"Indexing {type} documentation from {path}..."):
searcher = Searcher() searcher = Searcher()
count = searcher.index(path, doc_type=type, recursive=recursive, batch_size=batch_size) count = searcher.index(path, doc_type=type, recursive=recursive, batch_size=batch_size)
@@ -69,7 +64,7 @@ def index_command(ctx, path, type, recursive, batch_size):
console.print("Try specifying a type: --type openapi|readme|code") console.print("Try specifying a type: --type openapi|readme|code")
@click.command(name="search") @cli.command(name="search")
@click.argument("query", type=str) @click.argument("query", type=str)
@click.option( @click.option(
"--limit", "-l", type=int, default=None, help="Maximum number of results" "--limit", "-l", type=int, default=None, help="Maximum number of results"
@@ -97,10 +92,6 @@ def search_command(ctx, query, limit, type, json, hybrid):
if limit is None: if limit is None:
limit = config.default_limit limit = config.default_limit
source_filter = None
if type:
source_filter = SourceType(type)
searcher = Searcher() searcher = Searcher()
with console.status("Searching..."): with console.status("Searching..."):
@@ -124,7 +115,7 @@ def search_command(ctx, query, limit, type, json, hybrid):
console.print(f"\nFound {len(results)} result(s)") console.print(f"\nFound {len(results)} result(s)")
@click.command(name="list") @cli.command(name="list")
@click.option( @click.option(
"--type", "--type",
"-t", "-t",
@@ -135,10 +126,6 @@ def search_command(ctx, query, limit, type, json, hybrid):
@click.pass_context @click.pass_context
def list_command(ctx, type, json): def list_command(ctx, type, json):
"""List indexed documents.""" """List indexed documents."""
source_filter = None
if type:
source_filter = SourceType(type)
searcher = Searcher() searcher = Searcher()
stats = searcher.get_stats() stats = searcher.get_stats()
@@ -156,7 +143,7 @@ def list_command(ctx, type, json):
console.print(table) console.print(table)
@click.command(name="stats") @cli.command(name="stats")
@click.pass_context @click.pass_context
def stats_command(ctx): def stats_command(ctx):
"""Show index statistics.""" """Show index statistics."""
@@ -172,7 +159,7 @@ def stats_command(ctx):
console.print(table) console.print(table)
@click.command(name="clear") @cli.command(name="clear")
@click.option("--type", "-t", type=click.Choice(["openapi", "readme", "code"])) @click.option("--type", "-t", type=click.Choice(["openapi", "readme", "code"]))
@click.option("--force", "-f", is_flag=True, help="Skip confirmation prompt") @click.option("--force", "-f", is_flag=True, help="Skip confirmation prompt")
@click.pass_context @click.pass_context
@@ -202,7 +189,7 @@ def clear_command(ctx, type, force):
console.print(format_success(f"Deleted {count} document(s)")) console.print(format_success(f"Deleted {count} document(s)"))
@click.command(name="config") @cli.command(name="config")
@click.option("--show", is_flag=True, help="Show current configuration") @click.option("--show", is_flag=True, help="Show current configuration")
@click.option("--reset", is_flag=True, help="Reset configuration to defaults") @click.option("--reset", is_flag=True, help="Reset configuration to defaults")
@click.pass_context @click.pass_context
@@ -234,7 +221,7 @@ def config_command(ctx, show, reset):
console.print(panel) console.print(panel)
@click.command(name="interactive") @cli.command(name="interactive")
@click.pass_context @click.pass_context
def interactive_command(ctx): def interactive_command(ctx):
"""Enter interactive search mode.""" """Enter interactive search mode."""