jarvis-ai-assistant 0.1.97__py3-none-any.whl → 0.1.98__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jarvis-ai-assistant might be problematic. Click here for more details.
- jarvis/__init__.py +1 -1
- jarvis/jarvis_coder/git_utils.py +18 -18
- jarvis/jarvis_coder/main.py +150 -150
- jarvis/jarvis_coder/patch_handler.py +38 -38
- jarvis/jarvis_coder/plan_generator.py +21 -21
- jarvis/jarvis_platform/main.py +38 -38
- jarvis/jarvis_rag/main.py +181 -181
- jarvis/jarvis_smart_shell/main.py +19 -19
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/METADATA +1 -1
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/RECORD +14 -14
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/WHEEL +0 -0
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.97.dist-info → jarvis_ai_assistant-0.1.98.dist-info}/top_level.txt +0 -0
jarvis/__init__.py
CHANGED
jarvis/jarvis_coder/git_utils.py
CHANGED
|
@@ -6,31 +6,31 @@ from jarvis.utils import OutputType, PrettyOutput, while_success
|
|
|
6
6
|
from jarvis.models.registry import PlatformRegistry
|
|
7
7
|
|
|
8
8
|
def has_uncommitted_files() -> bool:
|
|
9
|
-
"""
|
|
10
|
-
#
|
|
9
|
+
"""Check if there are uncommitted files in the repository"""
|
|
10
|
+
# Get unstaged modifications
|
|
11
11
|
unstaged = os.popen("git diff --name-only").read()
|
|
12
|
-
#
|
|
12
|
+
# Get staged but uncommitted modifications
|
|
13
13
|
staged = os.popen("git diff --cached --name-only").read()
|
|
14
|
-
#
|
|
14
|
+
# Get untracked files
|
|
15
15
|
untracked = os.popen("git ls-files --others --exclude-standard").read()
|
|
16
16
|
|
|
17
17
|
return bool(unstaged or staged or untracked)
|
|
18
18
|
|
|
19
19
|
def generate_commit_message(git_diff: str) -> str:
|
|
20
|
-
"""
|
|
21
|
-
prompt = f"""
|
|
20
|
+
"""Generate commit message based on git diff and feature description"""
|
|
21
|
+
prompt = f"""You are an experienced programmer, please generate a concise and clear commit message based on the following code changes and feature description:
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Code changes:
|
|
24
24
|
Git Diff:
|
|
25
25
|
{git_diff}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
1.
|
|
29
|
-
2.
|
|
30
|
-
3.
|
|
31
|
-
4.
|
|
32
|
-
5.
|
|
33
|
-
6.
|
|
27
|
+
Please follow these rules:
|
|
28
|
+
1. Write in English
|
|
29
|
+
2. Use conventional commit message format: <type>(<scope>): <subject>
|
|
30
|
+
3. Keep it concise, no more than 50 characters
|
|
31
|
+
4. Accurately describe the main content of code changes
|
|
32
|
+
5. Prioritize feature description and changes in git diff
|
|
33
|
+
6. Only generate the commit message text, do not output anything else
|
|
34
34
|
"""
|
|
35
35
|
|
|
36
36
|
model = PlatformRegistry().get_global_platform_registry().get_normal_platform()
|
|
@@ -39,15 +39,15 @@ Git Diff:
|
|
|
39
39
|
return ';'.join(response.strip().split("\n"))
|
|
40
40
|
|
|
41
41
|
def save_edit_record(record_dir: str, commit_message: str, git_diff: str) -> None:
|
|
42
|
-
"""
|
|
43
|
-
#
|
|
42
|
+
"""Save code modification record"""
|
|
43
|
+
# Get next sequence number
|
|
44
44
|
existing_records = [f for f in os.listdir(record_dir) if f.endswith('.yaml')]
|
|
45
45
|
next_num = 1
|
|
46
46
|
if existing_records:
|
|
47
47
|
last_num = max(int(f[:4]) for f in existing_records)
|
|
48
48
|
next_num = last_num + 1
|
|
49
49
|
|
|
50
|
-
#
|
|
50
|
+
# Create record file
|
|
51
51
|
record = {
|
|
52
52
|
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S"),
|
|
53
53
|
"commit_message": commit_message,
|
|
@@ -58,4 +58,4 @@ def save_edit_record(record_dir: str, commit_message: str, git_diff: str) -> Non
|
|
|
58
58
|
with open(record_path, "w", encoding="utf-8") as f:
|
|
59
59
|
yaml.safe_dump(record, f, allow_unicode=True)
|
|
60
60
|
|
|
61
|
-
PrettyOutput.print(f"
|
|
61
|
+
PrettyOutput.print(f"Modification record saved: {record_path}", OutputType.SUCCESS)
|