jarvis-ai-assistant 0.1.122__tar.gz → 0.1.124__tar.gz

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.

Files changed (74) hide show
  1. {jarvis_ai_assistant-0.1.122/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.124}/PKG-INFO +9 -9
  2. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/pyproject.toml +9 -5
  3. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/setup.py +5 -2
  4. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/__init__.py +1 -1
  5. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_agent/__init__.py +1 -1
  6. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_code_agent/code_agent.py +47 -86
  7. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_code_agent/file_select.py +0 -85
  8. jarvis_ai_assistant-0.1.124/src/jarvis/jarvis_code_agent/patch.py +377 -0
  9. jarvis_ai_assistant-0.1.124/src/jarvis/jarvis_dev/main.py +924 -0
  10. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform/base.py +21 -26
  11. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform/openai.py +1 -1
  12. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/chdir.py +25 -0
  13. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/create_code_agent.py +3 -6
  14. jarvis_ai_assistant-0.1.124/src/jarvis/jarvis_tools/execute_shell_script.py +58 -0
  15. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/git_commiter.py +21 -15
  16. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/read_code.py +1 -1
  17. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/search.py +0 -1
  18. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_utils/__init__.py +72 -24
  19. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124/src/jarvis_ai_assistant.egg-info}/PKG-INFO +9 -9
  20. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +2 -1
  21. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis_ai_assistant.egg-info/entry_points.txt +1 -0
  22. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis_ai_assistant.egg-info/requires.txt +3 -1
  23. jarvis_ai_assistant-0.1.122/src/jarvis/jarvis_code_agent/patch.py +0 -269
  24. jarvis_ai_assistant-0.1.122/src/jarvis/jarvis_code_agent/relevant_files.py +0 -117
  25. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/LICENSE +0 -0
  26. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/MANIFEST.in +0 -0
  27. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/README.md +0 -0
  28. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/setup.cfg +0 -0
  29. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_agent/output_handler.py +0 -0
  30. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_code_agent/__init__.py +0 -0
  31. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_codebase/__init__.py +0 -0
  32. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_codebase/main.py +0 -0
  33. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_lsp/base.py +0 -0
  34. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_lsp/cpp.py +0 -0
  35. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_lsp/go.py +0 -0
  36. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_lsp/python.py +0 -0
  37. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_lsp/registry.py +0 -0
  38. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_lsp/rust.py +0 -0
  39. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_multi_agent/__init__.py +0 -0
  40. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform/__init__.py +0 -0
  41. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform/ai8.py +0 -0
  42. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform/kimi.py +0 -0
  43. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform/ollama.py +0 -0
  44. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform/oyi.py +0 -0
  45. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform/registry.py +0 -0
  46. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform_manager/__init__.py +0 -0
  47. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform_manager/main.py +0 -0
  48. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_platform_manager/openai_test.py +0 -0
  49. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_rag/__init__.py +0 -0
  50. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_rag/main.py +0 -0
  51. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_smart_shell/__init__.py +0 -0
  52. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_smart_shell/main.py +0 -0
  53. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/__init__.py +0 -0
  54. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/ask_codebase.py +0 -0
  55. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/ask_user.py +0 -0
  56. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/base.py +0 -0
  57. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/code_review.py +0 -0
  58. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/create_sub_agent.py +0 -0
  59. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/execute_shell.py +0 -0
  60. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/file_operation.py +0 -0
  61. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/lsp_find_definition.py +0 -0
  62. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/lsp_find_references.py +0 -0
  63. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/lsp_get_diagnostics.py +0 -0
  64. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/lsp_get_document_symbols.py +0 -0
  65. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/lsp_prepare_rename.py +0 -0
  66. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/lsp_validate_edit.py +0 -0
  67. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/methodology.py +0 -0
  68. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/rag.py +0 -0
  69. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/read_webpage.py +0 -0
  70. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/registry.py +0 -0
  71. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/select_code_files.py +0 -0
  72. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis/jarvis_tools/tool_generator.py +0 -0
  73. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
  74. {jarvis_ai_assistant-0.1.122 → jarvis_ai_assistant-0.1.124}/src/jarvis_ai_assistant.egg-info/top_level.txt +0 -0
@@ -1,10 +1,10 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.122
3
+ Version: 0.1.124
4
4
  Summary: Jarvis: An AI assistant that uses tools to interact with the system
5
5
  Home-page: https://github.com/skyfireitdiy/Jarvis
6
6
  Author: skyfire
