fix: resolve CI linting and type errors
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
|
"""Registry commands for sharing prompts."""
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from promptforge.registry import LocalRegistry, RemoteRegistry, RegistryEntry
|
from promptforge.registry import LocalRegistry, RemoteRegistry, RegistryEntry
|
||||||
from promptforge.core.prompt import Prompt
|
from promptforge.core.prompt import Prompt
|
||||||
|
|
||||||
@@ -51,8 +54,9 @@ def registry_add(ctx, prompt_name: str, author: str):
|
|||||||
|
|
||||||
@registry.command("search")
|
@registry.command("search")
|
||||||
@click.argument("query")
|
@click.argument("query")
|
||||||
|
@click.option("--limit", default=20, help="Maximum results")
|
||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
def registry_search(ctx, query: str):
|
def registry_search(ctx, query: str, limit: int):
|
||||||
"""Search local registry."""
|
"""Search local registry."""
|
||||||
registry = LocalRegistry()
|
registry = LocalRegistry()
|
||||||
results = registry.search(query)
|
results = registry.search(query)
|
||||||
@@ -61,7 +65,7 @@ def registry_search(ctx, query: str):
|
|||||||
click.echo("No results found")
|
click.echo("No results found")
|
||||||
return
|
return
|
||||||
|
|
||||||
for result in results:
|
for result in results[:limit]:
|
||||||
entry = result.entry
|
entry = result.entry
|
||||||
click.echo(f"{entry.name} (score: {result.relevance_score})")
|
click.echo(f"{entry.name} (score: {result.relevance_score})")
|
||||||
if entry.description:
|
if entry.description:
|
||||||
@@ -79,7 +83,7 @@ def registry_pull(ctx, entry_id: str):
|
|||||||
if remote.pull(entry_id, local):
|
if remote.pull(entry_id, local):
|
||||||
click.echo(f"Pulled entry {entry_id}")
|
click.echo(f"Pulled entry {entry_id}")
|
||||||
else:
|
else:
|
||||||
click.echo(f"Entry not found", err=True)
|
click.echo("Entry not found", err=True)
|
||||||
raise click.Abort()
|
raise click.Abort()
|
||||||
|
|
||||||
|
|
||||||
@@ -104,4 +108,4 @@ def registry_publish(ctx, prompt_name: str):
|
|||||||
click.echo(f"Published '{prompt_name}' as {published.id}")
|
click.echo(f"Published '{prompt_name}' as {published.id}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
click.echo(f"Publish error: {e}", err=True)
|
click.echo(f"Publish error: {e}", err=True)
|
||||||
raise click.Abort()
|
raise click.Abort()
|
||||||
|
|||||||
Reference in New Issue
Block a user