jarvis-ai-assistant 0.1.103__tar.gz → 0.1.104__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 (59) hide show
  1. {jarvis_ai_assistant-0.1.103/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.104}/PKG-INFO +78 -53
  2. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/README.md +77 -52
  3. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/pyproject.toml +2 -2
  4. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/setup.py +2 -2
  5. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/__init__.py +1 -1
  6. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_code_agent/file_select.py +4 -6
  7. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_code_agent/patch.py +2 -0
  8. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_code_agent/relevant_files.py +40 -9
  9. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_codebase/main.py +8 -15
  10. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_platform/main.py +1 -1
  11. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_rag/main.py +2 -2
  12. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/ask_codebase.py +1 -4
  13. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/chdir.py +2 -37
  14. jarvis_ai_assistant-0.1.104/src/jarvis/tools/code_review.py +210 -0
  15. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/create_ctags_agent.py +0 -12
  16. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/find_in_codebase.py +0 -30
  17. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/git_commiter.py +1 -1
  18. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/rag.py +1 -1
  19. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/read_code.py +0 -31
  20. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/utils.py +3 -3
  21. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104/src/jarvis_ai_assistant.egg-info}/PKG-INFO +78 -53
  22. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +0 -1
  23. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis_ai_assistant.egg-info/entry_points.txt +1 -1
  24. jarvis_ai_assistant-0.1.103/src/jarvis/tools/code_review.py +0 -163
  25. jarvis_ai_assistant-0.1.103/src/jarvis/tools/create_code_sub_agent.py +0 -30
  26. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/LICENSE +0 -0
  27. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/MANIFEST.in +0 -0
  28. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/setup.cfg +0 -0
  29. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/agent.py +0 -0
  30. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_code_agent/__init__.py +0 -0
  31. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_code_agent/code_agent.py +0 -0
  32. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_codebase/__init__.py +0 -0
  33. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_platform/__init__.py +0 -0
  34. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_rag/__init__.py +0 -0
  35. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_smart_shell/__init__.py +0 -0
  36. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/jarvis_smart_shell/main.py +0 -0
  37. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/models/__init__.py +0 -0
  38. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/models/ai8.py +0 -0
  39. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/models/base.py +0 -0
  40. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/models/kimi.py +0 -0
  41. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/models/ollama.py +0 -0
  42. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/models/openai.py +0 -0
  43. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/models/oyi.py +0 -0
  44. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/models/registry.py +0 -0
  45. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/__init__.py +0 -0
  46. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/ask_user.py +0 -0
  47. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/base.py +0 -0
  48. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/create_code_test_agent.py +0 -0
  49. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/create_sub_agent.py +0 -0
  50. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/execute_shell.py +0 -0
  51. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/file_operation.py +0 -0
  52. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/methodology.py +0 -0
  53. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/read_webpage.py +0 -0
  54. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/registry.py +0 -0
  55. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/search.py +0 -0
  56. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis/tools/select_code_files.py +0 -0
  57. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
  58. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis_ai_assistant.egg-info/requires.txt +0 -0
  59. {jarvis_ai_assistant-0.1.103 → jarvis_ai_assistant-0.1.104}/src/jarvis_ai_assistant.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jarvis-ai-assistant
3
- Version: 0.1.103
3
+ Version: 0.1.104
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
@@ -153,20 +153,18 @@ Jarvis supports configuration through environment variables that can be set in t
153
153
 
154
154
  ## 🎯 Usage
155
155
 
156
- ### Main Assistant
156
+ ### Code Modification
157
157
  ```bash
158
+ # Using main agent
158
159
  jarvis
160
+
161
+ # Using code agent directly
162
+ jarvis-code-agent
159
163
  ```
160
164
 
161
- ### Codebase Search
165
+ ### Codebase Query
162
166
  ```bash
163
- # Generate codebase index
164
- jarvis-codebase generate
165
-
166
- # Search similar code
167
- jarvis-codebase search "your search query"
168
-
169
- # Ask questions about codebase
167
+ # Ask questions about the codebase
170
168
  jarvis-codebase ask "your question"
171
169
  ```
