mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-12 22:14:54 +00:00
Added safe_delete and inline_symbol tools (JB backend)
This commit is contained in:
1 parent
20e14fa158
commit
2aa6603dbb
4 files changed
+111
-2
No files matched your search
@@ -4,6 +4,7 @@ for testing or development. Here the tools will be operation the serena repo its
|
||||
"""
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from pprint import pprint
|
||||
|
||||
from serena.agent import SerenaAgent
|
||||
@@ -14,13 +15,17 @@ from serena.tools import (
|
||||
FindReferencingSymbolsTool,
|
||||
JetBrainsFindSymbolTool,
|
||||
JetBrainsGetSymbolsOverviewTool,
|
||||
JetBrainsInlineSymbol,
|
||||
JetBrainsSafeDeleteTool,
|
||||
SearchForPatternTool,
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
serena_config = SerenaConfig.from_config_file()
|
||||
serena_config.web_dashboard = False
|
||||
agent = SerenaAgent(project=REPO_ROOT, serena_config=serena_config)
|
||||
# project = Path(REPO_ROOT).parent / "serena-jetbrains-plugin-copy"
|
||||
project = Path(REPO_ROOT) / "test/resources/repos/python/test_repo"
|
||||
agent = SerenaAgent(project=str(project), serena_config=serena_config)
|
||||
|
||||
# apply a tool
|
||||
find_symbol_tool = agent.get_tool(JetBrainsFindSymbolTool)
|
||||
@@ -28,9 +33,15 @@ if __name__ == "__main__":
|
||||
find_file_tool = agent.get_tool(FindFileTool)
|
||||
search_pattern_tool = agent.get_tool(SearchForPatternTool)
|
||||
overview_tool = agent.get_tool(JetBrainsGetSymbolsOverviewTool)
|
||||
safe_delete_tool = agent.get_tool(JetBrainsSafeDeleteTool)
|
||||
inline_symbol = agent.get_tool(JetBrainsInlineSymbol)
|
||||
|
||||
result = agent.execute_task(
|
||||
lambda: find_symbol_tool.apply("SerenaAgent/get_tool_description_override"),
|
||||
lambda: inline_symbol.apply(
|
||||
relative_path="test_repo/nested.py",
|
||||
name_path="OuterClass/NestedClass",
|
||||
keep_definition=True,
|
||||
)
|
||||
)
|
||||
pprint(json.loads(result))
|
||||
# input("Press Enter to continue...")
|
||||
Reference in new issue
Block a user