jarvis-ai-assistant 0.1.132__py3-none-any.whl → 0.1.138__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.
Potentially problematic release.
This version of jarvis-ai-assistant might be problematic. Click here for more details.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_agent/__init__.py +330 -347
- jarvis/jarvis_agent/builtin_input_handler.py +16 -6
- jarvis/jarvis_agent/file_input_handler.py +9 -9
- jarvis/jarvis_agent/jarvis.py +143 -0
- jarvis/jarvis_agent/main.py +12 -13
- jarvis/jarvis_agent/output_handler.py +3 -3
- jarvis/jarvis_agent/patch.py +92 -64
- jarvis/jarvis_agent/shell_input_handler.py +5 -3
- jarvis/jarvis_code_agent/code_agent.py +263 -177
- jarvis/jarvis_code_agent/file_select.py +24 -24
- jarvis/jarvis_dev/main.py +45 -59
- jarvis/jarvis_git_details/__init__.py +0 -0
- jarvis/jarvis_git_details/main.py +179 -0
- jarvis/jarvis_git_squash/main.py +7 -7
- jarvis/jarvis_lsp/base.py +11 -53
- jarvis/jarvis_lsp/cpp.py +13 -28
- jarvis/jarvis_lsp/go.py +13 -28
- jarvis/jarvis_lsp/python.py +8 -27
- jarvis/jarvis_lsp/registry.py +21 -83
- jarvis/jarvis_lsp/rust.py +15 -30
- jarvis/jarvis_methodology/main.py +101 -0
- jarvis/jarvis_multi_agent/__init__.py +10 -51
- jarvis/jarvis_multi_agent/main.py +43 -0
- jarvis/jarvis_platform/__init__.py +1 -1
- jarvis/jarvis_platform/ai8.py +67 -89
- jarvis/jarvis_platform/base.py +14 -13
- jarvis/jarvis_platform/kimi.py +25 -28
- jarvis/jarvis_platform/ollama.py +24 -26
- jarvis/jarvis_platform/openai.py +15 -19
- jarvis/jarvis_platform/oyi.py +48 -50
- jarvis/jarvis_platform/registry.py +29 -44
- jarvis/jarvis_platform/yuanbao.py +39 -43
- jarvis/jarvis_platform_manager/main.py +81 -81
- jarvis/jarvis_platform_manager/openai_test.py +21 -21
- jarvis/jarvis_rag/file_processors.py +18 -18
- jarvis/jarvis_rag/main.py +262 -278
- jarvis/jarvis_smart_shell/main.py +12 -12
- jarvis/jarvis_tools/ask_codebase.py +85 -78
- jarvis/jarvis_tools/ask_user.py +8 -8
- jarvis/jarvis_tools/base.py +4 -4
- jarvis/jarvis_tools/chdir.py +9 -9
- jarvis/jarvis_tools/code_review.py +40 -21
- jarvis/jarvis_tools/create_code_agent.py +15 -15
- jarvis/jarvis_tools/create_sub_agent.py +0 -1
- jarvis/jarvis_tools/execute_python_script.py +3 -3
- jarvis/jarvis_tools/execute_shell.py +11 -11
- jarvis/jarvis_tools/execute_shell_script.py +3 -3
- jarvis/jarvis_tools/file_analyzer.py +116 -105
- jarvis/jarvis_tools/file_operation.py +22 -20
- jarvis/jarvis_tools/find_caller.py +105 -40
- jarvis/jarvis_tools/find_methodolopy.py +65 -0
- jarvis/jarvis_tools/find_symbol.py +123 -39
- jarvis/jarvis_tools/function_analyzer.py +140 -57
- jarvis/jarvis_tools/git_commiter.py +10 -10
- jarvis/jarvis_tools/lsp_get_diagnostics.py +19 -19
- jarvis/jarvis_tools/methodology.py +22 -67
- jarvis/jarvis_tools/project_analyzer.py +137 -53
- jarvis/jarvis_tools/rag.py +15 -20
- jarvis/jarvis_tools/read_code.py +25 -23
- jarvis/jarvis_tools/read_webpage.py +31 -31
- jarvis/jarvis_tools/registry.py +72 -52
- jarvis/jarvis_tools/search_web.py +23 -353
- jarvis/jarvis_tools/tool_generator.py +19 -19
- jarvis/jarvis_utils/config.py +36 -96
- jarvis/jarvis_utils/embedding.py +83 -83
- jarvis/jarvis_utils/git_utils.py +20 -20
- jarvis/jarvis_utils/globals.py +18 -6
- jarvis/jarvis_utils/input.py +10 -9
- jarvis/jarvis_utils/methodology.py +141 -140
- jarvis/jarvis_utils/output.py +13 -13
- jarvis/jarvis_utils/utils.py +23 -71
- {jarvis_ai_assistant-0.1.132.dist-info → jarvis_ai_assistant-0.1.138.dist-info}/METADATA +6 -15
- jarvis_ai_assistant-0.1.138.dist-info/RECORD +85 -0
- {jarvis_ai_assistant-0.1.132.dist-info → jarvis_ai_assistant-0.1.138.dist-info}/entry_points.txt +4 -3
- jarvis/jarvis_tools/lsp_find_definition.py +0 -150
- jarvis/jarvis_tools/lsp_find_references.py +0 -127
- jarvis/jarvis_tools/select_code_files.py +0 -62
- jarvis_ai_assistant-0.1.132.dist-info/RECORD +0 -82
- {jarvis_ai_assistant-0.1.132.dist-info → jarvis_ai_assistant-0.1.138.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.132.dist-info → jarvis_ai_assistant-0.1.138.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.132.dist-info → jarvis_ai_assistant-0.1.138.dist-info}/top_level.txt +0 -0
|
@@ -4,6 +4,7 @@ import os
|
|
|
4
4
|
|
|
5
5
|
from yaspin import yaspin
|
|
6
6
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
|
7
|
+
from jarvis.jarvis_tools.read_code import ReadCodeTool
|
|
7
8
|
from jarvis.jarvis_tools.registry import ToolRegistry
|
|
8
9
|
from jarvis.jarvis_agent import Agent
|
|
9
10
|
import re
|
|
@@ -52,14 +53,14 @@ class CodeReviewTool:
|
|
|
52
53
|
try:
|
|
53
54
|
review_type = args.get("review_type", "current").strip()
|
|
54
55
|
root_dir = args.get("root_dir", ".")
|
|
55
|
-
|
|
56
|
+
|
|
56
57
|
# Store current directory
|
|
57
58
|
original_dir = os.getcwd()
|
|
58
|
-
|
|
59
|
+
|
|
59
60
|
try:
|
|
60
61
|
# Change to root_dir
|
|
61
62
|
os.chdir(root_dir)
|
|
62
|
-
|
|
63
|
+
|
|
63
64
|
# Build git diff command based on review type
|
|
64
65
|
with yaspin(text="正在获取代码变更...", color="cyan") as spinner:
|
|
65
66
|
if review_type == "commit":
|
|
@@ -89,10 +90,10 @@ class CodeReviewTool:
|
|
|
89
90
|
"stderr": "file_path is required for file review type"
|
|
90
91
|
}
|
|
91
92
|
file_path = args["file_path"].strip()
|
|
92
|
-
diff_cmd =
|
|
93
|
+
diff_cmd = ReadCodeTool().execute({"files": [{"path": file_path}]})["stdout"]
|
|
93
94
|
else: # current changes
|
|
94
95
|
diff_cmd = "git diff HEAD | cat -"
|
|
95
|
-
|
|
96
|
+
|
|
96
97
|
# Execute git diff command
|
|
97
98
|
try:
|
|
98
99
|
diff_output = subprocess.check_output(diff_cmd, shell=True, text=True)
|
|
@@ -114,6 +115,25 @@ class CodeReviewTool:
|
|
|
114
115
|
|
|
115
116
|
system_prompt = """你是一位精益求精的首席代码审查专家,拥有多年企业级代码审计经验。你需要对所有代码变更进行极其全面、严谨且深入的审查,确保代码质量达到最高标准。
|
|
116
117
|
|
|
118
|
+
# 代码审查工具选择
|
|
119
|
+
优先使用执行shell命令进行静态分析,而非依赖内置代码审查功能:
|
|
120
|
+
|
|
121
|
+
| 分析需求 | 首选工具 | 备选工具 |
|
|
122
|
+
|---------|---------|----------|
|
|
123
|
+
| 代码质量检查 | execute_shell | - |
|
|
124
|
+
| 语法检查 | 语言特定lint工具 | - |
|
|
125
|
+
| 安全分析 | 安全扫描工具 | - |
|
|
126
|
+
| 代码统计 | loc | - |
|
|
127
|
+
|
|
128
|
+
# 推荐命令
|
|
129
|
+
- Python: `pylint <file_path>`, `flake8 <file_path>`, `mypy <file_path>`
|
|
130
|
+
- JavaScript/TypeScript: `eslint <file_path>`, `tsc --noEmit <file_path>`
|
|
131
|
+
- Java: `checkstyle <file_path>`, `pmd -d <file_path>`
|
|
132
|
+
- C/C++: `cppcheck <file_path>`, `clang-tidy <file_path>`
|
|
133
|
+
- Go: `golint <file_path>`, `go vet <file_path>`
|
|
134
|
+
- Rust: `cargo clippy`, `rustfmt --check <file_path>`
|
|
135
|
+
- 通用搜索:`rg "pattern" <files>` 查找特定代码模式
|
|
136
|
+
|
|
117
137
|
# 专家审查标准
|
|
118
138
|
1. 必须逐行分析每个修改文件,细致审查每一处变更,不遗漏任何细节
|
|
119
139
|
2. 基于坚实的证据识别问题,不做主观臆测,给出明确的问题定位和详细分析
|
|
@@ -204,9 +224,9 @@ class CodeReviewTool:
|
|
|
204
224
|
- **位置**: [起始行号-结束行号]
|
|
205
225
|
- **分类**: [使用SCRIPPPS框架中相关类别]
|
|
206
226
|
- **严重程度**: [P0/P1/P2/P3] - [简要说明判定理由]
|
|
207
|
-
- **问题描述**:
|
|
227
|
+
- **问题描述**:
|
|
208
228
|
[详细描述问题,包括技术原理和潜在影响]
|
|
209
|
-
- **改进建议**:
|
|
229
|
+
- **改进建议**:
|
|
210
230
|
```
|
|
211
231
|
[提供完整、可执行的代码示例,而非概念性建议]
|
|
212
232
|
```
|
|
@@ -226,7 +246,6 @@ class CodeReviewTool:
|
|
|
226
246
|
|
|
227
247
|
如果没有发现任何问题,请在REPORT标签内进行全面分析后明确说明"经过全面审查,未发现问题"并解释原因。
|
|
228
248
|
必须确保对所有修改的文件都进行了审查,并在报告中明确提及每个文件,即使某些文件没有发现问题。""",
|
|
229
|
-
is_sub_agent=True,
|
|
230
249
|
output_handler=[tool_registry],
|
|
231
250
|
platform=PlatformRegistry().get_thinking_platform(),
|
|
232
251
|
auto_complete=True
|
|
@@ -240,14 +259,14 @@ class CodeReviewTool:
|
|
|
240
259
|
finally:
|
|
241
260
|
# Always restore original directory
|
|
242
261
|
os.chdir(original_dir)
|
|
243
|
-
|
|
262
|
+
|
|
244
263
|
except Exception as e:
|
|
245
264
|
return {
|
|
246
265
|
"success": False,
|
|
247
266
|
"stdout": {},
|
|
248
267
|
"stderr": f"Review failed: {str(e)}"
|
|
249
268
|
}
|
|
250
|
-
|
|
269
|
+
|
|
251
270
|
|
|
252
271
|
def extract_code_report(result: str) -> str:
|
|
253
272
|
sm = re.search(ot("REPORT")+r'\n(.*?)\n'+ct("REPORT"), result, re.DOTALL)
|
|
@@ -260,33 +279,33 @@ def main():
|
|
|
260
279
|
import argparse
|
|
261
280
|
|
|
262
281
|
init_env()
|
|
263
|
-
|
|
282
|
+
|
|
264
283
|
parser = argparse.ArgumentParser(description='Autonomous code review tool')
|
|
265
284
|
subparsers = parser.add_subparsers(dest='type')
|
|
266
|
-
|
|
285
|
+
|
|
267
286
|
# Commit subcommand
|
|
268
287
|
commit_parser = subparsers.add_parser('commit', help='Review specific commit')
|
|
269
288
|
commit_parser.add_argument('commit', help='Commit SHA to review')
|
|
270
|
-
|
|
289
|
+
|
|
271
290
|
# Current subcommand
|
|
272
291
|
current_parser = subparsers.add_parser('current', help='Review current changes')
|
|
273
|
-
|
|
292
|
+
|
|
274
293
|
# Range subcommand
|
|
275
294
|
range_parser = subparsers.add_parser('range', help='Review commit range')
|
|
276
295
|
range_parser.add_argument('start_commit', help='Start commit SHA')
|
|
277
296
|
range_parser.add_argument('end_commit', help='End commit SHA')
|
|
278
|
-
|
|
297
|
+
|
|
279
298
|
# File subcommand
|
|
280
299
|
file_parser = subparsers.add_parser('file', help='Review specific file')
|
|
281
300
|
file_parser.add_argument('file', help='File path to review')
|
|
282
|
-
|
|
301
|
+
|
|
283
302
|
# Common arguments
|
|
284
303
|
parser.add_argument('--root-dir', type=str, help='Root directory of the codebase', default=".")
|
|
285
|
-
|
|
304
|
+
|
|
286
305
|
# Set default subcommand to 'current'
|
|
287
306
|
parser.set_defaults(type='current')
|
|
288
307
|
args = parser.parse_args()
|
|
289
|
-
|
|
308
|
+
|
|
290
309
|
tool = CodeReviewTool()
|
|
291
310
|
tool_args = {
|
|
292
311
|
"review_type": args.type,
|
|
@@ -299,14 +318,14 @@ def main():
|
|
|
299
318
|
tool_args["end_commit"] = args.end_commit
|
|
300
319
|
elif args.type == 'file':
|
|
301
320
|
tool_args["file_path"] = args.file
|
|
302
|
-
|
|
321
|
+
|
|
303
322
|
result = tool.execute(tool_args)
|
|
304
|
-
|
|
323
|
+
|
|
305
324
|
if result["success"]:
|
|
306
325
|
PrettyOutput.section("自动代码审查结果:", OutputType.SUCCESS)
|
|
307
326
|
report = extract_code_report(result["stdout"])
|
|
308
327
|
PrettyOutput.print(report, OutputType.SUCCESS, lang="markdown")
|
|
309
|
-
|
|
328
|
+
|
|
310
329
|
else:
|
|
311
330
|
PrettyOutput.print(result["stderr"], OutputType.WARNING)
|
|
312
331
|
|
|
@@ -8,7 +8,7 @@ from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
|
8
8
|
|
|
9
9
|
class CreateCodeAgentTool:
|
|
10
10
|
"""用于管理代码开发工作流的工具"""
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
name = "create_code_agent"
|
|
13
13
|
description = "技术代码实现和开发过程管理工具"
|
|
14
14
|
parameters = {
|
|
@@ -25,16 +25,16 @@ class CreateCodeAgentTool:
|
|
|
25
25
|
"default": "."
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
|
|
29
|
+
|
|
30
30
|
def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
|
|
31
31
|
try:
|
|
32
32
|
requirement = args.get("requirement", "")
|
|
33
33
|
root_dir = args.get("root_dir", ".")
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
# Store current directory
|
|
36
36
|
original_dir = os.getcwd()
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
try:
|
|
39
39
|
# Change to root_dir
|
|
40
40
|
os.chdir(root_dir)
|
|
@@ -44,7 +44,7 @@ class CreateCodeAgentTool:
|
|
|
44
44
|
"stderr": "Requirement must be provided",
|
|
45
45
|
"stdout": ""
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
# Step 1: Handle uncommitted changes
|
|
49
49
|
start_commit = None
|
|
50
50
|
if has_uncommitted_changes():
|
|
@@ -57,18 +57,18 @@ class CreateCodeAgentTool:
|
|
|
57
57
|
"stderr": "Failed to commit changes: " + result["stderr"],
|
|
58
58
|
"stdout": ""
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
# Get current commit hash
|
|
62
62
|
start_commit = get_latest_commit_hash()
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
# Step 2: Development
|
|
65
65
|
PrettyOutput.print("开始开发...", OutputType.INFO)
|
|
66
66
|
agent = CodeAgent()
|
|
67
67
|
agent.run(requirement)
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
# Get new commit hash after development
|
|
70
70
|
end_commit = get_latest_commit_hash()
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
# Step 3: Code Review
|
|
73
73
|
PrettyOutput.print("开始代码审查...", OutputType.INFO)
|
|
74
74
|
reviewer = CodeReviewTool()
|
|
@@ -78,17 +78,17 @@ class CreateCodeAgentTool:
|
|
|
78
78
|
"end_commit": end_commit,
|
|
79
79
|
"root_dir": root_dir
|
|
80
80
|
})
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
if not review_result["success"]:
|
|
83
83
|
return {
|
|
84
84
|
"success": False,
|
|
85
85
|
"stderr": "Code review failed: " + review_result["stderr"],
|
|
86
86
|
"stdout": ""
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
# Step 4: Generate Summary
|
|
90
90
|
summary = f"""开发总结:
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
开始提交: {start_commit}
|
|
93
93
|
结束提交: {end_commit}
|
|
94
94
|
|
|
@@ -98,7 +98,7 @@ class CreateCodeAgentTool:
|
|
|
98
98
|
代码审查结果:
|
|
99
99
|
{extract_code_report(review_result["stdout"])}
|
|
100
100
|
"""
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
return {
|
|
103
103
|
"success": True,
|
|
104
104
|
"stdout": summary,
|
|
@@ -107,7 +107,7 @@ class CreateCodeAgentTool:
|
|
|
107
107
|
finally:
|
|
108
108
|
# Always restore original directory
|
|
109
109
|
os.chdir(original_dir)
|
|
110
|
-
|
|
110
|
+
|
|
111
111
|
except Exception as e:
|
|
112
112
|
return {
|
|
113
113
|
"success": False,
|
|
@@ -29,7 +29,7 @@ class PythonScriptTool:
|
|
|
29
29
|
"stdout": "",
|
|
30
30
|
"stderr": "Missing or empty script_content parameter"
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
# Create temporary script file
|
|
34
34
|
script_path = os.path.join(tempfile.gettempdir(), f"jarvis_script_{os.getpid()}.py")
|
|
35
35
|
try:
|
|
@@ -39,7 +39,7 @@ class PythonScriptTool:
|
|
|
39
39
|
from jarvis.jarvis_tools.execute_shell import ShellTool
|
|
40
40
|
shell_tool = ShellTool()
|
|
41
41
|
result = shell_tool.execute({"command": f"python3 {script_path}"})
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
return {
|
|
44
44
|
"success": result["success"],
|
|
45
45
|
"stdout": result["stdout"],
|
|
@@ -48,7 +48,7 @@ class PythonScriptTool:
|
|
|
48
48
|
finally:
|
|
49
49
|
# Clean up temporary script file
|
|
50
50
|
Path(script_path).unlink(missing_ok=True)
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
except Exception as e:
|
|
53
53
|
PrettyOutput.print(str(e), OutputType.ERROR)
|
|
54
54
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Shell command execution module
|
|
2
|
-
#
|
|
2
|
+
#
|
|
3
3
|
# Provides functionality to execute shell commands safely with:
|
|
4
4
|
# - Command escaping
|
|
5
5
|
# - Output capturing
|
|
@@ -12,7 +12,7 @@ from pathlib import Path
|
|
|
12
12
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
|
13
13
|
class ShellTool:
|
|
14
14
|
"""Shell command execution tool
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
Attributes:
|
|
17
17
|
name: Tool identifier used in API
|
|
18
18
|
description: Tool description for API documentation
|
|
@@ -32,10 +32,10 @@ class ShellTool:
|
|
|
32
32
|
}
|
|
33
33
|
def _escape_command(self, cmd: str) -> str:
|
|
34
34
|
"""Escape special characters in command to prevent shell injection
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
Args:
|
|
37
37
|
cmd: Raw command string
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
Returns:
|
|
40
40
|
Escaped command string with single quotes properly handled
|
|
41
41
|
"""
|
|
@@ -44,21 +44,21 @@ class ShellTool:
|
|
|
44
44
|
try:
|
|
45
45
|
# Get and clean command input
|
|
46
46
|
command = args["command"].strip()
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
# Generate temporary file name using process ID for uniqueness
|
|
49
49
|
script_file = os.path.join(tempfile.gettempdir(), f"jarvis_shell_{os.getpid()}.sh")
|
|
50
50
|
output_file = os.path.join(tempfile.gettempdir(), f"jarvis_shell_{os.getpid()}.log")
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
# Write command to script file
|
|
53
53
|
with open(script_file, 'w', encoding='utf-8') as f:
|
|
54
54
|
f.write(f"#!/bin/bash\n{command}")
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
# Use script command to capture both stdout and stderr
|
|
57
57
|
tee_command = f"script -q -c 'bash {script_file}' {output_file}"
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
# Execute command and capture return code
|
|
60
60
|
os.system(tee_command)
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
# Read and process output file
|
|
63
63
|
try:
|
|
64
64
|
with open(output_file, 'r', encoding='utf-8', errors='ignore') as f:
|
|
@@ -74,14 +74,14 @@ class ShellTool:
|
|
|
74
74
|
# Clean up temporary files
|
|
75
75
|
Path(script_file).unlink(missing_ok=True)
|
|
76
76
|
Path(output_file).unlink(missing_ok=True)
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
# Return successful result
|
|
79
79
|
return {
|
|
80
80
|
"success": True,
|
|
81
81
|
"stdout": output,
|
|
82
82
|
"stderr": "",
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
except Exception as e:
|
|
86
86
|
# Ensure temporary files are cleaned up even if error occurs
|
|
87
87
|
if 'script_file' in locals():
|
|
@@ -29,7 +29,7 @@ class ShellScriptTool:
|
|
|
29
29
|
"stdout": "",
|
|
30
30
|
"stderr": "Missing or empty script_content parameter"
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
# Create temporary script file
|
|
34
34
|
script_path = os.path.join(tempfile.gettempdir(), f"jarvis_shell_script_{os.getpid()}.sh")
|
|
35
35
|
try:
|
|
@@ -39,7 +39,7 @@ class ShellScriptTool:
|
|
|
39
39
|
from jarvis.jarvis_tools.execute_shell import ShellTool
|
|
40
40
|
shell_tool = ShellTool()
|
|
41
41
|
result = shell_tool.execute({"command": f"bash {script_path}"})
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
return {
|
|
44
44
|
"success": result["success"],
|
|
45
45
|
"stdout": result["stdout"],
|
|
@@ -48,7 +48,7 @@ class ShellScriptTool:
|
|
|
48
48
|
finally:
|
|
49
49
|
# Clean up temporary script file
|
|
50
50
|
Path(script_path).unlink(missing_ok=True)
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
except Exception as e:
|
|
53
53
|
PrettyOutput.print(str(e), OutputType.ERROR)
|
|
54
54
|
return {
|