172
170
 
@@ -175,71 +173,98 @@ jarvis-codebase ask "your question"
175
173
  # Build document index
176
174
  jarvis-rag --dir /path/to/documents --build
177
175
 
178
- # Search documents
179
- jarvis-rag --query "your search query"
176
+ # Ask questions about documents
177
+ jarvis-rag --query "your question"
178
+ ```
179
+
180
+ ### Smart Shell
181
+ ```bash
182
+ # Using full name
183
+ jarvis-smart-shell "describe what you want to do"
184
+
185
+ # Using shorthand
186
+ jss "describe what you want to do"
180
187
  ```
181
188
 
182
- ### Search Tool
189
+ ### Development Tools
183
190
  ```bash
184
- # Basic search
185
- jarvis-search "your query"
191
+ # Manage git commits
192
+ jarvis-git-commit
186
193
 
187
- # Show only URLs
188
- jarvis-search "your query" --url-only
194
+ # Generate and manage ctags
195
+ jarvis-ctags
189
196
 
190
- # Limit results
191
- jarvis-search "your query" --max 3
197
+ # Manage AI platforms
198
+ jarvis-platform
192
199
  ```
193
200
 
194
- ## 🛠️ Tools
201
+ Each command supports `--help` flag for detailed usage information:
202
+ ```bash
203
+ jarvis --help
204
+ jarvis-code-agent --help
205
+ jarvis-codebase --help
206
+ jarvis-rag --help
207
+ jarvis-smart-shell --help
208
+ jarvis-platform --help
209
+ jarvis-git-commit --help
210
+ jarvis-ctags --help
211
+ ```
195
212
 
213
+ ## 🛠️ Tools
196
214
 
197
215
  ### Built-in Tools
198
216
 
199
217
  | Tool | Description |
200
218
  |------|-------------|
219
+ | read_code | Read code files with line numbers and range support |
201
220
  | execute_shell | Execute system commands and capture output |
202
- | file_operation | File operations (read/write/append/delete) |
203
- | generate_tool | AI-powered tool generation and integration |
204
- | methodology | Experience accumulation and methodology management |
205
- | create_sub_agent | Create specialized sub-agents for specific tasks |
206
- | coder | Automatic code modification and generation tool |
207
- | codebase | Codebase management and search tool |
221
+ | search | Web search for development related queries |
222
+ | ask_user | Interactive user input collection |
223
+ | ask_codebase | Intelligent codebase querying and analysis |
224
+ | code_review | Automated code review with multi-dimensional analysis |
225
+ | file_operation | Basic file operations (read/exists) |
226
+ | git_commiter | Automated git commit handling |
208
227
 
209
228
  ### Tool Locations
210
229
  - Built-in tools: `src/jarvis/tools/`
211
230
  - User tools: `~/.jarvis/tools/`
212
231
 
213
-
214
232
  ### Key Features
215
233
 
216
- #### 1. Self-Extending Capabilities
217
- - Tool generation through natural language description
218
- - Automatic code generation and integration
219
- - Dynamic capability expansion through sub-agents
220
- - Automatic code modification with version control
221
- - Codebase indexing and semantic search
222
-
223
- #### 2. Methodology Learning
224
- - Automatic experience accumulation from interactions
225
- - Pattern recognition and methodology extraction
226
- - Continuous refinement through usage
227
- - Code modification history tracking
228
- - Codebase analysis and documentation generation
229
-
230
- #### 3. Adaptive Problem Solving
231
- - Context-aware sub-agent creation
232
- - Dynamic tool composition
233
- - Learning from execution feedback
234
+ #### 1. Code Intelligence
235
+ - Smart file selection and analysis based on requirements
236
+ - Semantic codebase search and querying
237
+ - Efficient handling of large files with context-aware reading
238
+ - Precise patch-based code modifications
239
+ - Automated git commit management
240
+
241
+ #### 2. Multi-Model Architecture
242
+ - Support for multiple AI platforms (Kimi/OpenAI/AI8/OYI/Ollama)
243
+ - Platform-specific optimizations for different tasks
244
+ - Specialized models for code generation, thinking, and general tasks
245
+ - Streaming response support for better interaction
246
+ - Automatic model fallback and retry mechanisms
247
+
248
+ #### 3. RAG Capabilities
249
+ - Document indexing and semantic search
250
+ - Smart context management for large documents
251
+ - Automatic file change detection
252
+ - Efficient caching mechanisms
253
+ - Multi-format document support
254
+
255
+ #### 4. Development Tools
256
+ - Interactive shell command generation
257
+ - Code review with multi-dimensional analysis
234
258
  - Codebase-aware problem solving
235
- - Multi-model collaboration for complex tasks
236
-
237
- #### 4. Code Intelligence
238
- - Automatic codebase indexing
239
- - Semantic code search
240
- - Code modification with git integration
241
- - Code analysis and documentation
242
- - Multi-model code generation
259
+ - File operations with safety checks
260
+ - Progress tracking and error handling
261
+
262
+ #### 5. User Experience
263
+ - Beautiful console output with color support
264
+ - Interactive multi-line input
265
+ - Progress indicators for long operations
266
+ - Clear error messages and handling
267
+ - Context-aware response formatting
243
268
 
244
269
  ## 🎯 Extending Jarvis
245
270
 
@@ -83,20 +83,18 @@ Jarvis supports configuration through environment variables that can be set in t
83
83
 
84
84
  ## 🎯 Usage
85
85
 
86
- ### Main Assistant
86
+ ### Code Modification
87
87
  ```bash
