feat: recursively resolve .goosehints files (#358)

This commit is contained in:
Alistair Gray
2024-11-27 21:27:40 -05:00
committed by GitHub
parent 4222477758
commit fcbac4ee24
4 changed files with 41 additions and 21 deletions
+13 -1
View File
@@ -75,6 +75,18 @@ def test_system_prompt_with_goosehints(temp_dir, developer_toolkit):
assert system_prompt.endswith(expected_end)
def test_system_prompt_with_goosehints_from_parent_dir(temp_dir, developer_toolkit):
hints_file = temp_dir / ".goosehints"
hints_file.write_text("This is from the README.md file in parent.")
inner_temp_dir = temp_dir / "inner"
inner_temp_dir.mkdir(parents=True, exist_ok=True)
with change_dir(inner_temp_dir):
system_prompt = developer_toolkit.system()
expected = "This is from the README.md file in parent."
assert system_prompt.endswith(expected)
def test_system_prompt_with_goosehints_only_from_home_dir(temp_dir, developer_toolkit):
readme_file_home = Path.home() / ".config/goose/README.md"
readme_file_home.parent.mkdir(parents=True, exist_ok=True)
@@ -113,7 +125,7 @@ def test_system_prompt_with_goosehints_only_from_home_dir(temp_dir, developer_to
system_prompt = developer_toolkit.system()
expected_content_local = "Hints from local:\n\nThis is from the README.md file.\nEnd."
expected_content_home = "Hints from home:\n\nThis is from the README.md file in home.\nEnd."
expected_end = f"Hints:\n{expected_content_local}\n{expected_content_home}"
expected_end = f"Hints:\n{expected_content_local}\n\n{expected_content_home}"
assert system_prompt.endswith(expected_end)
finally:
home_hints_file.unlink()