jarvis-ai-assistant 0.1.193__py3-none-any.whl → 0.1.195__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.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_agent/__init__.py +45 -41
- jarvis/jarvis_agent/builtin_input_handler.py +26 -4
- jarvis/jarvis_agent/jarvis.py +30 -19
- jarvis/jarvis_agent/main.py +20 -12
- jarvis/jarvis_agent/output_handler.py +7 -7
- jarvis/jarvis_agent/shell_input_handler.py +14 -11
- jarvis/jarvis_code_agent/code_agent.py +81 -79
- jarvis/jarvis_code_agent/lint.py +92 -105
- jarvis/jarvis_code_analysis/checklists/__init__.py +1 -1
- jarvis/jarvis_code_analysis/checklists/c_cpp.py +1 -1
- jarvis/jarvis_code_analysis/checklists/csharp.py +1 -1
- jarvis/jarvis_code_analysis/checklists/data_format.py +1 -1
- jarvis/jarvis_code_analysis/checklists/devops.py +1 -1
- jarvis/jarvis_code_analysis/checklists/docs.py +1 -1
- jarvis/jarvis_code_analysis/checklists/go.py +1 -1
- jarvis/jarvis_code_analysis/checklists/infrastructure.py +1 -1
- jarvis/jarvis_code_analysis/checklists/java.py +1 -1
- jarvis/jarvis_code_analysis/checklists/javascript.py +1 -1
- jarvis/jarvis_code_analysis/checklists/kotlin.py +1 -1
- jarvis/jarvis_code_analysis/checklists/loader.py +31 -29
- jarvis/jarvis_code_analysis/checklists/php.py +1 -1
- jarvis/jarvis_code_analysis/checklists/python.py +1 -1
- jarvis/jarvis_code_analysis/checklists/ruby.py +1 -1
- jarvis/jarvis_code_analysis/checklists/rust.py +1 -1
- jarvis/jarvis_code_analysis/checklists/shell.py +1 -1
- jarvis/jarvis_code_analysis/checklists/sql.py +1 -1
- jarvis/jarvis_code_analysis/checklists/swift.py +1 -1
- jarvis/jarvis_code_analysis/checklists/web.py +1 -1
- jarvis/jarvis_code_analysis/code_review.py +292 -190
- jarvis/jarvis_dev/main.py +73 -56
- jarvis/jarvis_git_details/main.py +29 -33
- jarvis/jarvis_git_squash/main.py +13 -11
- jarvis/jarvis_git_utils/git_commiter.py +15 -5
- jarvis/jarvis_mcp/__init__.py +8 -10
- jarvis/jarvis_mcp/sse_mcp_client.py +182 -205
- jarvis/jarvis_mcp/stdio_mcp_client.py +93 -120
- jarvis/jarvis_mcp/streamable_mcp_client.py +117 -142
- jarvis/jarvis_methodology/main.py +71 -39
- jarvis/jarvis_multi_agent/__init__.py +24 -16
- jarvis/jarvis_multi_agent/main.py +10 -4
- jarvis/jarvis_platform/__init__.py +1 -1
- jarvis/jarvis_platform/base.py +44 -18
- jarvis/jarvis_platform/human.py +15 -3
- jarvis/jarvis_platform/kimi.py +117 -81
- jarvis/jarvis_platform/openai.py +23 -28
- jarvis/jarvis_platform/registry.py +43 -29
- jarvis/jarvis_platform/tongyi.py +16 -10
- jarvis/jarvis_platform/yuanbao.py +197 -144
- jarvis/jarvis_platform_manager/main.py +4 -2
- jarvis/jarvis_smart_shell/main.py +35 -30
- jarvis/jarvis_tools/ask_user.py +8 -16
- jarvis/jarvis_tools/base.py +3 -2
- jarvis/jarvis_tools/chdir.py +7 -19
- jarvis/jarvis_tools/cli/main.py +14 -10
- jarvis/jarvis_tools/code_plan.py +10 -31
- jarvis/jarvis_tools/create_code_agent.py +6 -11
- jarvis/jarvis_tools/create_sub_agent.py +10 -22
- jarvis/jarvis_tools/edit_file.py +98 -76
- jarvis/jarvis_tools/execute_script.py +46 -46
- jarvis/jarvis_tools/file_analyzer.py +22 -34
- jarvis/jarvis_tools/file_operation.py +69 -62
- jarvis/jarvis_tools/generate_new_tool.py +0 -2
- jarvis/jarvis_tools/methodology.py +19 -23
- jarvis/jarvis_tools/read_code.py +35 -35
- jarvis/jarvis_tools/read_webpage.py +7 -16
- jarvis/jarvis_tools/registry.py +63 -30
- jarvis/jarvis_tools/rewrite_file.py +26 -29
- jarvis/jarvis_tools/search_web.py +5 -8
- jarvis/jarvis_tools/virtual_tty.py +133 -122
- jarvis/jarvis_utils/__init__.py +0 -1
- jarvis/jarvis_utils/builtin_replace_map.py +9 -9
- jarvis/jarvis_utils/config.py +60 -37
- jarvis/jarvis_utils/embedding.py +24 -19
- jarvis/jarvis_utils/file_processors.py +16 -9
- jarvis/jarvis_utils/git_utils.py +157 -107
- jarvis/jarvis_utils/globals.py +1 -1
- jarvis/jarvis_utils/input.py +85 -52
- jarvis/jarvis_utils/jarvis_history.py +43 -0
- jarvis/jarvis_utils/methodology.py +31 -24
- jarvis/jarvis_utils/output.py +164 -80
- jarvis/jarvis_utils/tag.py +2 -1
- jarvis/jarvis_utils/utils.py +84 -52
- {jarvis_ai_assistant-0.1.193.dist-info → jarvis_ai_assistant-0.1.195.dist-info}/METADATA +362 -230
- jarvis_ai_assistant-0.1.195.dist-info/RECORD +98 -0
- jarvis/jarvis_agent/file_input_handler.py +0 -112
- jarvis/jarvis_event/__init__.py +0 -0
- jarvis_ai_assistant-0.1.193.dist-info/RECORD +0 -99
- {jarvis_ai_assistant-0.1.193.dist-info → jarvis_ai_assistant-0.1.195.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.193.dist-info → jarvis_ai_assistant-0.1.195.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.193.dist-info → jarvis_ai_assistant-0.1.195.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.193.dist-info → jarvis_ai_assistant-0.1.195.dist-info}/top_level.txt +0 -0
jarvis/jarvis_dev/main.py
CHANGED
@@ -950,74 +950,87 @@ content: |2
|
|
950
950
|
</quality_assurance_guide>
|
951
951
|
"""
|
952
952
|
|
953
|
+
|
953
954
|
def create_dev_team() -> MultiAgent:
|
954
955
|
"""Create a development team with multiple agents."""
|
955
956
|
|
956
957
|
PM_output_handler = ToolRegistry()
|
957
|
-
PM_output_handler.use_tools(
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
958
|
+
PM_output_handler.use_tools(
|
959
|
+
[
|
960
|
+
"ask_user",
|
961
|
+
"file_operation",
|
962
|
+
"search_web",
|
963
|
+
"execute_script",
|
964
|
+
"methodology",
|
965
|
+
"edit_file",
|
966
|
+
"rewrite_file",
|
967
|
+
]
|
968
|
+
)
|
966
969
|
|
967
970
|
BA_output_handler = ToolRegistry()
|
968
|
-
BA_output_handler.use_tools(
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
971
|
+
BA_output_handler.use_tools(
|
972
|
+
[
|
973
|
+
"ask_user",
|
974
|
+
"file_operation",
|
975
|
+
"search_web",
|
976
|
+
"execute_script",
|
977
|
+
"read_webpage",
|
978
|
+
"methodology",
|
979
|
+
"edit_file",
|
980
|
+
"rewrite_file",
|
981
|
+
]
|
982
|
+
)
|
978
983
|
|
979
984
|
SA_output_handler = ToolRegistry()
|
980
|
-
SA_output_handler.use_tools(
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
985
|
+
SA_output_handler.use_tools(
|
986
|
+
[
|
987
|
+
"file_operation",
|
988
|
+
"search_web",
|
989
|
+
"execute_script",
|
990
|
+
"read_code",
|
991
|
+
"methodology",
|
992
|
+
"edit_file",
|
993
|
+
"rewrite_file",
|
994
|
+
]
|
995
|
+
)
|
989
996
|
|
990
997
|
TL_output_handler = ToolRegistry()
|
991
|
-
TL_output_handler.use_tools(
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
+
TL_output_handler.use_tools(
|
999
|
+
[
|
1000
|
+
"file_operation",
|
1001
|
+
"execute_script",
|
1002
|
+
"methodology",
|
1003
|
+
"edit_file",
|
1004
|
+
"rewrite_file",
|
1005
|
+
]
|
1006
|
+
)
|
998
1007
|
|
999
1008
|
DEV_output_handler = ToolRegistry()
|
1000
|
-
DEV_output_handler.use_tools(
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1009
|
+
DEV_output_handler.use_tools(
|
1010
|
+
[
|
1011
|
+
"create_code_agent",
|
1012
|
+
"file_operation",
|
1013
|
+
"execute_script",
|
1014
|
+
"read_code",
|
1015
|
+
"create_sub_agent",
|
1016
|
+
"methodology",
|
1017
|
+
"edit_file",
|
1018
|
+
"rewrite_file",
|
1019
|
+
]
|
1020
|
+
)
|
1010
1021
|
|
1011
1022
|
QA_output_handler = ToolRegistry()
|
1012
|
-
QA_output_handler.use_tools(
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1023
|
+
QA_output_handler.use_tools(
|
1024
|
+
[
|
1025
|
+
"create_code_agent",
|
1026
|
+
"file_operation",
|
1027
|
+
"execute_script",
|
1028
|
+
"read_code",
|
1029
|
+
"methodology",
|
1030
|
+
"edit_file",
|
1031
|
+
"rewrite_file",
|
1032
|
+
]
|
1033
|
+
)
|
1021
1034
|
|
1022
1035
|
# Update PM prompt with tool usage guidance
|
1023
1036
|
PM_PROMPT_EXTENSION = """
|
@@ -1196,11 +1209,12 @@ def create_dev_team() -> MultiAgent:
|
|
1196
1209
|
system_prompt=QA_PROMPT_WITH_TOOLS,
|
1197
1210
|
output_handler=[QA_output_handler],
|
1198
1211
|
platform=PlatformRegistry().get_normal_platform(),
|
1199
|
-
)
|
1212
|
+
),
|
1200
1213
|
]
|
1201
1214
|
|
1202
1215
|
return MultiAgent(configs, "PM")
|
1203
1216
|
|
1217
|
+
|
1204
1218
|
def main():
|
1205
1219
|
"""Main entry point for the development team simulation."""
|
1206
1220
|
|
@@ -1212,7 +1226,9 @@ def main():
|
|
1212
1226
|
# Start interaction loop
|
1213
1227
|
while True:
|
1214
1228
|
try:
|
1215
|
-
user_input = get_multiline_input(
|
1229
|
+
user_input = get_multiline_input(
|
1230
|
+
"\nEnter your request (or press Enter to exit): "
|
1231
|
+
)
|
1216
1232
|
if not user_input:
|
1217
1233
|
break
|
1218
1234
|
|
@@ -1226,5 +1242,6 @@ def main():
|
|
1226
1242
|
PrettyOutput.print(f"Error: {str(e)}", output_type=OutputType.SYSTEM)
|
1227
1243
|
continue
|
1228
1244
|
|
1245
|
+
|
1229
1246
|
if __name__ == "__main__":
|
1230
1247
|
main()
|
@@ -54,7 +54,7 @@ class GitCommitAnalyzer:
|
|
54
54
|
return {
|
55
55
|
"success": False,
|
56
56
|
"stdout": {},
|
57
|
-
"stderr": f"Failed to analyze commit: {str(e)}"
|
57
|
+
"stderr": f"Failed to analyze commit: {str(e)}",
|
58
58
|
}
|
59
59
|
|
60
60
|
def analyze_single_commit(self, commit_sha: str, root_dir: str) -> Dict[str, Any]:
|
@@ -73,16 +73,12 @@ class GitCommitAnalyzer:
|
|
73
73
|
|
74
74
|
# 获取commit详细信息
|
75
75
|
commit_info = subprocess.check_output(
|
76
|
-
f"git show {commit_sha} --pretty=fuller",
|
77
|
-
shell=True,
|
78
|
-
text=True
|
76
|
+
f"git show {commit_sha} --pretty=fuller", shell=True, text=True
|
79
77
|
)
|
80
78
|
|
81
79
|
# 获取commit修改内容
|
82
80
|
diff_content = subprocess.check_output(
|
83
|
-
f"git show {commit_sha} --patch",
|
84
|
-
shell=True,
|
85
|
-
text=True
|
81
|
+
f"git show {commit_sha} --patch", shell=True, text=True
|
86
82
|
)
|
87
83
|
|
88
84
|
# 分析commit的功能、原因和逻辑
|
@@ -93,15 +89,15 @@ class GitCommitAnalyzer:
|
|
93
89
|
"stdout": {
|
94
90
|
"commit_info": commit_info,
|
95
91
|
"diff_content": diff_content,
|
96
|
-
"analysis_result": analysis_result
|
92
|
+
"analysis_result": analysis_result,
|
97
93
|
},
|
98
|
-
"stderr": ""
|
94
|
+
"stderr": "",
|
99
95
|
}
|
100
96
|
except subprocess.CalledProcessError as error:
|
101
97
|
return {
|
102
98
|
"success": False,
|
103
99
|
"stdout": {},
|
104
|
-
"stderr": f"Failed to analyze commit: {str(error)}"
|
100
|
+
"stderr": f"Failed to analyze commit: {str(error)}",
|
105
101
|
}
|
106
102
|
finally:
|
107
103
|
os.chdir(original_dir)
|
@@ -122,16 +118,12 @@ class GitCommitAnalyzer:
|
|
122
118
|
|
123
119
|
# 获取commit范围差异
|
124
120
|
diff_content = subprocess.check_output(
|
125
|
-
f"git diff {commit_range} --patch",
|
126
|
-
shell=True,
|
127
|
-
text=True
|
121
|
+
f"git diff {commit_range} --patch", shell=True, text=True
|
128
122
|
)
|
129
123
|
|
130
124
|
# 获取commit范围信息
|
131
125
|
commit_info = subprocess.check_output(
|
132
|
-
f"git log {commit_range} --pretty=fuller",
|
133
|
-
shell=True,
|
134
|
-
text=True
|
126
|
+
f"git log {commit_range} --pretty=fuller", shell=True, text=True
|
135
127
|
)
|
136
128
|
|
137
129
|
# 使用相同的分析方法处理差异内容
|
@@ -142,15 +134,15 @@ class GitCommitAnalyzer:
|
|
142
134
|
"stdout": {
|
143
135
|
"commit_info": commit_info,
|
144
136
|
"diff_content": diff_content,
|
145
|
-
"analysis_result": analysis_result
|
137
|
+
"analysis_result": analysis_result,
|
146
138
|
},
|
147
|
-
"stderr": ""
|
139
|
+
"stderr": "",
|
148
140
|
}
|
149
141
|
except subprocess.CalledProcessError as error:
|
150
142
|
return {
|
151
143
|
"success": False,
|
152
144
|
"stdout": {},
|
153
|
-
"stderr": f"Failed to analyze commit range: {str(error)}"
|
145
|
+
"stderr": f"Failed to analyze commit range: {str(error)}",
|
154
146
|
}
|
155
147
|
finally:
|
156
148
|
os.chdir(original_dir)
|
@@ -208,7 +200,7 @@ class GitCommitAnalyzer:
|
|
208
200
|
{ct("REPORT")}""",
|
209
201
|
output_handler=[tool_registry],
|
210
202
|
platform=PlatformRegistry().get_normal_platform(),
|
211
|
-
auto_complete=True
|
203
|
+
auto_complete=True,
|
212
204
|
)
|
213
205
|
|
214
206
|
return agent.run(diff_content)
|
@@ -223,7 +215,9 @@ def extract_analysis_report(result: str) -> str:
|
|
223
215
|
Returns:
|
224
216
|
提取的报告内容,如果未找到REPORT标签则返回空字符串
|
225
217
|
"""
|
226
|
-
search_match = re.search(
|
218
|
+
search_match = re.search(
|
219
|
+
ot("REPORT") + r"\n(.*?)\n" + ct("REPORT"), result, re.DOTALL
|
220
|
+
)
|
227
221
|
if search_match:
|
228
222
|
return search_match.group(1)
|
229
223
|
return result
|
@@ -235,25 +229,27 @@ def main():
|
|
235
229
|
|
236
230
|
init_env("欢迎使用 Jarvis-GitCommitAnalyzer,您的Git Commit分析助手已准备就绪!")
|
237
231
|
|
238
|
-
parser = argparse.ArgumentParser(description=
|
232
|
+
parser = argparse.ArgumentParser(description="Git Commit Analyzer")
|
239
233
|
group = parser.add_mutually_exclusive_group(required=True)
|
240
|
-
group.add_argument(
|
241
|
-
group.add_argument(
|
242
|
-
|
234
|
+
group.add_argument("commit", nargs="?", help="Commit SHA to analyze")
|
235
|
+
group.add_argument(
|
236
|
+
"--range", type=str, help="Commit range to analyze (commit1..commit2)"
|
237
|
+
)
|
238
|
+
parser.add_argument(
|
239
|
+
"--root-dir", type=str, help="Root directory of the codebase", default="."
|
240
|
+
)
|
243
241
|
|
244
242
|
args = parser.parse_args()
|
245
243
|
|
246
244
|
analyzer = GitCommitAnalyzer()
|
247
245
|
if args.range:
|
248
|
-
result = analyzer.execute(
|
249
|
-
"commit_range": args.range,
|
250
|
-
|
251
|
-
})
|
246
|
+
result = analyzer.execute(
|
247
|
+
{"commit_range": args.range, "root_dir": args.root_dir}
|
248
|
+
)
|
252
249
|
else:
|
253
|
-
result = analyzer.execute(
|
254
|
-
"commit_sha": args.commit,
|
255
|
-
|
256
|
-
})
|
250
|
+
result = analyzer.execute(
|
251
|
+
{"commit_sha": args.commit, "root_dir": args.root_dir}
|
252
|
+
)
|
257
253
|
|
258
254
|
if result["success"]:
|
259
255
|
PrettyOutput.section("Commit Information:", OutputType.SUCCESS)
|
jarvis/jarvis_git_squash/main.py
CHANGED
@@ -12,7 +12,7 @@ from jarvis.jarvis_utils.utils import init_env, user_confirm
|
|
12
12
|
class GitSquashTool:
|
13
13
|
name = "git_squash_agent"
|
14
14
|
description = "Squash commits interactively using a base commit hash"
|
15
|
-
labels = [
|
15
|
+
labels = ["git", "version_control", "squash"]
|
16
16
|
|
17
17
|
def _confirm_squash(self) -> bool:
|
18
18
|
"""Prompt user for confirmation to squash commits"""
|
@@ -24,7 +24,7 @@ class GitSquashTool:
|
|
24
24
|
subprocess.Popen(
|
25
25
|
["git", "reset", "--mixed", commit_hash],
|
26
26
|
stdout=subprocess.DEVNULL,
|
27
|
-
stderr=subprocess.DEVNULL
|
27
|
+
stderr=subprocess.DEVNULL,
|
28
28
|
).wait()
|
29
29
|
return True
|
30
30
|
except Exception:
|
@@ -37,27 +37,29 @@ class GitSquashTool:
|
|
37
37
|
PrettyOutput.print("操作已取消", OutputType.WARNING)
|
38
38
|
return
|
39
39
|
|
40
|
-
if not self._reset_to_commit(args[
|
40
|
+
if not self._reset_to_commit(args["commit_hash"]):
|
41
41
|
PrettyOutput.print("重置到指定提交失败", OutputType.WARNING)
|
42
42
|
return
|
43
43
|
|
44
44
|
# Use existing GitCommitTool for new commit
|
45
45
|
commit_tool = GitCommitTool()
|
46
|
-
commit_tool.execute({"lang": args.get(
|
46
|
+
commit_tool.execute({"lang": args.get("lang", "Chinese")})
|
47
47
|
except Exception as e:
|
48
48
|
PrettyOutput.print(f"压缩提交失败: {str(e)}", OutputType.WARNING)
|
49
49
|
|
50
|
+
|
50
51
|
def main():
|
51
52
|
init_env("欢迎使用 Jarvis-GitSquash,您的Git压缩助手已准备就绪!")
|
52
|
-
parser = argparse.ArgumentParser(description=
|
53
|
-
parser.add_argument(
|
54
|
-
parser.add_argument(
|
53
|
+
parser = argparse.ArgumentParser(description="Git squash tool")
|
54
|
+
parser.add_argument("commit_hash", type=str, help="Base commit hash to squash from")
|
55
|
+
parser.add_argument(
|
56
|
+
"--lang", type=str, default="Chinese", help="Language for commit messages"
|
57
|
+
)
|
55
58
|
args = parser.parse_args()
|
56
59
|
|
57
60
|
tool = GitSquashTool()
|
58
|
-
tool.execute({
|
59
|
-
|
60
|
-
|
61
|
-
})
|
61
|
+
tool.execute({"commit_hash": args.commit_hash, "lang": args.lang})
|
62
|
+
|
63
|
+
|
62
64
|
if __name__ == "__main__":
|
63
65
|
sys.exit(main())
|
@@ -12,7 +12,8 @@ from yaspin import yaspin
|
|
12
12
|
|
13
13
|
from jarvis.jarvis_platform.registry import PlatformRegistry
|
14
14
|
from jarvis.jarvis_utils.config import get_git_commit_prompt
|
15
|
-
from jarvis.jarvis_utils.git_utils import find_git_root,
|
15
|
+
from jarvis.jarvis_utils.git_utils import (find_git_root,
|
16
|
+
has_uncommitted_changes)
|
16
17
|
from jarvis.jarvis_utils.output import OutputType, PrettyOutput
|
17
18
|
from jarvis.jarvis_utils.tag import ct, ot
|
18
19
|
from jarvis.jarvis_utils.utils import init_env, is_context_overflow
|
@@ -30,8 +31,16 @@ class GitCommitTool:
|
|
30
31
|
"description": "Git仓库的根目录路径(可选)",
|
31
32
|
"default": ".",
|
32
33
|
},
|
33
|
-
"prefix": {
|
34
|
-
|
34
|
+
"prefix": {
|
35
|
+
"type": "string",
|
36
|
+
"description": "提交信息前缀(可选)",
|
37
|
+
"default": "",
|
38
|
+
},
|
39
|
+
"suffix": {
|
40
|
+
"type": "string",
|
41
|
+
"description": "提交信息后缀(可选)",
|
42
|
+
"default": "",
|
43
|
+
},
|
35
44
|
},
|
36
45
|
"required": [],
|
37
46
|
}
|
@@ -109,7 +118,7 @@ class GitCommitTool:
|
|
109
118
|
stdout=subprocess.PIPE,
|
110
119
|
stderr=subprocess.PIPE,
|
111
120
|
)
|
112
|
-
diff = process.communicate()[0].decode()
|
121
|
+
diff = process.communicate()[0].decode(errors="ignore")
|
113
122
|
spinner.write(f"✅ 获取差异 ({file_count} 个文件)")
|
114
123
|
try:
|
115
124
|
temp_diff_file_path = None
|
@@ -265,7 +274,8 @@ commit信息
|
|
265
274
|
spinner.write(f"⚠️ 无法删除临时文件: {str(e)}")
|
266
275
|
|
267
276
|
PrettyOutput.print(
|
268
|
-
f"提交哈希: {commit_hash}\n提交消息: {commit_message}",
|
277
|
+
f"提交哈希: {commit_hash}\n提交消息: {commit_message}",
|
278
|
+
OutputType.SUCCESS,
|
269
279
|
)
|
270
280
|
|
271
281
|
return {
|
jarvis/jarvis_mcp/__init__.py
CHANGED
@@ -5,11 +5,11 @@ from typing import Any, Dict, List
|
|
5
5
|
|
6
6
|
class McpClient(ABC):
|
7
7
|
"""MCP客户端抽象基类"""
|
8
|
-
|
8
|
+
|
9
9
|
@abstractmethod
|
10
10
|
def get_tool_list(self) -> List[Dict[str, Any]]:
|
11
11
|
"""获取工具列表
|
12
|
-
|
12
|
+
|
13
13
|
返回:
|
14
14
|
List[Dict[str, Any]]: 工具列表,每个工具包含以下字段:
|
15
15
|
- name: str - 工具名称
|
@@ -17,15 +17,15 @@ class McpClient(ABC):
|
|
17
17
|
- parameters: Dict - 工具参数
|
18
18
|
"""
|
19
19
|
pass
|
20
|
-
|
20
|
+
|
21
21
|
@abstractmethod
|
22
22
|
def execute(self, tool_name: str, arguments: Dict[str, Any]) -> Dict[str, Any]:
|
23
23
|
"""执行工具
|
24
|
-
|
24
|
+
|
25
25
|
参数:
|
26
26
|
tool_name: 工具名称
|
27
27
|
arguments: 参数字典,包含工具执行所需的参数
|
28
|
-
|
28
|
+
|
29
29
|
返回:
|
30
30
|
Dict[str, Any]: 执行结果,包含以下字段:
|
31
31
|
- success: bool - 是否执行成功
|
@@ -37,7 +37,7 @@ class McpClient(ABC):
|
|
37
37
|
@abstractmethod
|
38
38
|
def get_resource_list(self) -> List[Dict[str, Any]]:
|
39
39
|
"""获取资源列表
|
40
|
-
|
40
|
+
|
41
41
|
返回:
|
42
42
|
List[Dict[str, Any]]: 资源列表,每个资源包含以下字段:
|
43
43
|
- uri: str - 资源的唯一标识符
|
@@ -50,10 +50,10 @@ class McpClient(ABC):
|
|
50
50
|
@abstractmethod
|
51
51
|
def get_resource(self, uri: str) -> Dict[str, Any]:
|
52
52
|
"""获取指定资源的内容
|
53
|
-
|
53
|
+
|
54
54
|
参数:
|
55
55
|
uri: str - 资源的URI标识符
|
56
|
-
|
56
|
+
|
57
57
|
返回:
|
58
58
|
Dict[str, Any]: 资源内容,包含以下字段:
|
59
59
|
- uri: str - 资源的URI
|
@@ -62,5 +62,3 @@ class McpClient(ABC):
|
|
62
62
|
- blob: str - 二进制内容(如果是二进制资源,base64编码)
|
63
63
|
"""
|
64
64
|
pass
|
65
|
-
|
66
|
-
|