feat: update to use search code

This commit is contained in:
2025-05-13 12:38:33 -03:00
parent 0b9fa30a13
commit e3d312e48d
3 changed files with 21 additions and 6 deletions

1
worker/.gitignore vendored
View File

@ -15,3 +15,4 @@ taskStateInfoKeypair.json
localKOIIDB.db localKOIIDB.db
metadata.json metadata.json
.npmrc .npmrc
**/*.log

View File

@ -19,7 +19,7 @@ class RepoClassificationPhase(WorkflowPhase):
super().__init__( super().__init__(
workflow=workflow, workflow=workflow,
prompt_name="classify_repository", prompt_name="classify_repository",
available_tools=["read_file", "list_files", "classify_repository"], available_tools=["read_file", "search_code", "classify_repository"],
conversation_id=conversation_id, conversation_id=conversation_id,
name="Repository Classification", name="Repository Classification",
) )
@ -32,7 +32,7 @@ class ReadmeSectionGenerationPhase(WorkflowPhase):
prompt_name="generate_readme_section", prompt_name="generate_readme_section",
available_tools=[ available_tools=[
"read_file", "read_file",
"list_files", "search_code",
"create_readme_section", "create_readme_section",
], ],
conversation_id=conversation_id, conversation_id=conversation_id,
@ -56,7 +56,7 @@ class ReadmeReviewPhase(WorkflowPhase):
super().__init__( super().__init__(
workflow=workflow, workflow=workflow,
prompt_name="review_readme_file", prompt_name="review_readme_file",
available_tools=["read_file", "list_files", "review_readme_file"], available_tools=["read_file", "search_code", "review_readme_file"],
conversation_id=conversation_id, conversation_id=conversation_id,
name="Readme Review", name="Readme Review",
) )
@ -67,7 +67,7 @@ class CreatePullRequestPhase(WorkflowPhase):
super().__init__( super().__init__(
workflow=workflow, workflow=workflow,
prompt_name="create_pr", prompt_name="create_pr",
available_tools=["read_file", "list_files", "create_pull_request_legacy"], available_tools=["read_file", "search_code", "create_pull_request_legacy"],
conversation_id=conversation_id, conversation_id=conversation_id,
name="Create Pull Request", name="Create Pull Request",
) )

View File

@ -11,12 +11,16 @@ from prometheus_swarm.workflows.utils import (
validate_github_auth, validate_github_auth,
setup_repository, setup_repository,
) )
from kno_sdk import index_repo
from prometheus_swarm.tools.kno_sdk_wrapper.implementations import build_tools_wrapper
from src.workflows.repoSummarizer.prompts import PROMPTS from src.workflows.repoSummarizer.prompts import PROMPTS
from src.workflows.repoSummarizer.docs_sections import ( from src.workflows.repoSummarizer.docs_sections import (
DOCS_SECTIONS, DOCS_SECTIONS,
INITIAL_SECTIONS, INITIAL_SECTIONS,
FINAL_SECTIONS, FINAL_SECTIONS,
) )
from pathlib import Path
from prometheus_swarm.tools.git_operations.implementations import commit_and_push from prometheus_swarm.tools.git_operations.implementations import commit_and_push
@ -103,12 +107,22 @@ class RepoSummarizerWorkflow(Workflow):
# Enter repo directory # Enter repo directory
os.chdir(self.context["repo_path"]) os.chdir(self.context["repo_path"])
tools_build_result = self.build_tools_setup()
if not tools_build_result:
log_error(Exception("Failed to build tools setup"), "Failed to build tools setup")
return {
"success": False,
"message": "Failed to build tools setup",
"data": None,
}
# Configure Git user info # Configure Git user info
# setup_git_user_config(self.context["repo_path"]) # setup_git_user_config(self.context["repo_path"])
# Get current files for context # Get current files for context
def build_tools_setup(self):
index = index_repo(Path(self.context["repo_path"]))
tools = build_tools_wrapper(index)
return tools
def cleanup(self): def cleanup(self):
"""Cleanup workspace.""" """Cleanup workspace."""
# Make sure we're not in the repo directory before cleaning up # Make sure we're not in the repo directory before cleaning up