diff --git a/src/goose/cli/main.py b/src/goose/cli/main.py index 4ebcc28113..0e266dd706 100644 --- a/src/goose/cli/main.py +++ b/src/goose/cli/main.py @@ -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)) diff --git a/src/goose/toolkit/developer.py b/src/goose/toolkit/developer.py index 1114df19df..7a7357496f 100644 --- a/src/goose/toolkit/developer.py +++ b/src/goose/toolkit/developer.py @@ -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 diff --git a/src/goose/toolkit/lint.py b/src/goose/toolkit/lint.py new file mode 100644 index 0000000000..0f08f222dc --- /dev/null +++ b/src/goose/toolkit/lint.py @@ -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" diff --git a/src/goose/toolkit/repo_context/repo_context.py b/src/goose/toolkit/repo_context/repo_context.py index 89a01a76fc..8be8794f6f 100644 --- a/src/goose/toolkit/repo_context/repo_context.py +++ b/src/goose/toolkit/repo_context/repo_context.py @@ -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) diff --git a/tests/test_linting.py b/tests/test_linting.py new file mode 100644 index 0000000000..f6e246ff62 --- /dev/null +++ b/tests/test_linting.py @@ -0,0 +1,5 @@ +from goose.toolkit.lint import lint_toolkits + + +def test_lint_toolkits(): + lint_toolkits()