88
+ # Using main agent
88
89
  jarvis
90
+
91
+ # Using code agent directly
92
+ jarvis-code-agent
89
93
  ```
90
94
 
91
- ### Codebase Search
95
+ ### Codebase Query
92
96
  ```bash
93
- # Generate codebase index
94
- jarvis-codebase generate
95
-
96
- # Search similar code
97
- jarvis-codebase search "your search query"
98
-
99
- # Ask questions about codebase
97
+ # Ask questions about the codebase
100
98
  jarvis-codebase ask "your question"
101
99
  ```
102
100
 
@@ -105,71 +103,98 @@ jarvis-codebase ask "your question"
105
103
  # Build document index
106
104
  jarvis-rag --dir /path/to/documents --build
107
105
 
108
- # Search documents
109
- jarvis-rag --query "your search query"
106
+ # Ask questions about documents
107
+ jarvis-rag --query "your question"
108
+ ```
109
+
110
+ ### Smart Shell
111
+ ```bash
112
+ # Using full name
113
+ jarvis-smart-shell "describe what you want to do"
114
+
115
+ # Using shorthand
116
+ jss "describe what you want to do"
110
117
  ```
111
118
 
112
- ### Search Tool
119
+ ### Development Tools
113
120
  ```bash
114
- # Basic search
115
- jarvis-search "your query"
121
+ # Manage git commits
122
+ jarvis-git-commit
116
123
 
117
- # Show only URLs
118
- jarvis-search "your query" --url-only
124
+ # Generate and manage ctags
125
+ jarvis-ctags
119
126
 
120
- # Limit results
121
- jarvis-search "your query" --max 3
127
+ # Manage AI platforms
128
+ jarvis-platform
122
129
  ```
123
130
 
124
- ## 🛠️ Tools
131
+ Each command supports `--help` flag for detailed usage information:
132
+ ```bash
133
+ jarvis --help
134
+ jarvis-code-agent --help
135
+ jarvis-codebase --help
136
+ jarvis-rag --help
137
+ jarvis-smart-shell --help
138
+ jarvis-platform --help
139
+ jarvis-git-commit --help
140
+ jarvis-ctags --help
141
+ ```
125
142
 
143
+ ## 🛠️ Tools
126
144
 
127
145
  ### Built-in Tools
128
146
 
129
147
  | Tool | Description |
130
148
  |------|-------------|
149
+ | read_code | Read code files with line numbers and range support |
131
150
  | execute_shell | Execute system commands and capture output |
