agentcrew-ai 0.8.12__py3-none-any.whl → 0.8.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- AgentCrew/__init__.py +1 -1
- AgentCrew/main.py +55 -3
- AgentCrew/modules/agents/local_agent.py +25 -0
- AgentCrew/modules/code_analysis/__init__.py +8 -0
- AgentCrew/modules/code_analysis/parsers/__init__.py +67 -0
- AgentCrew/modules/code_analysis/parsers/base.py +93 -0
- AgentCrew/modules/code_analysis/parsers/cpp_parser.py +127 -0
- AgentCrew/modules/code_analysis/parsers/csharp_parser.py +162 -0
- AgentCrew/modules/code_analysis/parsers/generic_parser.py +63 -0
- AgentCrew/modules/code_analysis/parsers/go_parser.py +154 -0
- AgentCrew/modules/code_analysis/parsers/java_parser.py +103 -0
- AgentCrew/modules/code_analysis/parsers/javascript_parser.py +268 -0
- AgentCrew/modules/code_analysis/parsers/kotlin_parser.py +84 -0
- AgentCrew/modules/code_analysis/parsers/php_parser.py +107 -0
- AgentCrew/modules/code_analysis/parsers/python_parser.py +60 -0
- AgentCrew/modules/code_analysis/parsers/ruby_parser.py +46 -0
- AgentCrew/modules/code_analysis/parsers/rust_parser.py +72 -0
- AgentCrew/modules/code_analysis/service.py +231 -897
- AgentCrew/modules/command_execution/constants.py +2 -2
- AgentCrew/modules/console/confirmation_handler.py +4 -4
- AgentCrew/modules/console/console_ui.py +20 -1
- AgentCrew/modules/console/conversation_browser.py +557 -0
- AgentCrew/modules/console/diff_display.py +22 -51
- AgentCrew/modules/console/display_handlers.py +22 -22
- AgentCrew/modules/console/tool_display.py +4 -6
- AgentCrew/modules/file_editing/service.py +8 -8
- AgentCrew/modules/file_editing/tool.py +65 -67
- AgentCrew/modules/gui/components/tool_handlers.py +0 -2
- AgentCrew/modules/gui/widgets/diff_widget.py +30 -61
- AgentCrew/modules/llm/constants.py +5 -5
- AgentCrew/modules/memory/context_persistent.py +1 -0
- AgentCrew/modules/memory/tool.py +1 -1
- {agentcrew_ai-0.8.12.dist-info → agentcrew_ai-0.8.13.dist-info}/METADATA +1 -1
- {agentcrew_ai-0.8.12.dist-info → agentcrew_ai-0.8.13.dist-info}/RECORD +38 -24
- {agentcrew_ai-0.8.12.dist-info → agentcrew_ai-0.8.13.dist-info}/WHEEL +1 -1
- {agentcrew_ai-0.8.12.dist-info → agentcrew_ai-0.8.13.dist-info}/entry_points.txt +0 -0
- {agentcrew_ai-0.8.12.dist-info → agentcrew_ai-0.8.13.dist-info}/licenses/LICENSE +0 -0
- {agentcrew_ai-0.8.12.dist-info → agentcrew_ai-0.8.13.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PHP language parser for code analysis.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from .base import BaseLanguageParser
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PhpParser(BaseLanguageParser):
|
|
11
|
+
"""Parser for PHP source code."""
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def language_name(self) -> str:
|
|
15
|
+
return "php"
|
|
16
|
+
|
|
17
|
+
def process_node(
|
|
18
|
+
self, node, source_code: bytes, process_children_callback
|
|
19
|
+
) -> Optional[Dict[str, Any]]:
|
|
20
|
+
result = self._create_base_result(node)
|
|
21
|
+
|
|
22
|
+
if node.type in [
|
|
23
|
+
"class_declaration",
|
|
24
|
+
"interface_declaration",
|
|
25
|
+
"trait_declaration",
|
|
26
|
+
]:
|
|
27
|
+
for child in node.children:
|
|
28
|
+
if child.type == "name":
|
|
29
|
+
result["name"] = self.extract_node_text(child, source_code)
|
|
30
|
+
elif child.type == "declaration_list":
|
|
31
|
+
children = []
|
|
32
|
+
for body_child in child.children:
|
|
33
|
+
child_result = process_children_callback(body_child)
|
|
34
|
+
if child_result and self._is_significant_node(child_result):
|
|
35
|
+
children.append(child_result)
|
|
36
|
+
if children:
|
|
37
|
+
result["children"] = children
|
|
38
|
+
return result
|
|
39
|
+
|
|
40
|
+
elif node.type in ["method_declaration", "function_definition"]:
|
|
41
|
+
for child in node.children:
|
|
42
|
+
if child.type == "name":
|
|
43
|
+
result["name"] = self.extract_node_text(child, source_code)
|
|
44
|
+
return result
|
|
45
|
+
return result
|
|
46
|
+
|
|
47
|
+
elif node.type == "property_declaration":
|
|
48
|
+
return self._handle_property_declaration(node, source_code, result)
|
|
49
|
+
|
|
50
|
+
elif node.type == "const_declaration":
|
|
51
|
+
return self._handle_const_declaration(node, source_code, result)
|
|
52
|
+
|
|
53
|
+
children = []
|
|
54
|
+
for child in node.children:
|
|
55
|
+
child_result = process_children_callback(child)
|
|
56
|
+
if child_result and self._is_significant_node(child_result):
|
|
57
|
+
children.append(child_result)
|
|
58
|
+
|
|
59
|
+
if children:
|
|
60
|
+
result["children"] = children
|
|
61
|
+
|
|
62
|
+
return result
|
|
63
|
+
|
|
64
|
+
def _handle_property_declaration(
|
|
65
|
+
self, node, source_code: bytes, result: Dict[str, Any]
|
|
66
|
+
) -> Dict[str, Any]:
|
|
67
|
+
prop_name = None
|
|
68
|
+
prop_type = None
|
|
69
|
+
|
|
70
|
+
for child in node.children:
|
|
71
|
+
if child.type in [
|
|
72
|
+
"primitive_type",
|
|
73
|
+
"named_type",
|
|
74
|
+
"optional_type",
|
|
75
|
+
"union_type",
|
|
76
|
+
]:
|
|
77
|
+
prop_type = self.extract_node_text(child, source_code)
|
|
78
|
+
elif child.type == "property_element":
|
|
79
|
+
for subchild in child.children:
|
|
80
|
+
if subchild.type == "variable_name":
|
|
81
|
+
prop_name = self.extract_node_text(subchild, source_code)
|
|
82
|
+
|
|
83
|
+
if prop_name:
|
|
84
|
+
result["type"] = "property_declaration"
|
|
85
|
+
if prop_type:
|
|
86
|
+
result["name"] = f"{prop_type} {prop_name}"
|
|
87
|
+
else:
|
|
88
|
+
result["name"] = prop_name
|
|
89
|
+
|
|
90
|
+
return result
|
|
91
|
+
|
|
92
|
+
def _handle_const_declaration(
|
|
93
|
+
self, node, source_code: bytes, result: Dict[str, Any]
|
|
94
|
+
) -> Dict[str, Any]:
|
|
95
|
+
const_name = None
|
|
96
|
+
|
|
97
|
+
for child in node.children:
|
|
98
|
+
if child.type == "const_element":
|
|
99
|
+
for subchild in child.children:
|
|
100
|
+
if subchild.type == "name":
|
|
101
|
+
const_name = self.extract_node_text(subchild, source_code)
|
|
102
|
+
|
|
103
|
+
if const_name:
|
|
104
|
+
result["type"] = "const_declaration"
|
|
105
|
+
result["name"] = const_name
|
|
106
|
+
|
|
107
|
+
return result
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Python language parser for code analysis.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from .base import BaseLanguageParser
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PythonParser(BaseLanguageParser):
|
|
11
|
+
"""Parser for Python source code."""
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def language_name(self) -> str:
|
|
15
|
+
return "python"
|
|
16
|
+
|
|
17
|
+
def process_node(
|
|
18
|
+
self, node, source_code: bytes, process_children_callback
|
|
19
|
+
) -> Optional[Dict[str, Any]]:
|
|
20
|
+
result = self._create_base_result(node)
|
|
21
|
+
|
|
22
|
+
if node.type in ["class_definition", "function_definition"]:
|
|
23
|
+
for child in node.children:
|
|
24
|
+
if child.type == "identifier":
|
|
25
|
+
result["name"] = self.extract_node_text(child, source_code)
|
|
26
|
+
elif child.type == "parameters":
|
|
27
|
+
params = []
|
|
28
|
+
for param in child.children:
|
|
29
|
+
if "parameter" in param.type or param.type == "identifier":
|
|
30
|
+
params.append(self.extract_node_text(param, source_code))
|
|
31
|
+
if params:
|
|
32
|
+
result["parameters"] = params
|
|
33
|
+
|
|
34
|
+
elif node.type == "assignment":
|
|
35
|
+
var_name = None
|
|
36
|
+
var_type = None
|
|
37
|
+
for child in node.children:
|
|
38
|
+
if child.type == "identifier" and var_name is None:
|
|
39
|
+
var_name = self.extract_node_text(child, source_code)
|
|
40
|
+
elif child.type == "type":
|
|
41
|
+
var_type = self.extract_node_text(child, source_code)
|
|
42
|
+
|
|
43
|
+
if var_name:
|
|
44
|
+
result["type"] = "variable_declaration"
|
|
45
|
+
if var_type:
|
|
46
|
+
result["name"] = f"{var_name}: {var_type}"
|
|
47
|
+
else:
|
|
48
|
+
result["name"] = var_name
|
|
49
|
+
return result
|
|
50
|
+
|
|
51
|
+
children = []
|
|
52
|
+
for child in node.children:
|
|
53
|
+
child_result = process_children_callback(child)
|
|
54
|
+
if child_result and self._is_significant_node(child_result):
|
|
55
|
+
children.append(child_result)
|
|
56
|
+
|
|
57
|
+
if children:
|
|
58
|
+
result["children"] = children
|
|
59
|
+
|
|
60
|
+
return result
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Ruby language parser for code analysis.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from .base import BaseLanguageParser
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RubyParser(BaseLanguageParser):
|
|
11
|
+
"""Parser for Ruby source code."""
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def language_name(self) -> str:
|
|
15
|
+
return "ruby"
|
|
16
|
+
|
|
17
|
+
def process_node(
|
|
18
|
+
self, node, source_code: bytes, process_children_callback
|
|
19
|
+
) -> Optional[Dict[str, Any]]:
|
|
20
|
+
result = self._create_base_result(node)
|
|
21
|
+
|
|
22
|
+
if node.type in ["class", "method", "singleton_method", "module"]:
|
|
23
|
+
for child in node.children:
|
|
24
|
+
if child.type == "identifier":
|
|
25
|
+
result["name"] = self.extract_node_text(child, source_code)
|
|
26
|
+
return result
|
|
27
|
+
return result
|
|
28
|
+
|
|
29
|
+
elif node.type in ["assignment", "global_variable"]:
|
|
30
|
+
for child in node.children:
|
|
31
|
+
if child.type in ["identifier", "global_variable"]:
|
|
32
|
+
result["type"] = "variable_declaration"
|
|
33
|
+
result["name"] = self.extract_node_text(child, source_code)
|
|
34
|
+
return result
|
|
35
|
+
return result
|
|
36
|
+
|
|
37
|
+
children = []
|
|
38
|
+
for child in node.children:
|
|
39
|
+
child_result = process_children_callback(child)
|
|
40
|
+
if child_result and self._is_significant_node(child_result):
|
|
41
|
+
children.append(child_result)
|
|
42
|
+
|
|
43
|
+
if children:
|
|
44
|
+
result["children"] = children
|
|
45
|
+
|
|
46
|
+
return result
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Rust language parser for code analysis.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from .base import BaseLanguageParser
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RustParser(BaseLanguageParser):
|
|
11
|
+
"""Parser for Rust source code."""
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def language_name(self) -> str:
|
|
15
|
+
return "rust"
|
|
16
|
+
|
|
17
|
+
def process_node(
|
|
18
|
+
self, node, source_code: bytes, process_children_callback
|
|
19
|
+
) -> Optional[Dict[str, Any]]:
|
|
20
|
+
result = self._create_base_result(node)
|
|
21
|
+
|
|
22
|
+
if node.type in ["struct_item", "impl_item", "fn_item", "trait_item"]:
|
|
23
|
+
for child in node.children:
|
|
24
|
+
if child.type == "identifier":
|
|
25
|
+
result["name"] = self.extract_node_text(child, source_code)
|
|
26
|
+
return result
|
|
27
|
+
return result
|
|
28
|
+
|
|
29
|
+
elif node.type in ["static_item", "const_item", "let_declaration"]:
|
|
30
|
+
return self._handle_variable_declaration(node, source_code, result)
|
|
31
|
+
|
|
32
|
+
children = []
|
|
33
|
+
for child in node.children:
|
|
34
|
+
child_result = process_children_callback(child)
|
|
35
|
+
if child_result and self._is_significant_node(child_result):
|
|
36
|
+
children.append(child_result)
|
|
37
|
+
|
|
38
|
+
if children:
|
|
39
|
+
result["children"] = children
|
|
40
|
+
|
|
41
|
+
return result
|
|
42
|
+
|
|
43
|
+
def _handle_variable_declaration(
|
|
44
|
+
self, node, source_code: bytes, result: Dict[str, Any]
|
|
45
|
+
) -> Dict[str, Any]:
|
|
46
|
+
var_name = None
|
|
47
|
+
var_type = None
|
|
48
|
+
|
|
49
|
+
for child in node.children:
|
|
50
|
+
if child.type == "identifier" and var_name is None:
|
|
51
|
+
var_name = self.extract_node_text(child, source_code)
|
|
52
|
+
elif child.type == "pattern":
|
|
53
|
+
if child.children:
|
|
54
|
+
var_name = self.extract_node_text(child.children[0], source_code)
|
|
55
|
+
elif child.type in [
|
|
56
|
+
"type_identifier",
|
|
57
|
+
"generic_type",
|
|
58
|
+
"reference_type",
|
|
59
|
+
"pointer_type",
|
|
60
|
+
"array_type",
|
|
61
|
+
"primitive_type",
|
|
62
|
+
]:
|
|
63
|
+
var_type = self.extract_node_text(child, source_code)
|
|
64
|
+
|
|
65
|
+
if var_name:
|
|
66
|
+
result["type"] = "variable_declaration"
|
|
67
|
+
if var_type:
|
|
68
|
+
result["name"] = f"{var_name}: {var_type}"
|
|
69
|
+
else:
|
|
70
|
+
result["name"] = var_name
|
|
71
|
+
|
|
72
|
+
return result
|