From de45ae5c16cc0624d14677278f00c8c95b7cdf58 Mon Sep 17 00:00:00 2001 From: AI Christianson Date: Wed, 18 Dec 2024 14:03:35 -0500 Subject: [PATCH] added monorepo_detected tool --- CHANGELOG.md | 3 +++ ra_aid/__main__.py | 5 +++-- ra_aid/prompts.py | 2 ++ ra_aid/tools/__init__.py | 4 +++- ra_aid/tools/monorepo.py | 22 ++++++++++++++++++++++ 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 ra_aid/tools/monorepo.py diff --git a/CHANGELOG.md b/CHANGELOG.md index d869973..dc7edb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +- Added monorepo_detected tool so the agent can take specific actions. + ## [0.6.3] - Fix one shot completion signaling. diff --git a/ra_aid/__main__.py b/ra_aid/__main__.py index 51b93ab..584f2b2 100644 --- a/ra_aid/__main__.py +++ b/ra_aid/__main__.py @@ -12,7 +12,7 @@ from ra_aid.tools import ( emit_expert_context, get_memory_value, emit_key_facts, delete_key_facts, emit_key_snippets, delete_key_snippets, emit_research_subtask, request_implementation, read_file_tool, fuzzy_find_project_files, ripgrep_search, list_directory_tree, - swap_task_order + swap_task_order, monorepo_detected ) from ra_aid.env import validate_environment from ra_aid.tools.memory import _global_memory, get_related_files, one_shot_completed @@ -59,7 +59,8 @@ RESEARCH_TOOLS = [ emit_research_subtask, run_shell_command, emit_research_notes, - one_shot_completed + one_shot_completed, + monorepo_detected ] def parse_arguments(): diff --git a/ra_aid/prompts.py b/ra_aid/prompts.py index 6cb2556..9a507e4 100644 --- a/ra_aid/prompts.py +++ b/ra_aid/prompts.py @@ -93,6 +93,8 @@ Be thorough on locating all potential change sites/gauging blast radius. If there is a top-level README.md or docs/ folder, always start with that. +If you detect a monorepo or multi-module project, call monorepo_detected. + You have often been criticized for: - Missing 2nd- or 3rd-level related files. You have to do a recursive crawl to get it right, and don't be afraid to spawn subtasks. - Missing related files spanning modules or parts of the monorepo. diff --git a/ra_aid/tools/__init__.py b/ra_aid/tools/__init__.py index d1ab20c..5ed23c2 100644 --- a/ra_aid/tools/__init__.py +++ b/ra_aid/tools/__init__.py @@ -1,4 +1,5 @@ from .shell import run_shell_command +from .monorepo import monorepo_detected from .programmer import run_programming_task from .expert import ask_expert, emit_expert_context from .read_file import read_file_tool @@ -36,5 +37,6 @@ __all__ = [ 'emit_research_subtask', 'ripgrep_search', 'file_str_replace', - 'swap_task_order' + 'swap_task_order', + 'monorepo_detected' ] diff --git a/ra_aid/tools/monorepo.py b/ra_aid/tools/monorepo.py new file mode 100644 index 0000000..b6c409b --- /dev/null +++ b/ra_aid/tools/monorepo.py @@ -0,0 +1,22 @@ +from langchain_core.tools import tool +from rich.console import Console +from rich.panel import Panel + +console = Console() + +@tool("monorepo_detected") +def monorepo_detected() -> dict: + """ + Returns a hint message indicating monorepo detection. + + Returns: + dict: Contains a 'hint' key with the detection message + """ + console.print(Panel( + "Mono repo detected.", + title="🏢 Monorepo Detected", + border_style="bright_blue" + )) + return { + 'hint': 'Found indicators of a monorepo structure. Consider searching across all modules and packages for related code.' + }