132
- | file_operation | File operations (read/write/append/delete) |
133
- | generate_tool | AI-powered tool generation and integration |
134
- | methodology | Experience accumulation and methodology management |
135
- | create_sub_agent | Create specialized sub-agents for specific tasks |
136
- | coder | Automatic code modification and generation tool |
137
- | codebase | Codebase management and search tool |
151
+ | search | Web search for development related queries |
152
+ | ask_user | Interactive user input collection |
153
+ | ask_codebase | Intelligent codebase querying and analysis |
154
+ | code_review | Automated code review with multi-dimensional analysis |
155
+ | file_operation | Basic file operations (read/exists) |
156
+ | git_commiter | Automated git commit handling |
138
157
 
139
158
  ### Tool Locations
140
159
  - Built-in tools: `src/jarvis/tools/`
141
160
  - User tools: `~/.jarvis/tools/`
142
161
 
143
-
144
162
  ### Key Features
145
163
 
146
- #### 1. Self-Extending Capabilities
147
- - Tool generation through natural language description
148
- - Automatic code generation and integration
149
- - Dynamic capability expansion through sub-agents
150
- - Automatic code modification with version control
151
- - Codebase indexing and semantic search
152
-
153
- #### 2. Methodology Learning
154
- - Automatic experience accumulation from interactions
155
- - Pattern recognition and methodology extraction
156
- - Continuous refinement through usage
157
- - Code modification history tracking
158
- - Codebase analysis and documentation generation
159
-
160
- #### 3. Adaptive Problem Solving
161
- - Context-aware sub-agent creation
162
- - Dynamic tool composition
163
- - Learning from execution feedback
164
+ #### 1. Code Intelligence
165
+ - Smart file selection and analysis based on requirements
166
+ - Semantic codebase search and querying
167
+ - Efficient handling of large files with context-aware reading
168
+ - Precise patch-based code modifications
169
+ - Automated git commit management
170
+
171
+ #### 2. Multi-Model Architecture
172
+ - Support for multiple AI platforms (Kimi/OpenAI/AI8/OYI/Ollama)
173
+ - Platform-specific optimizations for different tasks
174
+ - Specialized models for code generation, thinking, and general tasks
175
+ - Streaming response support for better interaction
176
+ - Automatic model fallback and retry mechanisms
177
+
178
+ #### 3. RAG Capabilities
179
+ - Document indexing and semantic search
180
+ - Smart context management for large documents
181
+ - Automatic file change detection
182
+ - Efficient caching mechanisms
183
+ - Multi-format document support
184
+
185
+ #### 4. Development Tools
186
+ - Interactive shell command generation
187
+ - Code review with multi-dimensional analysis
164
188
  - Codebase-aware problem solving
165
- - Multi-model collaboration for complex tasks
166
-
167
- #### 4. Code Intelligence
168
- - Automatic codebase indexing
169
- - Semantic code search
170
- - Code modification with git integration
171
- - Code analysis and documentation
172
- - Multi-model code generation
189
+ - File operations with safety checks
190
+ - Progress tracking and error handling
191
+
192
+ #### 5. User Experience
193
+ - Beautiful console output with color support
194
+ - Interactive multi-line input
195
+ - Progress indicators for long operations
196
+ - Clear error messages and handling
197
+ - Context-aware response formatting
173
198
 
174
199
  ## 🎯 Extending Jarvis
175
200
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jarvis-ai-assistant"
7
- version = "0.1.103"
7
+ version = "0.1.104"
8
8
  description = "Jarvis: An AI assistant that uses tools to interact with the system"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Your Name", email = "your.email@example.com" }]
@@ -58,6 +58,6 @@ jarvis-rag = "jarvis.jarvis_rag.main:main"
58
58
  jarvis-smart-shell = "jarvis.jarvis_smart_shell.main:main"
59
59
  jss = "jarvis.jarvis_smart_shell.main:main"
60
60
  jarvis-platform = "jarvis.jarvis_platform.main:main"
61
- jarvis-gh = "jarvis.jarvis_github.main:main"
62
61
  jarvis-git-commit = "jarvis.tools.git_commiter:main"
