jarvis-ai-assistant 0.7.16__py3-none-any.whl → 1.0.2__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 +567 -222
- jarvis/jarvis_agent/agent_manager.py +19 -12
- jarvis/jarvis_agent/builtin_input_handler.py +79 -11
- jarvis/jarvis_agent/config_editor.py +7 -2
- jarvis/jarvis_agent/event_bus.py +24 -13
- jarvis/jarvis_agent/events.py +19 -1
- jarvis/jarvis_agent/file_context_handler.py +67 -64
- jarvis/jarvis_agent/file_methodology_manager.py +38 -24
- jarvis/jarvis_agent/jarvis.py +186 -114
- jarvis/jarvis_agent/language_extractors/__init__.py +8 -1
- jarvis/jarvis_agent/language_extractors/c_extractor.py +7 -4
- jarvis/jarvis_agent/language_extractors/cpp_extractor.py +9 -4
- jarvis/jarvis_agent/language_extractors/go_extractor.py +7 -4
- jarvis/jarvis_agent/language_extractors/java_extractor.py +27 -20
- jarvis/jarvis_agent/language_extractors/javascript_extractor.py +22 -17
- jarvis/jarvis_agent/language_extractors/python_extractor.py +7 -4
- jarvis/jarvis_agent/language_extractors/rust_extractor.py +7 -4
- jarvis/jarvis_agent/language_extractors/typescript_extractor.py +22 -17
- jarvis/jarvis_agent/language_support_info.py +250 -219
- jarvis/jarvis_agent/main.py +19 -23
- jarvis/jarvis_agent/memory_manager.py +9 -6
- jarvis/jarvis_agent/methodology_share_manager.py +21 -15
- jarvis/jarvis_agent/output_handler.py +4 -2
- jarvis/jarvis_agent/prompt_builder.py +7 -6
- jarvis/jarvis_agent/prompt_manager.py +113 -8
- jarvis/jarvis_agent/prompts.py +317 -85
- jarvis/jarvis_agent/protocols.py +5 -2
- jarvis/jarvis_agent/run_loop.py +192 -32
- jarvis/jarvis_agent/session_manager.py +7 -3
- jarvis/jarvis_agent/share_manager.py +23 -13
- jarvis/jarvis_agent/shell_input_handler.py +12 -8
- jarvis/jarvis_agent/stdio_redirect.py +25 -26
- jarvis/jarvis_agent/task_analyzer.py +29 -23
- jarvis/jarvis_agent/task_list.py +869 -0
- jarvis/jarvis_agent/task_manager.py +26 -23
- jarvis/jarvis_agent/tool_executor.py +6 -5
- jarvis/jarvis_agent/tool_share_manager.py +24 -14
- jarvis/jarvis_agent/user_interaction.py +3 -3
- jarvis/jarvis_agent/utils.py +9 -1
- jarvis/jarvis_agent/web_bridge.py +37 -17
- jarvis/jarvis_agent/web_output_sink.py +5 -2
- jarvis/jarvis_agent/web_server.py +165 -36
- jarvis/jarvis_c2rust/__init__.py +1 -1
- jarvis/jarvis_c2rust/cli.py +260 -141
- jarvis/jarvis_c2rust/collector.py +37 -18
- jarvis/jarvis_c2rust/constants.py +60 -0
- jarvis/jarvis_c2rust/library_replacer.py +242 -1010
- jarvis/jarvis_c2rust/library_replacer_checkpoint.py +133 -0
- jarvis/jarvis_c2rust/library_replacer_llm.py +287 -0
- jarvis/jarvis_c2rust/library_replacer_loader.py +191 -0
- jarvis/jarvis_c2rust/library_replacer_output.py +134 -0
- jarvis/jarvis_c2rust/library_replacer_prompts.py +124 -0
- jarvis/jarvis_c2rust/library_replacer_utils.py +188 -0
- jarvis/jarvis_c2rust/llm_module_agent.py +98 -1044
- jarvis/jarvis_c2rust/llm_module_agent_apply.py +170 -0
- jarvis/jarvis_c2rust/llm_module_agent_executor.py +288 -0
- jarvis/jarvis_c2rust/llm_module_agent_loader.py +170 -0
- jarvis/jarvis_c2rust/llm_module_agent_prompts.py +268 -0
- jarvis/jarvis_c2rust/llm_module_agent_types.py +57 -0
- jarvis/jarvis_c2rust/llm_module_agent_utils.py +150 -0
- jarvis/jarvis_c2rust/llm_module_agent_validator.py +119 -0
- jarvis/jarvis_c2rust/loaders.py +28 -10
- jarvis/jarvis_c2rust/models.py +5 -2
- jarvis/jarvis_c2rust/optimizer.py +192 -1974
- jarvis/jarvis_c2rust/optimizer_build_fix.py +286 -0
- jarvis/jarvis_c2rust/optimizer_clippy.py +766 -0
- jarvis/jarvis_c2rust/optimizer_config.py +49 -0
- jarvis/jarvis_c2rust/optimizer_docs.py +183 -0
- jarvis/jarvis_c2rust/optimizer_options.py +48 -0
- jarvis/jarvis_c2rust/optimizer_progress.py +469 -0
- jarvis/jarvis_c2rust/optimizer_report.py +52 -0
- jarvis/jarvis_c2rust/optimizer_unsafe.py +309 -0
- jarvis/jarvis_c2rust/optimizer_utils.py +469 -0
- jarvis/jarvis_c2rust/optimizer_visibility.py +185 -0
- jarvis/jarvis_c2rust/scanner.py +229 -166
- jarvis/jarvis_c2rust/transpiler.py +531 -2732
- jarvis/jarvis_c2rust/transpiler_agents.py +503 -0
- jarvis/jarvis_c2rust/transpiler_build.py +1294 -0
- jarvis/jarvis_c2rust/transpiler_codegen.py +204 -0
- jarvis/jarvis_c2rust/transpiler_compile.py +146 -0
- jarvis/jarvis_c2rust/transpiler_config.py +178 -0
- jarvis/jarvis_c2rust/transpiler_context.py +122 -0
- jarvis/jarvis_c2rust/transpiler_executor.py +516 -0
- jarvis/jarvis_c2rust/transpiler_generation.py +278 -0
- jarvis/jarvis_c2rust/transpiler_git.py +163 -0
- jarvis/jarvis_c2rust/transpiler_mod_utils.py +225 -0
- jarvis/jarvis_c2rust/transpiler_modules.py +336 -0
- jarvis/jarvis_c2rust/transpiler_planning.py +394 -0
- jarvis/jarvis_c2rust/transpiler_review.py +1196 -0
- jarvis/jarvis_c2rust/transpiler_symbols.py +176 -0
- jarvis/jarvis_c2rust/utils.py +269 -79
- jarvis/jarvis_code_agent/after_change.py +233 -0
- jarvis/jarvis_code_agent/build_validation_config.py +37 -30
- jarvis/jarvis_code_agent/builtin_rules.py +68 -0
- jarvis/jarvis_code_agent/code_agent.py +976 -1517
- jarvis/jarvis_code_agent/code_agent_build.py +227 -0
- jarvis/jarvis_code_agent/code_agent_diff.py +246 -0
- jarvis/jarvis_code_agent/code_agent_git.py +525 -0
- jarvis/jarvis_code_agent/code_agent_impact.py +177 -0
- jarvis/jarvis_code_agent/code_agent_lint.py +283 -0
- jarvis/jarvis_code_agent/code_agent_llm.py +159 -0
- jarvis/jarvis_code_agent/code_agent_postprocess.py +105 -0
- jarvis/jarvis_code_agent/code_agent_prompts.py +46 -0
- jarvis/jarvis_code_agent/code_agent_rules.py +305 -0
- jarvis/jarvis_code_agent/code_analyzer/__init__.py +52 -48
- jarvis/jarvis_code_agent/code_analyzer/base_language.py +12 -10
- jarvis/jarvis_code_agent/code_analyzer/build_validator/__init__.py +12 -11
- jarvis/jarvis_code_agent/code_analyzer/build_validator/base.py +16 -12
- jarvis/jarvis_code_agent/code_analyzer/build_validator/cmake.py +26 -17
- jarvis/jarvis_code_agent/code_analyzer/build_validator/detector.py +558 -104
- jarvis/jarvis_code_agent/code_analyzer/build_validator/fallback.py +27 -16
- jarvis/jarvis_code_agent/code_analyzer/build_validator/go.py +22 -18
- jarvis/jarvis_code_agent/code_analyzer/build_validator/java_gradle.py +21 -16
- jarvis/jarvis_code_agent/code_analyzer/build_validator/java_maven.py +20 -16
- jarvis/jarvis_code_agent/code_analyzer/build_validator/makefile.py +27 -16
- jarvis/jarvis_code_agent/code_analyzer/build_validator/nodejs.py +47 -23
- jarvis/jarvis_code_agent/code_analyzer/build_validator/python.py +71 -37
- jarvis/jarvis_code_agent/code_analyzer/build_validator/rust.py +162 -35
- jarvis/jarvis_code_agent/code_analyzer/build_validator/validator.py +111 -57
- jarvis/jarvis_code_agent/code_analyzer/build_validator.py +18 -12
- jarvis/jarvis_code_agent/code_analyzer/context_manager.py +185 -183
- jarvis/jarvis_code_agent/code_analyzer/context_recommender.py +2 -1
- jarvis/jarvis_code_agent/code_analyzer/dependency_analyzer.py +24 -15
- jarvis/jarvis_code_agent/code_analyzer/file_ignore.py +227 -141
- jarvis/jarvis_code_agent/code_analyzer/impact_analyzer.py +321 -247
- jarvis/jarvis_code_agent/code_analyzer/language_registry.py +37 -29
- jarvis/jarvis_code_agent/code_analyzer/language_support.py +21 -13
- jarvis/jarvis_code_agent/code_analyzer/languages/__init__.py +15 -9
- jarvis/jarvis_code_agent/code_analyzer/languages/c_cpp_language.py +75 -45
- jarvis/jarvis_code_agent/code_analyzer/languages/go_language.py +87 -52
- jarvis/jarvis_code_agent/code_analyzer/languages/java_language.py +84 -51
- jarvis/jarvis_code_agent/code_analyzer/languages/javascript_language.py +94 -64
- jarvis/jarvis_code_agent/code_analyzer/languages/python_language.py +109 -71
- jarvis/jarvis_code_agent/code_analyzer/languages/rust_language.py +97 -63
- jarvis/jarvis_code_agent/code_analyzer/languages/typescript_language.py +103 -69
- jarvis/jarvis_code_agent/code_analyzer/llm_context_recommender.py +271 -268
- jarvis/jarvis_code_agent/code_analyzer/symbol_extractor.py +76 -64
- jarvis/jarvis_code_agent/code_analyzer/tree_sitter_extractor.py +92 -19
- jarvis/jarvis_code_agent/diff_visualizer.py +998 -0
- jarvis/jarvis_code_agent/lint.py +223 -524
- jarvis/jarvis_code_agent/rule_share_manager.py +158 -0
- jarvis/jarvis_code_agent/rules/clean_code.md +144 -0
- jarvis/jarvis_code_agent/rules/code_review.md +115 -0
- jarvis/jarvis_code_agent/rules/documentation.md +165 -0
- jarvis/jarvis_code_agent/rules/generate_rules.md +52 -0
- jarvis/jarvis_code_agent/rules/performance.md +158 -0
- jarvis/jarvis_code_agent/rules/refactoring.md +139 -0
- jarvis/jarvis_code_agent/rules/security.md +160 -0
- jarvis/jarvis_code_agent/rules/tdd.md +78 -0
- jarvis/jarvis_code_agent/test_rules/cpp_test.md +118 -0
- jarvis/jarvis_code_agent/test_rules/go_test.md +98 -0
- jarvis/jarvis_code_agent/test_rules/java_test.md +99 -0
- jarvis/jarvis_code_agent/test_rules/javascript_test.md +113 -0
- jarvis/jarvis_code_agent/test_rules/php_test.md +117 -0
- jarvis/jarvis_code_agent/test_rules/python_test.md +91 -0
- jarvis/jarvis_code_agent/test_rules/ruby_test.md +102 -0
- jarvis/jarvis_code_agent/test_rules/rust_test.md +86 -0
- jarvis/jarvis_code_agent/utils.py +36 -26
- jarvis/jarvis_code_analysis/checklists/loader.py +21 -21
- jarvis/jarvis_code_analysis/code_review.py +64 -33
- jarvis/jarvis_data/config_schema.json +285 -192
- jarvis/jarvis_git_squash/main.py +8 -6
- jarvis/jarvis_git_utils/git_commiter.py +53 -76
- jarvis/jarvis_mcp/__init__.py +5 -2
- jarvis/jarvis_mcp/sse_mcp_client.py +40 -30
- jarvis/jarvis_mcp/stdio_mcp_client.py +27 -19
- jarvis/jarvis_mcp/streamable_mcp_client.py +35 -26
- jarvis/jarvis_memory_organizer/memory_organizer.py +78 -55
- jarvis/jarvis_methodology/main.py +48 -39
- jarvis/jarvis_multi_agent/__init__.py +56 -23
- jarvis/jarvis_multi_agent/main.py +15 -18
- jarvis/jarvis_platform/base.py +179 -111
- jarvis/jarvis_platform/human.py +27 -16
- jarvis/jarvis_platform/kimi.py +52 -45
- jarvis/jarvis_platform/openai.py +101 -40
- jarvis/jarvis_platform/registry.py +51 -33
- jarvis/jarvis_platform/tongyi.py +68 -38
- jarvis/jarvis_platform/yuanbao.py +59 -43
- jarvis/jarvis_platform_manager/main.py +68 -76
- jarvis/jarvis_platform_manager/service.py +24 -14
- jarvis/jarvis_rag/README_CONFIG.md +314 -0
- jarvis/jarvis_rag/README_DYNAMIC_LOADING.md +311 -0
- jarvis/jarvis_rag/README_ONLINE_MODELS.md +230 -0
- jarvis/jarvis_rag/__init__.py +57 -4
- jarvis/jarvis_rag/cache.py +3 -1
- jarvis/jarvis_rag/cli.py +48 -68
- jarvis/jarvis_rag/embedding_interface.py +39 -0
- jarvis/jarvis_rag/embedding_manager.py +7 -230
- jarvis/jarvis_rag/embeddings/__init__.py +41 -0
- jarvis/jarvis_rag/embeddings/base.py +114 -0
- jarvis/jarvis_rag/embeddings/cohere.py +66 -0
- jarvis/jarvis_rag/embeddings/edgefn.py +117 -0
- jarvis/jarvis_rag/embeddings/local.py +260 -0
- jarvis/jarvis_rag/embeddings/openai.py +62 -0
- jarvis/jarvis_rag/embeddings/registry.py +293 -0
- jarvis/jarvis_rag/llm_interface.py +8 -6
- jarvis/jarvis_rag/query_rewriter.py +8 -9
- jarvis/jarvis_rag/rag_pipeline.py +61 -52
- jarvis/jarvis_rag/reranker.py +7 -75
- jarvis/jarvis_rag/reranker_interface.py +32 -0
- jarvis/jarvis_rag/rerankers/__init__.py +41 -0
- jarvis/jarvis_rag/rerankers/base.py +109 -0
- jarvis/jarvis_rag/rerankers/cohere.py +67 -0
- jarvis/jarvis_rag/rerankers/edgefn.py +140 -0
- jarvis/jarvis_rag/rerankers/jina.py +79 -0
- jarvis/jarvis_rag/rerankers/local.py +89 -0
- jarvis/jarvis_rag/rerankers/registry.py +293 -0
- jarvis/jarvis_rag/retriever.py +58 -43
- jarvis/jarvis_sec/__init__.py +66 -141
- jarvis/jarvis_sec/agents.py +21 -17
- jarvis/jarvis_sec/analysis.py +80 -33
- jarvis/jarvis_sec/checkers/__init__.py +7 -13
- jarvis/jarvis_sec/checkers/c_checker.py +356 -164
- jarvis/jarvis_sec/checkers/rust_checker.py +47 -29
- jarvis/jarvis_sec/cli.py +43 -21
- jarvis/jarvis_sec/clustering.py +430 -272
- jarvis/jarvis_sec/file_manager.py +99 -55
- jarvis/jarvis_sec/parsers.py +9 -6
- jarvis/jarvis_sec/prompts.py +4 -3
- jarvis/jarvis_sec/report.py +44 -22
- jarvis/jarvis_sec/review.py +180 -107
- jarvis/jarvis_sec/status.py +50 -41
- jarvis/jarvis_sec/types.py +3 -0
- jarvis/jarvis_sec/utils.py +160 -83
- jarvis/jarvis_sec/verification.py +411 -181
- jarvis/jarvis_sec/workflow.py +132 -21
- jarvis/jarvis_smart_shell/main.py +28 -41
- jarvis/jarvis_stats/cli.py +14 -12
- jarvis/jarvis_stats/stats.py +28 -19
- jarvis/jarvis_stats/storage.py +14 -8
- jarvis/jarvis_stats/visualizer.py +12 -7
- jarvis/jarvis_tools/base.py +5 -2
- jarvis/jarvis_tools/clear_memory.py +13 -9
- jarvis/jarvis_tools/cli/main.py +23 -18
- jarvis/jarvis_tools/edit_file.py +572 -873
- jarvis/jarvis_tools/execute_script.py +10 -7
- jarvis/jarvis_tools/file_analyzer.py +7 -8
- jarvis/jarvis_tools/meta_agent.py +287 -0
- jarvis/jarvis_tools/methodology.py +5 -3
- jarvis/jarvis_tools/read_code.py +305 -1438
- jarvis/jarvis_tools/read_symbols.py +50 -17
- jarvis/jarvis_tools/read_webpage.py +19 -18
- jarvis/jarvis_tools/registry.py +435 -156
- jarvis/jarvis_tools/retrieve_memory.py +16 -11
- jarvis/jarvis_tools/save_memory.py +8 -6
- jarvis/jarvis_tools/search_web.py +31 -31
- jarvis/jarvis_tools/sub_agent.py +32 -28
- jarvis/jarvis_tools/sub_code_agent.py +44 -60
- jarvis/jarvis_tools/task_list_manager.py +1811 -0
- jarvis/jarvis_tools/virtual_tty.py +29 -19
- jarvis/jarvis_utils/__init__.py +4 -0
- jarvis/jarvis_utils/builtin_replace_map.py +2 -1
- jarvis/jarvis_utils/clipboard.py +9 -8
- jarvis/jarvis_utils/collections.py +331 -0
- jarvis/jarvis_utils/config.py +699 -194
- jarvis/jarvis_utils/dialogue_recorder.py +294 -0
- jarvis/jarvis_utils/embedding.py +6 -3
- jarvis/jarvis_utils/file_processors.py +7 -1
- jarvis/jarvis_utils/fzf.py +9 -3
- jarvis/jarvis_utils/git_utils.py +71 -42
- jarvis/jarvis_utils/globals.py +116 -32
- jarvis/jarvis_utils/http.py +6 -2
- jarvis/jarvis_utils/input.py +318 -83
- jarvis/jarvis_utils/jsonnet_compat.py +119 -104
- jarvis/jarvis_utils/methodology.py +37 -28
- jarvis/jarvis_utils/output.py +201 -44
- jarvis/jarvis_utils/utils.py +986 -628
- {jarvis_ai_assistant-0.7.16.dist-info → jarvis_ai_assistant-1.0.2.dist-info}/METADATA +49 -33
- jarvis_ai_assistant-1.0.2.dist-info/RECORD +304 -0
- jarvis/jarvis_code_agent/code_analyzer/structured_code.py +0 -556
- jarvis/jarvis_tools/generate_new_tool.py +0 -205
- jarvis/jarvis_tools/lsp_client.py +0 -1552
- jarvis/jarvis_tools/rewrite_file.py +0 -105
- jarvis_ai_assistant-0.7.16.dist-info/RECORD +0 -218
- {jarvis_ai_assistant-0.7.16.dist-info → jarvis_ai_assistant-1.0.2.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.7.16.dist-info → jarvis_ai_assistant-1.0.2.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.7.16.dist-info → jarvis_ai_assistant-1.0.2.dist-info}/licenses/LICENSE +0 -0
- {jarvis_ai_assistant-0.7.16.dist-info → jarvis_ai_assistant-1.0.2.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
1
|
"""
|
|
5
2
|
兜底构建验证器模块
|
|
6
3
|
|
|
@@ -9,27 +6,36 @@
|
|
|
9
6
|
|
|
10
7
|
import os
|
|
11
8
|
import time
|
|
12
|
-
from typing import List
|
|
9
|
+
from typing import List
|
|
10
|
+
|
|
11
|
+
from jarvis.jarvis_utils.output import PrettyOutput
|
|
12
|
+
|
|
13
|
+
#!/usr/bin/env python3
|
|
14
|
+
# -*- coding: utf-8 -*-
|
|
15
|
+
|
|
16
|
+
from typing import Optional
|
|
13
17
|
|
|
14
|
-
from .base import
|
|
18
|
+
from .base import BuildResult
|
|
19
|
+
from .base import BuildSystem
|
|
20
|
+
from .base import BuildValidatorBase
|
|
15
21
|
|
|
16
22
|
|
|
17
23
|
class FallbackBuildValidator(BuildValidatorBase):
|
|
18
24
|
"""兜底验证器:当无法检测构建系统时使用"""
|
|
19
|
-
|
|
25
|
+
|
|
20
26
|
def validate(self, modified_files: Optional[List[str]] = None) -> BuildResult:
|
|
21
27
|
start_time = time.time()
|
|
22
|
-
|
|
28
|
+
|
|
23
29
|
# 策略1: 根据文件扩展名进行基本的语法检查
|
|
24
30
|
if modified_files:
|
|
25
31
|
errors = []
|
|
26
32
|
for file_path in modified_files:
|
|
27
33
|
ext = os.path.splitext(file_path)[1].lower()
|
|
28
34
|
full_path = os.path.join(self.project_root, file_path)
|
|
29
|
-
|
|
35
|
+
|
|
30
36
|
if not os.path.exists(full_path):
|
|
31
37
|
continue
|
|
32
|
-
|
|
38
|
+
|
|
33
39
|
# Python文件:使用py_compile
|
|
34
40
|
if ext == ".py":
|
|
35
41
|
returncode, _, stderr = self._run_command(
|
|
@@ -38,7 +44,7 @@ class FallbackBuildValidator(BuildValidatorBase):
|
|
|
38
44
|
)
|
|
39
45
|
if returncode != 0:
|
|
40
46
|
errors.append(f"{file_path}: {stderr}")
|
|
41
|
-
|
|
47
|
+
|
|
42
48
|
# JavaScript文件:尝试使用node检查语法
|
|
43
49
|
elif ext in (".js", ".mjs", ".cjs"):
|
|
44
50
|
returncode, _, stderr = self._run_command(
|
|
@@ -47,11 +53,15 @@ class FallbackBuildValidator(BuildValidatorBase):
|
|
|
47
53
|
)
|
|
48
54
|
if returncode != 0:
|
|
49
55
|
errors.append(f"{file_path}: {stderr}")
|
|
50
|
-
|
|
56
|
+
|
|
51
57
|
if errors:
|
|
52
58
|
duration = time.time() - start_time
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
PrettyOutput.auto_print(
|
|
60
|
+
f"❌ 基础语法检查失败(耗时 {duration:.2f} 秒)"
|
|
61
|
+
)
|
|
62
|
+
PrettyOutput.auto_print(
|
|
63
|
+
f"错误信息:语法检查失败\n{chr(10).join(errors[:5])}"
|
|
64
|
+
)
|
|
55
65
|
return BuildResult(
|
|
56
66
|
success=False,
|
|
57
67
|
output="\n".join(errors),
|
|
@@ -59,9 +69,11 @@ class FallbackBuildValidator(BuildValidatorBase):
|
|
|
59
69
|
build_system=BuildSystem.UNKNOWN,
|
|
60
70
|
duration=duration,
|
|
61
71
|
)
|
|
62
|
-
|
|
72
|
+
|
|
63
73
|
duration = time.time() - start_time
|
|
64
|
-
|
|
74
|
+
PrettyOutput.auto_print(
|
|
75
|
+
f"✅ 基础语法检查通过(耗时 {duration:.2f} 秒,未检测到构建系统)"
|
|
76
|
+
)
|
|
65
77
|
return BuildResult(
|
|
66
78
|
success=True,
|
|
67
79
|
output="基础语法检查通过(未检测到构建系统)",
|
|
@@ -69,4 +81,3 @@ class FallbackBuildValidator(BuildValidatorBase):
|
|
|
69
81
|
build_system=BuildSystem.UNKNOWN,
|
|
70
82
|
duration=duration,
|
|
71
83
|
)
|
|
72
|
-
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
1
|
"""
|
|
5
2
|
Go构建验证器模块
|
|
6
3
|
|
|
@@ -8,41 +5,49 @@ Go构建验证器模块
|
|
|
8
5
|
"""
|
|
9
6
|
|
|
10
7
|
import time
|
|
11
|
-
from typing import List
|
|
8
|
+
from typing import List
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from jarvis.jarvis_utils.output import PrettyOutput
|
|
11
|
+
|
|
12
|
+
#!/usr/bin/env python3
|
|
13
|
+
# -*- coding: utf-8 -*-
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
|
|
16
|
+
from .base import BuildResult
|
|
17
|
+
from .base import BuildSystem
|
|
18
|
+
from .base import BuildValidatorBase
|
|
14
19
|
|
|
15
20
|
|
|
16
21
|
class GoBuildValidator(BuildValidatorBase):
|
|
17
22
|
"""Go构建验证器(使用go test,包括编译和测试)"""
|
|
18
|
-
|
|
23
|
+
|
|
19
24
|
BUILD_SYSTEM_NAME = "Go Build"
|
|
20
25
|
SUPPORTED_LANGUAGES = ["go"]
|
|
21
|
-
|
|
26
|
+
|
|
22
27
|
def validate(self, modified_files: Optional[List[str]] = None) -> BuildResult:
|
|
23
28
|
start_time = time.time()
|
|
24
|
-
|
|
29
|
+
|
|
25
30
|
# 使用 go test 进行构建和测试验证(会自动编译并运行测试)
|
|
26
31
|
cmd = ["go", "test", "./..."]
|
|
27
|
-
|
|
32
|
+
|
|
28
33
|
returncode, stdout, stderr = self._run_command(cmd, timeout=30)
|
|
29
34
|
duration = time.time() - start_time
|
|
30
|
-
|
|
35
|
+
|
|
31
36
|
success = returncode == 0
|
|
32
37
|
output = stdout + stderr
|
|
33
|
-
|
|
38
|
+
|
|
34
39
|
if not success:
|
|
35
40
|
# 尝试解析错误信息(包括编译错误和测试失败)
|
|
36
41
|
error_message = self._parse_go_errors(output)
|
|
37
|
-
|
|
42
|
+
PrettyOutput.auto_print(f"❌ Go 构建验证失败(耗时 {duration:.2f} 秒)")
|
|
38
43
|
if error_message:
|
|
39
|
-
|
|
44
|
+
PrettyOutput.auto_print(f"错误信息:\n{error_message}")
|
|
40
45
|
else:
|
|
41
|
-
|
|
46
|
+
PrettyOutput.auto_print(f"输出:\n{output[:500]}")
|
|
42
47
|
else:
|
|
43
48
|
error_message = None
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
PrettyOutput.auto_print(f"✅ Go 构建验证成功(耗时 {duration:.2f} 秒)")
|
|
50
|
+
|
|
46
51
|
return BuildResult(
|
|
47
52
|
success=success,
|
|
48
53
|
output=output,
|
|
@@ -50,7 +55,7 @@ class GoBuildValidator(BuildValidatorBase):
|
|
|
50
55
|
build_system=BuildSystem.GO,
|
|
51
56
|
duration=duration,
|
|
52
57
|
)
|
|
53
|
-
|
|
58
|
+
|
|
54
59
|
def _parse_go_errors(self, output: str) -> str:
|
|
55
60
|
"""解析Go的错误输出(包括编译错误和测试失败)"""
|
|
56
61
|
# 简化处理:提取关键错误信息
|
|
@@ -67,4 +72,3 @@ class GoBuildValidator(BuildValidatorBase):
|
|
|
67
72
|
elif "got" in line.lower() and "want" in line.lower():
|
|
68
73
|
errors.append(line.strip())
|
|
69
74
|
return "\n".join(errors[:10]) if errors else output[:500] # 限制长度
|
|
70
|
-
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
1
|
"""
|
|
5
2
|
Java Gradle构建验证器模块
|
|
6
3
|
|
|
@@ -9,20 +6,29 @@ Java Gradle构建验证器模块
|
|
|
9
6
|
|
|
10
7
|
import os
|
|
11
8
|
import time
|
|
12
|
-
from typing import List
|
|
9
|
+
from typing import List
|
|
10
|
+
|
|
11
|
+
from jarvis.jarvis_utils.output import PrettyOutput
|
|
12
|
+
|
|
13
|
+
#!/usr/bin/env python3
|
|
14
|
+
# -*- coding: utf-8 -*-
|
|
15
|
+
|
|
16
|
+
from typing import Optional
|
|
13
17
|
|
|
14
|
-
from .base import
|
|
18
|
+
from .base import BuildResult
|
|
19
|
+
from .base import BuildSystem
|
|
20
|
+
from .base import BuildValidatorBase
|
|
15
21
|
|
|
16
22
|
|
|
17
23
|
class JavaGradleBuildValidator(BuildValidatorBase):
|
|
18
24
|
"""Java Gradle构建验证器"""
|
|
19
|
-
|
|
25
|
+
|
|
20
26
|
BUILD_SYSTEM_NAME = "Gradle"
|
|
21
27
|
SUPPORTED_LANGUAGES = ["java"]
|
|
22
|
-
|
|
28
|
+
|
|
23
29
|
def validate(self, modified_files: Optional[List[str]] = None) -> BuildResult:
|
|
24
30
|
start_time = time.time()
|
|
25
|
-
|
|
31
|
+
|
|
26
32
|
# 使用 gradle compileJava 进行编译验证
|
|
27
33
|
# 优先使用 gradlew(如果存在)
|
|
28
34
|
gradlew = os.path.join(self.project_root, "gradlew")
|
|
@@ -30,19 +36,19 @@ class JavaGradleBuildValidator(BuildValidatorBase):
|
|
|
30
36
|
cmd = ["./gradlew", "compileJava", "--quiet"]
|
|
31
37
|
else:
|
|
32
38
|
cmd = ["gradle", "compileJava", "--quiet"]
|
|
33
|
-
|
|
39
|
+
|
|
34
40
|
returncode, stdout, stderr = self._run_command(cmd, timeout=60)
|
|
35
41
|
duration = time.time() - start_time
|
|
36
|
-
|
|
42
|
+
|
|
37
43
|
success = returncode == 0
|
|
38
44
|
output = stdout + stderr
|
|
39
|
-
|
|
45
|
+
|
|
40
46
|
if success:
|
|
41
|
-
|
|
47
|
+
PrettyOutput.auto_print(f"✅ Gradle 构建验证成功(耗时 {duration:.2f} 秒)")
|
|
42
48
|
else:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
PrettyOutput.auto_print(f"❌ Gradle 构建验证失败(耗时 {duration:.2f} 秒)")
|
|
50
|
+
PrettyOutput.auto_print(f"错误信息:Gradle编译失败\n{output[:500]}")
|
|
51
|
+
|
|
46
52
|
return BuildResult(
|
|
47
53
|
success=success,
|
|
48
54
|
output=output,
|
|
@@ -50,4 +56,3 @@ class JavaGradleBuildValidator(BuildValidatorBase):
|
|
|
50
56
|
build_system=BuildSystem.JAVA_GRADLE,
|
|
51
57
|
duration=duration,
|
|
52
58
|
)
|
|
53
|
-
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
1
|
"""
|
|
5
2
|
Java Maven构建验证器模块
|
|
6
3
|
|
|
@@ -8,35 +5,43 @@ Java Maven构建验证器模块
|
|
|
8
5
|
"""
|
|
9
6
|
|
|
10
7
|
import time
|
|
11
|
-
from typing import List
|
|
8
|
+
from typing import List
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from jarvis.jarvis_utils.output import PrettyOutput
|
|
11
|
+
|
|
12
|
+
#!/usr/bin/env python3
|
|
13
|
+
# -*- coding: utf-8 -*-
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
|
|
16
|
+
from .base import BuildResult
|
|
17
|
+
from .base import BuildSystem
|
|
18
|
+
from .base import BuildValidatorBase
|
|
14
19
|
|
|
15
20
|
|
|
16
21
|
class JavaMavenBuildValidator(BuildValidatorBase):
|
|
17
22
|
"""Java Maven构建验证器"""
|
|
18
|
-
|
|
23
|
+
|
|
19
24
|
BUILD_SYSTEM_NAME = "Maven"
|
|
20
25
|
SUPPORTED_LANGUAGES = ["java"]
|
|
21
|
-
|
|
26
|
+
|
|
22
27
|
def validate(self, modified_files: Optional[List[str]] = None) -> BuildResult:
|
|
23
28
|
start_time = time.time()
|
|
24
|
-
|
|
29
|
+
|
|
25
30
|
# 使用 mvn compile 进行编译验证
|
|
26
31
|
cmd = ["mvn", "compile", "-q"] # -q 静默模式
|
|
27
|
-
|
|
32
|
+
|
|
28
33
|
returncode, stdout, stderr = self._run_command(cmd, timeout=60)
|
|
29
34
|
duration = time.time() - start_time
|
|
30
|
-
|
|
35
|
+
|
|
31
36
|
success = returncode == 0
|
|
32
37
|
output = stdout + stderr
|
|
33
|
-
|
|
38
|
+
|
|
34
39
|
if success:
|
|
35
|
-
|
|
40
|
+
PrettyOutput.auto_print(f"✅ Maven 构建验证成功(耗时 {duration:.2f} 秒)")
|
|
36
41
|
else:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
PrettyOutput.auto_print(f"❌ Maven 构建验证失败(耗时 {duration:.2f} 秒)")
|
|
43
|
+
PrettyOutput.auto_print(f"错误信息:Maven编译失败\n{output[:500]}")
|
|
44
|
+
|
|
40
45
|
return BuildResult(
|
|
41
46
|
success=success,
|
|
42
47
|
output=output,
|
|
@@ -44,4 +49,3 @@ class JavaMavenBuildValidator(BuildValidatorBase):
|
|
|
44
49
|
build_system=BuildSystem.JAVA_MAVEN,
|
|
45
50
|
duration=duration,
|
|
46
51
|
)
|
|
47
|
-
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
1
|
"""
|
|
5
2
|
Makefile构建验证器模块
|
|
6
3
|
|
|
@@ -9,26 +6,37 @@ Makefile构建验证器模块
|
|
|
9
6
|
|
|
10
7
|
import os
|
|
11
8
|
import time
|
|
12
|
-
from typing import List
|
|
9
|
+
from typing import List
|
|
13
10
|
|
|
14
|
-
from .
|
|
11
|
+
from jarvis.jarvis_utils.output import PrettyOutput
|
|
12
|
+
|
|
13
|
+
#!/usr/bin/env python3
|
|
14
|
+
# -*- coding: utf-8 -*-
|
|
15
|
+
|
|
16
|
+
from typing import Optional
|
|
17
|
+
|
|
18
|
+
from .base import BuildResult
|
|
19
|
+
from .base import BuildSystem
|
|
20
|
+
from .base import BuildValidatorBase
|
|
15
21
|
|
|
16
22
|
|
|
17
23
|
class MakefileBuildValidator(BuildValidatorBase):
|
|
18
24
|
"""Makefile构建验证器"""
|
|
19
|
-
|
|
25
|
+
|
|
20
26
|
BUILD_SYSTEM_NAME = "Makefile"
|
|
21
27
|
SUPPORTED_LANGUAGES = ["c", "cpp"]
|
|
22
|
-
|
|
28
|
+
|
|
23
29
|
def validate(self, modified_files: Optional[List[str]] = None) -> BuildResult:
|
|
24
30
|
start_time = time.time()
|
|
25
|
-
|
|
31
|
+
|
|
26
32
|
# 尝试运行 make(如果存在Makefile)
|
|
27
33
|
makefile = os.path.join(self.project_root, "Makefile")
|
|
28
34
|
if not os.path.exists(makefile):
|
|
29
35
|
duration = time.time() - start_time
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
PrettyOutput.auto_print(
|
|
37
|
+
f"❌ Makefile 构建验证失败(耗时 {duration:.2f} 秒)"
|
|
38
|
+
)
|
|
39
|
+
PrettyOutput.auto_print("错误信息:Makefile不存在")
|
|
32
40
|
return BuildResult(
|
|
33
41
|
success=False,
|
|
34
42
|
output="Makefile不存在",
|
|
@@ -36,21 +44,25 @@ class MakefileBuildValidator(BuildValidatorBase):
|
|
|
36
44
|
build_system=BuildSystem.C_MAKEFILE,
|
|
37
45
|
duration=duration,
|
|
38
46
|
)
|
|
39
|
-
|
|
47
|
+
|
|
40
48
|
# 尝试 make -n(dry-run)来验证语法
|
|
41
49
|
returncode, stdout, stderr = self._run_command(
|
|
42
50
|
["make", "-n"],
|
|
43
51
|
timeout=10,
|
|
44
52
|
)
|
|
45
53
|
duration = time.time() - start_time
|
|
46
|
-
|
|
54
|
+
|
|
47
55
|
success = returncode == 0
|
|
48
56
|
output = stdout + stderr
|
|
49
57
|
if success:
|
|
50
|
-
|
|
58
|
+
PrettyOutput.auto_print(
|
|
59
|
+
f"✅ Makefile 构建验证成功(耗时 {duration:.2f} 秒)"
|
|
60
|
+
)
|
|
51
61
|
else:
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
PrettyOutput.auto_print(
|
|
63
|
+
f"❌ Makefile 构建验证失败(耗时 {duration:.2f} 秒)"
|
|
64
|
+
)
|
|
65
|
+
PrettyOutput.auto_print(f"错误信息:Makefile语法检查失败\n{output[:500]}")
|
|
54
66
|
return BuildResult(
|
|
55
67
|
success=success,
|
|
56
68
|
output=output,
|
|
@@ -58,4 +70,3 @@ class MakefileBuildValidator(BuildValidatorBase):
|
|
|
58
70
|
build_system=BuildSystem.C_MAKEFILE,
|
|
59
71
|
duration=duration,
|
|
60
72
|
)
|
|
61
|
-
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
1
|
"""
|
|
5
2
|
Node.js构建验证器模块
|
|
6
3
|
|
|
@@ -10,20 +7,29 @@ Node.js构建验证器模块
|
|
|
10
7
|
import json
|
|
11
8
|
import os
|
|
12
9
|
import time
|
|
13
|
-
from typing import List, Optional
|
|
14
10
|
|
|
15
|
-
from .
|
|
11
|
+
from jarvis.jarvis_utils.output import PrettyOutput
|
|
12
|
+
|
|
13
|
+
#!/usr/bin/env python3
|
|
14
|
+
# -*- coding: utf-8 -*-
|
|
15
|
+
|
|
16
|
+
from typing import List
|
|
17
|
+
from typing import Optional
|
|
18
|
+
|
|
19
|
+
from .base import BuildResult
|
|
20
|
+
from .base import BuildSystem
|
|
21
|
+
from .base import BuildValidatorBase
|
|
16
22
|
|
|
17
23
|
|
|
18
24
|
class NodeJSBuildValidator(BuildValidatorBase):
|
|
19
25
|
"""Node.js构建验证器"""
|
|
20
|
-
|
|
26
|
+
|
|
21
27
|
BUILD_SYSTEM_NAME = "npm/Node.js"
|
|
22
28
|
SUPPORTED_LANGUAGES = ["javascript", "typescript"]
|
|
23
|
-
|
|
29
|
+
|
|
24
30
|
def validate(self, modified_files: Optional[List[str]] = None) -> BuildResult:
|
|
25
31
|
start_time = time.time()
|
|
26
|
-
|
|
32
|
+
|
|
27
33
|
# 策略1: 尝试使用 tsc --noEmit(如果存在TypeScript)
|
|
28
34
|
tsconfig = os.path.join(self.project_root, "tsconfig.json")
|
|
29
35
|
if os.path.exists(tsconfig):
|
|
@@ -35,10 +41,16 @@ class NodeJSBuildValidator(BuildValidatorBase):
|
|
|
35
41
|
success = returncode == 0
|
|
36
42
|
output = stdout + stderr
|
|
37
43
|
if success:
|
|
38
|
-
|
|
44
|
+
PrettyOutput.auto_print(
|
|
45
|
+
f"✅ Node.js (TypeScript) 构建验证成功(耗时 {duration:.2f} 秒)"
|
|
46
|
+
)
|
|
39
47
|
else:
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
PrettyOutput.auto_print(
|
|
49
|
+
f"❌ Node.js (TypeScript) 构建验证失败(耗时 {duration:.2f} 秒)"
|
|
50
|
+
)
|
|
51
|
+
PrettyOutput.auto_print(
|
|
52
|
+
f"错误信息:TypeScript类型检查失败\n{output[:500]}"
|
|
53
|
+
)
|
|
42
54
|
return BuildResult(
|
|
43
55
|
success=success,
|
|
44
56
|
output=output,
|
|
@@ -46,7 +58,7 @@ class NodeJSBuildValidator(BuildValidatorBase):
|
|
|
46
58
|
build_system=BuildSystem.NODEJS,
|
|
47
59
|
duration=duration,
|
|
48
60
|
)
|
|
49
|
-
|
|
61
|
+
|
|
50
62
|
# 策略2: 尝试运行 npm run build(如果存在build脚本)
|
|
51
63
|
package_json = os.path.join(self.project_root, "package.json")
|
|
52
64
|
if os.path.exists(package_json):
|
|
@@ -63,10 +75,16 @@ class NodeJSBuildValidator(BuildValidatorBase):
|
|
|
63
75
|
success = returncode == 0
|
|
64
76
|
output = stdout + stderr
|
|
65
77
|
if success:
|
|
66
|
-
|
|
78
|
+
PrettyOutput.auto_print(
|
|
79
|
+
f"✅ Node.js (npm build) 构建验证成功(耗时 {duration:.2f} 秒)"
|
|
80
|
+
)
|
|
67
81
|
else:
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
PrettyOutput.auto_print(
|
|
83
|
+
f"❌ Node.js (npm build) 构建验证失败(耗时 {duration:.2f} 秒)"
|
|
84
|
+
)
|
|
85
|
+
PrettyOutput.auto_print(
|
|
86
|
+
f"错误信息:npm build失败\n{output[:500]}"
|
|
87
|
+
)
|
|
70
88
|
return BuildResult(
|
|
71
89
|
success=success,
|
|
72
90
|
output=output,
|
|
@@ -75,21 +93,26 @@ class NodeJSBuildValidator(BuildValidatorBase):
|
|
|
75
93
|
duration=duration,
|
|
76
94
|
)
|
|
77
95
|
except Exception as e:
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
PrettyOutput.auto_print(f"⚠️ 读取package.json失败: {e}")
|
|
97
|
+
|
|
80
98
|
# 策略3: 使用 eslint 进行语法检查(如果存在)
|
|
81
99
|
if modified_files:
|
|
82
|
-
js_files = [
|
|
100
|
+
js_files = [
|
|
101
|
+
f for f in modified_files if f.endswith((".js", ".jsx", ".ts", ".tsx"))
|
|
102
|
+
]
|
|
83
103
|
if js_files:
|
|
84
104
|
# 尝试使用 eslint
|
|
85
105
|
returncode, stdout, stderr = self._run_command(
|
|
86
|
-
["npx", "eslint", "--max-warnings=0"]
|
|
106
|
+
["npx", "eslint", "--max-warnings=0"]
|
|
107
|
+
+ js_files[:5], # 限制文件数量
|
|
87
108
|
timeout=15,
|
|
88
109
|
)
|
|
89
110
|
duration = time.time() - start_time
|
|
90
111
|
output = stdout + stderr
|
|
91
112
|
# eslint返回非0可能是警告,不算失败
|
|
92
|
-
|
|
113
|
+
PrettyOutput.auto_print(
|
|
114
|
+
f"✅ Node.js (eslint) 构建验证成功(耗时 {duration:.2f} 秒)"
|
|
115
|
+
)
|
|
93
116
|
return BuildResult(
|
|
94
117
|
success=True, # 仅检查语法,警告不算失败
|
|
95
118
|
output=output,
|
|
@@ -97,9 +120,11 @@ class NodeJSBuildValidator(BuildValidatorBase):
|
|
|
97
120
|
build_system=BuildSystem.NODEJS,
|
|
98
121
|
duration=duration,
|
|
99
122
|
)
|
|
100
|
-
|
|
123
|
+
|
|
101
124
|
duration = time.time() - start_time
|
|
102
|
-
|
|
125
|
+
PrettyOutput.auto_print(
|
|
126
|
+
f"✅ Node.js 构建验证成功(耗时 {duration:.2f} 秒,无构建脚本)"
|
|
127
|
+
)
|
|
103
128
|
return BuildResult(
|
|
104
129
|
success=True,
|
|
105
130
|
output="Node.js项目验证通过(无构建脚本)",
|
|
@@ -107,4 +132,3 @@ class NodeJSBuildValidator(BuildValidatorBase):
|
|
|
107
132
|
build_system=BuildSystem.NODEJS,
|
|
108
133
|
duration=duration,
|
|
109
134
|
)
|
|
110
|
-
|