7
- Author-email: Your Name <your.email@example.com>
7
+ Author-email: skyfire <skyfireitdiy@hotmail.com>
8
8
  License: MIT License
9
9
 
10
10
  Copyright (c) 2025 skyfire
@@ -28,14 +28,15 @@ License: MIT License
28
28
  SOFTWARE.
29
29
  Project-URL: Homepage, https://github.com/skyfireitdiy/Jarvis
30
30
  Keywords: jarvis,ai,assistant,tools,automation
31
+ Classifier: Development Status :: 3 - Alpha
32
+ Classifier: Intended Audience :: Developers
31
33
  Classifier: License :: OSI Approved :: MIT License
32
- Classifier: Programming Language :: Python
34
+ Classifier: Operating System :: POSIX :: Linux
33
35
  Classifier: Programming Language :: Python :: 3
34
36
  Classifier: Programming Language :: Python :: 3.8
35
37
  Classifier: Programming Language :: Python :: 3.9
36
38
  Classifier: Programming Language :: Python :: 3.10
37
39
  Classifier: Programming Language :: Python :: 3.11
38
- Classifier: Operating System :: POSIX :: Linux
39
40
  Requires-Python: >=3.8
40
41
  Description-Content-Type: text/markdown
41
42
  License-File: LICENSE
@@ -45,7 +46,7 @@ Requires-Dist: colorama>=0.4.6
45
46
  Requires-Dist: prompt_toolkit>=3.0.0
46
47
  Requires-Dist: openai>=1.20.0
47
48
  Requires-Dist: playwright>=1.41.1
48
- Requires-Dist: numpy>=1.17.4
49
+ Requires-Dist: numpy>=1.19.5
49
50
  Requires-Dist: faiss-cpu>=1.8.0
50
51
  Requires-Dist: sentence-transformers>=2.2.2
51
52
  Requires-Dist: bs4>=0.0.1
@@ -61,14 +62,13 @@ Requires-Dist: fuzzywuzzy>=0.18.0
61
62
  Requires-Dist: python-Levenshtein>=0.25.0
62
63
  Requires-Dist: jedi>=0.17.2
63
64
  Requires-Dist: psutil>=7.0.0
65
+ Requires-Dist: fastapi>=0.115.4
66
+ Requires-Dist: uvicorn>=0.33.0
64
67
  Provides-Extra: dev
65
68
  Requires-Dist: pytest; extra == "dev"
66
69
  Requires-Dist: black; extra == "dev"
67
70
  Requires-Dist: isort; extra == "dev"
68
71
  Requires-Dist: mypy; extra == "dev"
69
- Dynamic: author
70
- Dynamic: home-page
71
- Dynamic: requires-python
72
72
 
73
73
  <div align="center">
74
74
 
@@ -4,20 +4,21 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jarvis-ai-assistant"
7
- version = "0.1.122"
7
+ version = "0.1.124"
8
8
  description = "Jarvis: An AI assistant that uses tools to interact with the system"
9
9
  readme = "README.md"
10
- authors = [{ name = "Your Name", email = "your.email@example.com" }]
10
+ authors = [{ name = "skyfire", email = "skyfireitdiy@hotmail.com" }]
11
11
  license = { file = "LICENSE" }
12
12
  classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
13
15
  "License :: OSI Approved :: MIT License",
14
- "Programming Language :: Python",
16
+ "Operating System :: POSIX :: Linux",
15
17
  "Programming Language :: Python :: 3",
16
18
  "Programming Language :: Python :: 3.8",
17
19
  "Programming Language :: Python :: 3.9",
18
20
  "Programming Language :: Python :: 3.10",
19
21
  "Programming Language :: Python :: 3.11",
20
- "Operating System :: POSIX :: Linux",
21
22
  ]
22
23
  keywords = ["jarvis", "ai", "assistant", "tools", "automation"]