63
62
  jarvis-ctags = "jarvis.tools.create_ctags_agent:main"
63
+ jarvis-code-review = "jarvis.tools.code_review: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.103",
5
+ version="0.1.104",
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",
@@ -43,9 +43,9 @@ setup(
43
43
  "jarvis-smart-shell=jarvis.jarvis_smart_shell.main:main",
44
44
  "jss=jarvis.jarvis_smart_shell.main:main",
45
45
  "jarvis-platform=jarvis.jarvis_platform.main:main",
46
- "jarvis-gh=jarvis.jarvis_github.main:main",
47
46
  "jarvis-git-commit=jarvis.tools.git_commiter:main",
48
47
  "jarvis-ctags=jarvis.tools.create_ctags_agent:main",
48
+ "jarvis-code-review=jarvis.tools.code_review:main",
49
49
  ],
50
50
  },
51
51
  python_requires=">=3.8",
@@ -1,3 +1,3 @@
1
1
  """Jarvis AI Assistant"""
2
2
 
3
- __version__ = "0.1.103"
3
+ __version__ = "0.1.104"
@@ -3,7 +3,7 @@ import re
3
3
  from typing import Dict, List
4
4
  from prompt_toolkit import PromptSession
5
5
  from prompt_toolkit.completion import WordCompleter, Completer, Completion
6
- from jarvis.utils import OutputType, PrettyOutput, get_single_line_input
6
+ from jarvis.utils import OutputType, PrettyOutput, get_single_line_input, user_confirm
7
7
 
8
8
 
9
9
  def _parse_file_selection(input_str: str, max_index: int) -> List[int]:
@@ -135,11 +135,10 @@ def select_files(related_files: List[str], root_dir: str) -> List[str]:
135
135
  for i, file in enumerate(related_files, 1):
136
136
  output += f"[{i}] {file}\n"
137
137
 
138
- PrettyOutput.print(output, OutputType.INFO)
138
+ PrettyOutput.print(output, OutputType.INFO, lang="markdown")
139
139
 
140
140
  # Ask the user if they need to adjust the file list
141
- user_input = get_single_line_input("Do you need to adjust the file list? (y/n) [n]").strip().lower() or 'n'
142
- if user_input == 'y':
141
+ if user_confirm("Do you need to adjust the file list?", False):
143
142
  # Let the user select files
144
143
  numbers = get_single_line_input("Please enter the file numbers to include (support: 1,3-6 format, press Enter to keep the current selection)").strip()
145
144
  if numbers:
@@ -150,8 +149,7 @@ def select_files(related_files: List[str], root_dir: str) -> List[str]:
150
149
  PrettyOutput.print("No valid files selected, keep the current selection", OutputType.WARNING)
151
150
 
152
151
  # Ask if they need to supplement files
153
- user_input = get_single_line_input("Do you need to supplement other files? (y/n) [n]").strip().lower() or 'n'
154
- if user_input == 'y':
152
+ if user_confirm("Do you need to supplement other files?", False):
155
153
  # Create file completion session
