mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
feat: show available toolkits (#37)
This commit is contained in:
@@ -48,6 +48,20 @@ def session() -> None:
|
||||
pass
|
||||
|
||||
|
||||
@goose_cli.group()
|
||||
def toolkit() -> None:
|
||||
"""Manage toolkits"""
|
||||
pass
|
||||
|
||||
|
||||
@toolkit.command(name="list")
|
||||
def list_toolkits() -> None:
|
||||
print("[green]Available toolkits:[/green]")
|
||||
for toolkit_name, toolkit in load_plugins("goose.toolkit").items():
|
||||
first_line_of_doc = toolkit.__doc__.split("\n")[0]
|
||||
print(f" - [bold]{toolkit_name}[/bold]: {first_line_of_doc}")
|
||||
|
||||
|
||||
@session.command(name="start")
|
||||
@click.option("--profile")
|
||||
@click.option("--plan", type=click.Path(exists=True))
|
||||
|
||||
@@ -26,7 +26,7 @@ def keep_unsafe_command_prompt(command: str) -> PromptType:
|
||||
|
||||
|
||||
class Developer(Toolkit):
|
||||
"""The developer toolkit provides a set of general purpose development capabilities
|
||||
"""Provides a set of general purpose development capabilities
|
||||
|
||||
The tools include plan management, a general purpose shell execution tool, and file operations.
|
||||
We also include some default shell strategies in the prompt, such as using ripgrep
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
from goose.utils import load_plugins
|
||||
|
||||
|
||||
def lint_toolkits() -> None:
|
||||
for toolkit_name, toolkit in load_plugins("goose.toolkit").items():
|
||||
assert toolkit.__doc__ is not None, f"`{toolkit_name}` toolkit must have a docstring"
|
||||
first_line_of_docstring = toolkit.__doc__.split("\n")[0]
|
||||
assert len(first_line_of_docstring.split(" ")) > 5, f"`{toolkit_name}` toolkit docstring is too short"
|
||||
assert len(first_line_of_docstring.split(" ")) < 12, f"`{toolkit_name}` toolkit docstring is too long"
|
||||
assert first_line_of_docstring[
|
||||
0
|
||||
].isupper(), f"`{toolkit_name}` toolkit docstring must start with a capital letter"
|
||||
@@ -14,6 +14,8 @@ from goose.utils.ask import clear_exchange, replace_prompt
|
||||
|
||||
|
||||
class RepoContext(Toolkit):
|
||||
"""Provides context about the current repository"""
|
||||
|
||||
def __init__(self, notifier: Notifier, requires: Requirements) -> None:
|
||||
super().__init__(notifier=notifier, requires=requires)
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
from goose.toolkit.lint import lint_toolkits
|
||||
|
||||
|
||||
def test_lint_toolkits():
|
||||
lint_toolkits()
|
||||
Reference in New Issue
Block a user