From 8b0f8873974381cb7c5346079b54930f619eabe4 Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Wed, 4 Sep 2024 16:18:01 +1000 Subject: [PATCH] adding in ability to provide per repo hints (#32) * adding in ability to provide per repo hints * tidy up test --- src/goose/toolkit/developer.py | 7 ++++++- tests/toolkit/test_developer.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/goose/toolkit/developer.py b/src/goose/toolkit/developer.py index e977d13d6..1114df19d 100644 --- a/src/goose/toolkit/developer.py +++ b/src/goose/toolkit/developer.py @@ -34,7 +34,12 @@ class Developer(Toolkit): def system(self) -> str: """Retrieve system configuration details for developer""" - return Message.load("prompts/developer.jinja").text + hints_path = Path('.goosehints') + system_prompt = Message.load("prompts/developer.jinja").text + if hints_path.is_file(): + goosehints = hints_path.read_text() + system_prompt = f"{system_prompt}\n\nHints:\n{goosehints}" + return system_prompt @tool def update_plan(self, tasks: List[dict]) -> List[dict]: diff --git a/tests/toolkit/test_developer.py b/tests/toolkit/test_developer.py index 915380dfc..e049ee9f2 100644 --- a/tests/toolkit/test_developer.py +++ b/tests/toolkit/test_developer.py @@ -1,4 +1,6 @@ from pathlib import Path + + from tempfile import TemporaryDirectory from unittest.mock import MagicMock, Mock @@ -66,3 +68,5 @@ def test_write_file(temp_dir, developer_toolkit): content = "Hello World" developer_toolkit.write_file(test_file.as_posix(), content) assert test_file.read_text() == content + +