156
154
  session = PromptSession(
157
155
  completer=_get_file_completer(root_dir),
@@ -108,6 +108,8 @@ def handle_commit_workflow()->bool:
108
108
  Returns:
109
109
  tuple[bool, str, str]: (continue_execution, commit_id, commit_message)
110
110
  """
111
+ diff = os.popen("git diff HEAD").read()
112
+ PrettyOutput.print(diff, OutputType.CODE, lang="diff")
111
113
  if not user_confirm("Do you want to commit the code?", default=True):
112
114
  os.system("git reset HEAD")
113
115
  os.system("git checkout -- .")
@@ -1,6 +1,3 @@
1
-
2
-
3
-
4
1
  import os
5
2
  import re
6
3
  from typing import List
@@ -27,19 +24,53 @@ def find_relevant_files(user_input: str, root_dir: str) -> List[str]:
27
24
  find_file_tool_registry.use_tools(["read_code", "execute_shell"])
28
25
  find_file_agent = Agent(
29
26
  system_prompt="""You are a file agent, you are responsible for finding files related to the user's requirement.
30
- You can use `read_code` tool to read the code and analyze the code, and `execute_shell` tool to execute shell command(such as `grep/find/ls/git/ctags`) to find files.
31
27
 
32
- IMPORTANT:
33
- - Only provide the file path, do not provide any other information.
34
- - If you can't find the file, please provide empty list.
35
- - Don't modify the code, just find related files.
28
+ SEARCH STRATEGY:
29
+ 1. First Pass - Quick Search:
30
+ - Use `execute_shell` with git grep/find to locate potential files
31
+ - Search for key terms, function names, and relevant patterns
32
+ - Example: execute_shell("git grep -l 'search_term'")
33
+
34
+ 2. Content Analysis:
35
+ - For each potential file, analyze its content
36
+ - Follow the file reading guidelines for large files
37
+ - Look for:
38
+ * Direct matches to requirement terms
39
+ * Related functionality
40
+ * Imported/referenced files
41
+ * Test files for modified code
42
+
43
+ FILE READING GUIDELINES:
44
+ 1. For Large Files (>200 lines):
45
+ - Do NOT read the entire file at once
46
+ - First use grep/ctags to locate relevant sections
47
+ - Then read specific sections with context
48
+ - Example:
49
+ * execute_shell("grep -n 'function_name' path/to/file")
50
+ * read_code("path/to/file", start_line=found_line-10, end_line=found_line+20)
51
+
52
+ 2. For Small Files:
53
+ - Can read entire file directly
54
+
55
+ IMPORTANT RULES:
56
+ - Only return files that are DIRECTLY related to the requirement
57
+ - Exclude false positives and loosely related files
58
+ - If a file only contains imports/references, don't include it
59
+ - Include both implementation and test files when relevant
60
+ - If unsure about a file, use grep/read_code to verify relevance
61
+ - Return empty list if no truly relevant files are found
62
+ - Do NOT modify any code, only find files
63
+
64
+ OUTPUT FORMAT:
65
+ - Only provide file paths in the specified YAML format
66
+ - No additional explanations or comments
36
67
  """,
37
68
  name="FindFileAgent",
38
69
  is_sub_agent=True,
39
70
  tool_registry=find_file_tool_registry,
40
71
  platform=PlatformRegistry().get_normal_platform(),
41
72
  auto_complete=True,
42
- summary_prompt="""Please provide the file path as this format(yaml list), if you can't find the file, please provide empty list:
73
+ summary_prompt="""Please provide the file paths as YAML list:
43
74
  <FILE_PATH>
44
75
  - file_path1
45
76
  - file_path2
@@ -9,7 +9,7 @@ from jarvis.models.registry import PlatformRegistry
9
9
  import concurrent.futures
10
10
  from threading import Lock
11
11
  from concurrent.futures import ThreadPoolExecutor
12
- from jarvis.utils import OutputType, PrettyOutput, find_git_root, get_file_md5, get_max_context_length, get_single_line_input, get_thread_count, load_embedding_model, load_rerank_model
12
+ from jarvis.utils import OutputType, PrettyOutput, find_git_root, get_file_md5, get_max_context_length, get_single_line_input, get_thread_count, load_embedding_model, load_rerank_model, user_confirm
13
13
  from jarvis.utils import init_env
14
14
  import argparse
15
15
  import pickle
@@ -443,16 +443,9 @@ Content: {content}
443
443
 
444
444
  # If force is True, continue directly
445
445
  if not force:
446
- # Ask the user whether to continue
447
- while True:
448
- response = get_single_line_input("Rebuild the index? [y/N]").lower().strip()
449
- if response in ['y', 'yes']:
450
- break
451
- elif response in ['', 'n', 'no']:
452
- PrettyOutput.print("Cancel rebuilding the index", output_type=OutputType.INFO)
453
- return
454
- else:
455
- PrettyOutput.print("Please input y or n", output_type=OutputType.WARNING)
446
+ if not user_confirm("Rebuild the index?", False):
447
+ PrettyOutput.print("Cancel rebuilding the index", output_type=OutputType.INFO)
448
+ return
456
449
 
457
450
  # Clean deleted files
458
451
  for file_path in files_to_delete:
@@ -718,7 +711,7 @@ Please output 3 expressions directly, separated by two line breaks, without numb
718
711
  message = "Found related files:\n"
719
712
  for path, score, _ in initial_results:
720
713
  message += f"File: {path} Similarity: {score:.3f}\n"
721
- PrettyOutput.print(message.rstrip(), output_type=OutputType.INFO)
714
+ PrettyOutput.print(message.rstrip(), output_type=OutputType.INFO, lang="markdown")
722
715
 
723
716
  # Reorder the preliminary results
724
717
  return self.pick_results(query, [path for path, _, _ in initial_results])
@@ -737,7 +730,7 @@ Please output 3 expressions directly, separated by two line breaks, without numb
737
730
  message = "Found related files:\n"
738
731
  for path in results:
739
732
  message += f"File: {path}\n"
740
- PrettyOutput.print(message.rstrip(), output_type=OutputType.SUCCESS)
733
+ PrettyOutput.print(message.rstrip(), output_type=OutputType.SUCCESS, lang="markdown")
741
734
 
742
735
  prompt = f"""You are a code expert, please answer the user's question based on the following file information:
743
736
  """
@@ -862,8 +855,8 @@ def main():
862
855
 
863
856
  output = "Search Results:\n"
864
857
  for path in results:
865
- output += f"""{path}\n"""
866
- PrettyOutput.print(output, output_type=OutputType.INFO)
858
+ output += f"""- {path}\n"""
859
+ PrettyOutput.print(output, output_type=OutputType.INFO, lang="markdown")
867
860
 
868
861
  elif args.command == 'ask':
869
862
  response = codebase.ask_codebase(args.question, args.top_k)
@@ -29,7 +29,7 @@ def list_platforms():
29
29
  output += f" • {model_name} - {description}\n"
30
30
  else:
31
31
  output += f" • {model_name}\n"
32
- PrettyOutput.print(output, OutputType.SUCCESS)
32
+ PrettyOutput.print(output, OutputType.SUCCESS, lang="markdown")
33
33
  else:
34
34
  PrettyOutput.print(" • No available model information", OutputType.WARNING)
35
35
 
@@ -699,7 +699,7 @@ Content: {doc.content}
699
699
  output = f"""File: {doc.metadata['file_path']}\n"""
700
700
  output += f"""Fragment {doc.metadata['chunk_index'] + 1}/{doc.metadata['total_chunks']}\n"""
701
701
  output += f"""Content:\n{doc.content}\n"""
702
- PrettyOutput.print(output, output_type=OutputType.INFO)
702
+ PrettyOutput.print(output, output_type=OutputType.INFO, lang="markdown")
703
703
 
704
704
  # Build base prompt
705
705
  base_prompt = f"""Please answer the user's question based on the following document fragments. If the document content is not sufficient to answer the question completely, please clearly indicate.
@@ -792,7 +792,7 @@ def main():
792
792
  output = f"""File: {doc.metadata['file_path']}\n"""
793
793
  output += f"""Fragment {doc.metadata['chunk_index'] + 1}/{doc.metadata['total_chunks']}\n"""
794
794
  output += f"""Content:\n{doc.content}\n"""
795
- PrettyOutput.print(output, output_type=OutputType.INFO)
795
+ PrettyOutput.print(output, output_type=OutputType.INFO, lang="markdown")
796
796
  return 0
797
797
 
798
798
  if args.ask:
@@ -87,13 +87,10 @@ def main():
87
87
  })
88
88
 
89
89
  if result["success"]:
90
- print(result["stdout"])
90
+ PrettyOutput.print(result["stdout"], OutputType.INFO, lang="markdown")
91
91
  else:
92
92
  PrettyOutput.print(result["stderr"], OutputType.ERROR)
93
- return 1
94
93
 
95
- return 0
96
-
97
94
 
98
95
  if __name__ == "__main__":
99
96
  main()