23
24
  dependencies = [
@@ -27,7 +28,7 @@ dependencies = [
27
28
  "prompt_toolkit>=3.0.0",
28
29
  "openai>=1.20.0",
29
30
  "playwright>=1.41.1",
30
- "numpy>=1.17.4",
31
+ "numpy>=1.19.5",
31
32
  "faiss-cpu>=1.8.0",
32
33
  "sentence-transformers>=2.2.2",
33
34
  "bs4>=0.0.1",
@@ -43,6 +44,8 @@ dependencies = [
43
44
  "python-Levenshtein>=0.25.0",
44
45
  "jedi>=0.17.2",
45
46
  "psutil>=7.0.0",
47
+ "fastapi>=0.115.4",
48
+ "uvicorn>=0.33.0",
46
49
  ]
47
50
  requires-python = ">=3.8"
48
51
 
@@ -64,3 +67,4 @@ jarvis-platform-manager = "jarvis.jarvis_platform_manager.main:main"
64
67
  jarvis-git-commit = "jarvis.jarvis_tools.git_commiter:main"
65
68
  jarvis-code-review = "jarvis.jarvis_tools.code_review:main"
66
69
  jgc = "jarvis.jarvis_tools.git_commiter:main"
70
+ jarvis-dev = "jarvis.jarvis_dev.main:main"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="jarvis-ai-assistant",
5
- version="0.1.122",
5
+ version="0.1.124",
6
6
  author="skyfire",
7
7
  author_email="skyfireitdiy@hotmail.com",
8
8
  description="An AI assistant that uses various tools to interact with the system",
@@ -19,7 +19,7 @@ setup(
19
19
  "prompt_toolkit>=3.0.0",
20
20
  "openai>=1.20.0",
21
21
  "playwright>=1.41.1",
22
- "numpy==1.17.4",
22
+ "numpy>=1.19.5",
23
23
  "faiss-cpu>=1.8.0",
24
24
  "sentence-transformers>=2.2.2",
25
25
  "bs4>=0.0.1",
@@ -35,6 +35,8 @@ setup(
35
35
  "python-Levenshtein>=0.25.0",
36
36
  "jedi>=0.17.2",
37
37
  "psutil>=7.0.0",
38
+ "fastapi>=0.115.4",
39
+ "uvicorn>=0.33.0",
38
40
  ],
39
41
  entry_points={
40
42
  "console_scripts": [
@@ -49,6 +51,7 @@ setup(
49
51
  "jarvis-git-commit=jarvis.jarvis_tools.git_commiter:main",
50
52
  "jarvis-code-review=jarvis.jarvis_tools.code_review:main",
51
53
  "jgc=jarvis.jarvis_tools.git_commiter:main",
54
+ "jarvis-dev=jarvis.jarvis_dev.main:main",
52
55
  ],
53
56
  },
54
57
  python_requires=">=3.8",
@@ -1,3 +1,3 @@
1
1
  """Jarvis AI Assistant"""
2
2
 
3
- __version__ = "0.1.122"
3
+ __version__ = "0.1.124"
@@ -327,7 +327,7 @@ Please continue the task based on the above information.
327
327
  return self._complete_task()
328
328
 
329
329
  # 获取用户输入
330
- user_input = get_multiline_input(f"{self.name}: 您可以继续输入,或输入空行来结束当前任务:")
330
+ user_input = get_multiline_input(f"{self.name}: 请输入,或输入空行来结束当前任务:")
331
331
 
332
332
  if user_input:
333
333
  self.prompt = user_input
@@ -1,14 +1,16 @@
1
+ import subprocess
1
2
  import os
2
3
  from typing import Dict, List
3
4
 
4
5
  from jarvis.jarvis_agent import Agent
5
- from jarvis.jarvis_code_agent.file_select import file_input_handler, select_files
6
- from jarvis.jarvis_code_agent.patch import PatchOutputHandler
7
- from jarvis.jarvis_code_agent.relevant_files import find_relevant_information
6
+ from jarvis.jarvis_code_agent.file_select import select_files
7
+ from jarvis.jarvis_code_agent.patch import PatchOutputHandler, file_input_handler
8
8
  from jarvis.jarvis_platform.registry import PlatformRegistry
9
9
  from jarvis.jarvis_tools.git_commiter import GitCommitTool
10
10
  from jarvis.jarvis_tools.registry import ToolRegistry
11
11
  from jarvis.jarvis_tools.read_code import ReadCodeTool
12
+ from jarvis.jarvis_utils import get_commits_between
13
+ from jarvis.jarvis_utils import OutputType, PrettyOutput, get_multiline_input, has_uncommitted_changes, init_env, find_git_root, user_confirm, get_latest_commit_hash
12
14
  from jarvis.jarvis_utils import OutputType, PrettyOutput, get_multiline_input, has_uncommitted_changes, init_env, find_git_root, user_confirm
13
15
 
14
16
 
@@ -18,6 +20,7 @@ class CodeAgent:
18
20
  tool_registry = ToolRegistry()
19
21
  tool_registry.use_tools(["read_code",
20
22
  "execute_shell",
23
+ "execute_shell_script",
21
24
  "search",
22
25
  "create_code_agent",
23
26
  "ask_user",
@@ -29,44 +32,32 @@ class CodeAgent:
29
32
  "lsp_prepare_rename",
30
33
  "lsp_validate_edit"])
31
34
  code_system_prompt = """
32
- # Role: Senior Code Engineer
33
- Expert in precise code modifications with minimal impact.
34
-
35
- ## Key Responsibilities
36
- 1. Code Analysis
37
- - Use `read_code` and LSP tools before changes
38
- - Identify dependencies and patterns
39
-
40
- 2. Modification Rules
41
- - Single atomic change per operation
42
- - Strict style consistency
43
- - Complete implementations (no stubs)
44
- - Full error handling
45
-
46
- 3. Quality Assurance
47
- - Validate with LSP tools
48
- - Document complex logic
49
- - Maintain API contracts
50
-
35
+ # Role: Code Engineer
36
+ Expert in precise code modifications with proper tool usage.
37
+ ## Tool Usage Guide
38
+ 1. read_code: Analyze code files before changes
39
+ 2. execute_shell: Run system commands safely
40
+ 3. execute_shell_script: Execute script files
41
+ 4. search: Find technical information
42
+ 5. create_code_agent: Create new code agents
43
+ 6. ask_user: Clarify requirements
44
+ 7. ask_codebase: Analyze codebase structure
45
+ 8. lsp_get_document_symbols: List code symbols
46
+ 9. lsp_get_diagnostics: Check code errors
47
+ 10. lsp_find_references: Find symbol usage
48
+ 11. lsp_find_definition: Locate symbol definitions
49
+ 12. lsp_prepare_rename: Check rename safety
50
+ 13. lsp_validate_edit: Verify code changes
51
51
  ## Workflow
52
- 1. File Operations Order:
53
- a) Move/Remove files
54
- b) Create new files
55
- c) Delete code blocks
56
- d) Replace existing code
57
- e) Insert new code
58
-
59
- 2. Large File Handling:
60
- - Locate specific sections first
61
- - Read targeted ranges
62
- - Make focused changes
63
-
52
+ 1. Analyze: Use read_code and LSP tools
53
+ 2. Modify: Make minimal, precise changes
54
+ 3. Validate: Verify with LSP tools
55
+ 4. Document: Explain non-obvious logic
64
56
  ## Best Practices
65
- - Prefer minimal changes over rewrites
66
- - Preserve existing interfaces
67
57
  - Verify line ranges carefully
68
- - Test edge cases implicitly
69
- - Document non-obvious logic
58
+ - Preserve existing interfaces
59
+ - Test edge cases
60
+ - Document changes
70
61
  """
71
62
  self.agent = Agent(system_prompt=code_system_prompt,
72
63
  name="CodeAgent",
@@ -90,26 +81,6 @@ Expert in precise code modifications with minimal impact.
90
81
  git_commiter.execute({})
91
82
 
92
83
 
93
- def make_files_prompt(self, files: List[Dict[str, str]]) -> str:
94
- """Make the files prompt with content that fits within token limit.
95
-
96
- Args:
97
- files: The files to be modified
98
-
99
- Returns:
100
- str: A prompt containing file paths and contents within token limit
101
- """
102
- prompt_parts = []
103
-
104
- # Then try to add file contents
105
- for file in files:
106
- prompt_parts.append(f'''- {file['file']} ({file['reason']})''')
107
-
108
- result = ReadCodeTool().execute({"files": [{"path": file["file"]} for file in files]})
109
- if result["success"]:
110
- prompt_parts.append(result["stdout"])
111
-
112
- return "\n".join(prompt_parts)
113
84
 
114
85
  def run(self, user_input: str) :
115
86
  """Run the code agent with the given user input.
@@ -122,40 +93,30 @@ Expert in precise code modifications with minimal impact.
122
93
  """
123
94
  try:
124
95
  self._init_env()
125
- information = ""
126
- if user_confirm("是否需要手动选择文件?", True):
127
- files = select_files([], self.root_dir)
128
- else:
129
- files, information = find_relevant_information(user_input, self.root_dir)
130
- self.agent.run(self._build_first_edit_prompt(user_input, self.make_files_prompt(files), information))
96
+ start_commit = get_latest_commit_hash()
97
+
98
+
99
+ self.agent.run(user_input)
100
+
101
+ end_commit = get_latest_commit_hash()
102
+ # Print commit history between start and end commits
103
+ commits = get_commits_between(start_commit, end_commit)
104
+ if commits:
105
+ commit_messages = "检测到以下提交记录:\n" + "\n".join([f"- {commit_hash[:7]}: {message}" for commit_hash, message in commits])
106
+ PrettyOutput.print(commit_messages, OutputType.INFO)
131
107
 
108
+ if start_commit and end_commit and start_commit != end_commit and user_confirm("检测到多个提交,是否要合并为一个更清晰的提交记录?", True):
109
+ # Reset to start commit
110
+ subprocess.run(["git", "reset", "--soft", start_commit], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
111
+ # Create new commit
112
+ git_commiter = GitCommitTool()
113
+ git_commiter.execute({})
114
+
132
115
  except Exception as e:
133
116
  return f"Error during execution: {str(e)}"
134
117
 
135
118
 
136
119
 
137
- def _build_first_edit_prompt(self, user_input: str, files_prompt: str, information: str) -> str:
138
- """Build the initial prompt for the agent.
139
-
140
- Args:
141
- user_input: The user's requirement
142
- files_prompt: The formatted list of relevant files
143
-
144
- Returns:
145
- str: The formatted prompt
146
- """
147
-
148
- return f"""# Code Modification Task
149
-
150
- ## User Requirement
151
- {user_input}
152
-
153
- ## Maybe Relevant Files
154
- {files_prompt}
155
-
156
- ## Some Information
157
- {information}
158
- """
159
120
  def main():
160
121
  """Jarvis main entry point"""
161
122
  # Add argument parser
@@ -213,88 +213,3 @@ def select_files(related_files: List[Dict[str, str]], root_dir: str) -> List[Dic
213
213
  if tips:
214
214
  PrettyOutput.print(tips, OutputType.INFO)
215
215
  return selected_files
216
-
217
- def file_input_handler(user_input: str, agent: Any) -> str:
218
- """Handle file input with optional line ranges.
219
-
220
- Args:
221
- user_input: User input string containing file references
222
- agent: Agent instance (unused in current implementation)
223
-
224
- Returns:
225
- str: Prompt with file contents prepended if files are found
226
- """
227
- prompt = user_input
228
- files = []
229
-
230
- # Match file references in backticks
231
- file_refs = re.findall(r'`([^`]+)`', user_input)
232
-
233
- for ref in file_refs:
234
- # Handle file:start,end or file:start:end format
235
- if ':' in ref:
236
- file_path, line_range = ref.split(':', 1)
237
- # Initialize with default values
238
- start_line = 1 # 1-based
239
- end_line = -1
240
-
241
- # Process line range if specified
242
- if ',' in line_range or ':' in line_range:
243
- try:
244
- raw_start, raw_end = map(int, re.split(r'[,:]', line_range))
245
-
246
- # Handle special values and Python-style negative indices
247
- with open(file_path, 'r', encoding='utf-8') as f:
248
- total_lines = len(f.readlines())
249
-
250
- # Process start line
251
- if raw_start == 0: # 0表示整个文件
252
- start_line = 1
253
- end_line = total_lines
254
- else:
255
- start_line = raw_start if raw_start > 0 else total_lines + raw_start + 1
256
-
257
- # Process end line
258
- if raw_end == 0: # 0表示整个文件(如果start也是0)
259
- end_line = total_lines
260
- else:
261
- end_line = raw_end if raw_end > 0 else total_lines + raw_end + 1
262
-
263
- # Auto-correct ranges
264
- start_line = max(1, min(start_line, total_lines))
265
- end_line = max(start_line, min(end_line, total_lines))
266
-
267
- # Final validation
268
- if start_line < 1 or end_line > total_lines or start_line > end_line:
269
- raise ValueError
270
-
271
- except (ValueError, FileNotFoundError) as e:
272
- PrettyOutput.print(
273
- f"无效的行号范围: {line_range} (文件总行数: {total_lines})",
274
- OutputType.WARNING
275
- )
276
- continue
277
-
278
- # Add file if it exists
279
- if os.path.isfile(file_path):
280
- files.append({
281
- "path": file_path,
282
- "start_line": start_line,
283
- "end_line": end_line
284
- })
285
- else:
286
- # Handle simple file path
287
- if os.path.isfile(ref):
288
- files.append({
289
- "path": ref,
290
- "start_line": 1, # 1-based
291
- "end_line": -1
292
- })
293
-
294
- # Read and process files if any were found
295
- if files:
296
- result = ReadCodeTool().execute({"files": files})
297
- if result["success"]:
298
- return result["stdout"] + "\n" + prompt
299
-
300
- return prompt