auto-coder 0.1.314__py3-none-any.whl → 0.1.316__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 auto-coder might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.314
3
+ Version: 0.1.316
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -14,7 +14,7 @@ autocoder/command_parser.py,sha256=fx1g9E6GaM273lGTcJqaFQ-hoksS_Ik2glBMnVltPCE,1
14
14
  autocoder/lang.py,sha256=U6AjVV8Rs1uLyjFCZ8sT6WWuNUxMBqkXXIOs4S120uk,14511
15
15
  autocoder/models.py,sha256=AyoZ-Pzy0oyYUmWCxOIRiOImsqboSfRET7LO9-UOuxI,11172
16
16
  autocoder/run_context.py,sha256=IUfSO6_gp2Wt1blFWAmOpN0b0nDrTTk4LmtCYUBIoro,1643
17
- autocoder/version.py,sha256=3yIHnraaaFbxc1ee0sSnlxa-rcJVCIL77-IR6a-luno,23
17
+ autocoder/version.py,sha256=_LOQhVW4b9WlpFZvJsLKm3nuje6D26KFvC5q5q8Gdec,23
18
18
  autocoder/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  autocoder/agent/auto_demand_organizer.py,sha256=URAq0gSEiHeV_W4zwhOI_83kHz0Ryfj1gcfh5jwCv_w,6501
20
20
  autocoder/agent/auto_filegroup.py,sha256=pBsAkBcpFTff-9L5OwI8xhf2xPKpl-aZwz-skF2B6dc,6296
@@ -30,7 +30,7 @@ autocoder/chat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  autocoder/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  autocoder/commands/auto_command.py,sha256=fZ4TNU4YA9qdoVHmZX0rb6sV_N-DEcgSLaC5s3PGSHA,64200
32
32
  autocoder/commands/auto_web.py,sha256=Cc0eb6JN3SvFy3GD_lpSLvIqj7F1eFDTcwg1t-zDcKg,39024
33
- autocoder/commands/tools.py,sha256=nLXzcmwwOaMjgTUjad4usq1W0VH79jard1irxsNrRLk,31576
33
+ autocoder/commands/tools.py,sha256=SlMhPICWjDsloi05CfDMawCtJmbffOCjUNj_-ve-w40,31836
34
34
  autocoder/common/JupyterClient.py,sha256=O-wi6pXeAEYhAY24kDa0BINrLYvKS6rKyWe98pDClS0,2816
35
35
  autocoder/common/ShellClient.py,sha256=fM1q8t_XMSbLBl2zkCNC2J9xuyKN3eXzGm6hHhqL2WY,2286
36
36
  autocoder/common/__init__.py,sha256=sIbE0Gm30MkCmZ9ClQeKx1Hw-vjdcVF65hO5TschS1Y,14070
@@ -118,6 +118,11 @@ autocoder/index/types.py,sha256=a2s_KV5FJlq7jqA2ELSo9E1sjuLwDB-JJYMhSpzBAhU,596
118
118
  autocoder/index/filter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
119
  autocoder/index/filter/normal_filter.py,sha256=MI-8xdXCrniaxYCHVTLkq5tafvcUiauD3LN0b3ymRXI,8361
120
120
  autocoder/index/filter/quick_filter.py,sha256=ozESEgy506FQ5ecjOumyo4D_KMrterB1QLmnVtiyOiM,43264
121
+ autocoder/linters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
+ autocoder/linters/base_linter.py,sha256=1_0DPESnSyF3ZcQhoFkBYJylT5w-B61Rx-3A9uhuPlg,3066
123
+ autocoder/linters/code_linter.py,sha256=JylTj-Mj4jl9-XSH3PVlbQ4l55Y6E1FG-glv860CGSs,22462
124
+ autocoder/linters/linter_factory.py,sha256=JKX0D_E-mSK1aeltc0jyW9iRomk4b07VnvnhpoMy6sk,9633
125
+ autocoder/linters/python_linter.py,sha256=MYUkJxt2lUfb9Awpgut2kz95uP-Z-0jToLN4Bn46f48,22691
121
126
  autocoder/memory/__init__.py,sha256=5FeGvsesRViYL4BkFiHw9SdlyHeWlqALpTyqOpfnBRw,179
122
127
  autocoder/memory/active_context_manager.py,sha256=zeBOhOrlSeUU2-qaJPDCEGryJ5IorTrdsDoRJ3FHOac,33238
123
128
  autocoder/memory/active_package.py,sha256=ccTs5BTrbno0Ji2YHdNfA4j1JbBTuTCvpW5bLl5xfiY,25336
@@ -200,9 +205,9 @@ autocoder/utils/types.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
200
205
  autocoder/utils/auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
201
206
  autocoder/utils/auto_coder_utils/chat_stream_out.py,sha256=xuBeWD0YOckqRo8JB1WkVIMOYH6c24m7JfV4svBfPDo,15113
202
207
  autocoder/utils/chat_auto_coder_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
203
- auto_coder-0.1.314.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
204
- auto_coder-0.1.314.dist-info/METADATA,sha256=KGZprKesugkm-twukCjWW0mPgguDEGLquKtnr1iaK3s,2747
205
- auto_coder-0.1.314.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
206
- auto_coder-0.1.314.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
207
- auto_coder-0.1.314.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
208
- auto_coder-0.1.314.dist-info/RECORD,,
208
+ auto_coder-0.1.316.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
209
+ auto_coder-0.1.316.dist-info/METADATA,sha256=hgK7lCK6JmHXcZ3nllBgaAG-nC-j-Y8fNh52fEAOBjo,2747
210
+ auto_coder-0.1.316.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
211
+ auto_coder-0.1.316.dist-info/entry_points.txt,sha256=0nzHtHH4pNcM7xq4EBA2toS28Qelrvcbrr59GqD_0Ak,350
212
+ auto_coder-0.1.316.dist-info/top_level.txt,sha256=Jqc0_uJSw2GwoFQAa9iJxYns-2mWla-9ok_Y3Gcznjk,10
213
+ auto_coder-0.1.316.dist-info/RECORD,,
@@ -164,7 +164,7 @@ class AutoCommandTools:
164
164
  # 如果是在web模式下,则使用event_manager事件来询问用户
165
165
  if get_run_context().is_web():
166
166
  try:
167
- answer = get_event_manager(
167
+ get_event_manager(
168
168
  self.args.event_file).write_result(
169
169
  EventContentCreator.create_result(
170
170
  EventContentCreator.ResultSummaryContent(
@@ -178,15 +178,15 @@ class AutoCommandTools:
178
178
  "response": response
179
179
  }
180
180
  })
181
- except Exception as e:
182
- error_message = f"Error: {str(e)}\n\n完整异常堆栈信息:\n{traceback.format_exc()}"
181
+ except Exception as e:
182
+ error_message = f"Error: {str(e)}\n\n完整异常堆栈信息:\n{traceback.format_exc()}"
183
183
  self.result_manager.append(content=f"Error: {error_message}", meta={
184
184
  "action": "response_user",
185
185
  "input": {
186
186
  "response": response
187
187
  }
188
188
  })
189
- return answer
189
+ return response
190
190
 
191
191
  console = Console()
192
192
  answer_text = Text(response, style="italic")
@@ -331,9 +331,19 @@ class AutoCommandTools:
331
331
  注意,这个工具无法返回所有文件的信息,因为有些文件可能没有被索引。
332
332
  尽量避免使用该工具。
333
333
  """
334
- index_manager = self._get_index()
335
- s = index_manager.read_index_as_str()
336
- index_data = json.loads(s)
334
+ try:
335
+ index_manager = self._get_index()
336
+ s = index_manager.read_index_as_str()
337
+ index_data = json.loads(s)
338
+ except Exception as e:
339
+ v = f"Error: {str(e)}\n\n完整异常堆栈信息:\n{traceback.format_exc()}"
340
+ self.result_manager.add_result(content=v, meta={
341
+ "action": "get_project_map",
342
+ "input": {
343
+ "file_paths": file_paths
344
+ }
345
+ })
346
+ return v
337
347
 
338
348
  final_result = []
339
349
 
@@ -778,21 +788,21 @@ class AutoCommandTools:
778
788
  def lint_code(self, path: str, language: Optional[str] = None, fix: bool = False, verbose: bool = False) -> str:
779
789
  """
780
790
  对代码进行质量检查,支持多种编程语言。
781
-
791
+
782
792
  参数说明:
783
793
  path (str): 要检查的文件路径或项目目录
784
794
  language (str, optional): 明确指定语言类型,如'python', 'javascript', 'typescript', 'react', 'vue'等
785
795
  如果不指定,将尝试根据文件扩展名或项目结构自动检测
786
796
  fix (bool): 是否自动修复可修复的问题,默认为False
787
797
  verbose (bool): 是否显示详细输出,默认为False
788
-
798
+
789
799
  返回值:
790
800
  格式化后的lint结果,包含错误和警告信息
791
-
801
+
792
802
  支持的语言:
793
803
  - 前端: JavaScript, TypeScript, React, Vue (使用ESLint)
794
804
  - Python: 使用pylint, flake8, black
795
-
805
+
796
806
  说明:
797
807
  - 对于前端代码,需要Node.js环境
798
808
  - 对于Python代码,需要pylint/flake8/black
@@ -804,18 +814,19 @@ class AutoCommandTools:
804
814
  try:
805
815
  # 检查是否是目录或文件
806
816
  is_directory = os.path.isdir(path)
807
-
817
+
808
818
  # 根据路径类型执行相应的lint操作
809
819
  if is_directory:
810
820
  # 对整个项目进行lint
811
- result = lint_project(path, language=language, fix=fix, verbose=verbose)
821
+ result = lint_project(
822
+ path, language=language, fix=fix, verbose=verbose)
812
823
  else:
813
824
  # 对单个文件进行lint
814
825
  result = lint_file(path, fix=fix, verbose=verbose)
815
-
826
+
816
827
  # 格式化结果
817
828
  formatted_result = format_lint_result(result, language=language)
818
-
829
+
819
830
  # 记录操作结果
820
831
  self.result_manager.add_result(content=formatted_result, meta={
821
832
  "action": "lint_code",
@@ -827,12 +838,12 @@ class AutoCommandTools:
827
838
  },
828
839
  "result": result
829
840
  })
830
-
841
+
831
842
  return formatted_result
832
-
843
+
833
844
  except Exception as e:
834
845
  error_message = f"Linting failed: {str(e)}\n\n完整异常堆栈信息:\n{traceback.format_exc()}"
835
-
846
+
836
847
  self.result_manager.add_result(content=error_message, meta={
837
848
  "action": "lint_code",
838
849
  "input": {
@@ -843,5 +854,5 @@ class AutoCommandTools:
843
854
  },
844
855
  "error": error_message
845
856
  })
846
-
857
+
847
858
  return error_message
File without changes
@@ -0,0 +1,108 @@
1
+ """
2
+ Module for code linting capabilities across multiple programming languages.
3
+ This module provides a base abstract class for various language-specific linters.
4
+ """
5
+
6
+ import os
7
+ from abc import ABC, abstractmethod
8
+ from typing import Dict, Any, List, Optional
9
+
10
+ class BaseLinter(ABC):
11
+ """
12
+ Base abstract class for all language-specific linters.
13
+ """
14
+
15
+ def __init__(self, verbose: bool = False):
16
+ """
17
+ Initialize the base linter.
18
+
19
+ Args:
20
+ verbose (bool): Whether to display verbose output.
21
+ """
22
+ self.verbose = verbose
23
+
24
+ @abstractmethod
25
+ def _check_dependencies(self) -> bool:
26
+ """
27
+ Check if required dependencies are installed.
28
+
29
+ Returns:
30
+ bool: True if all dependencies are available, False otherwise.
31
+ """
32
+ pass
33
+
34
+ @abstractmethod
35
+ def lint_file(self, file_path: str, fix: bool = False) -> Dict[str, Any]:
36
+ """
37
+ Lint a single file.
38
+
39
+ Args:
40
+ file_path (str): Path to the file to lint.
41
+ fix (bool): Whether to automatically fix fixable issues.
42
+
43
+ Returns:
44
+ Dict[str, Any]: Lint results.
45
+ """
46
+ pass
47
+
48
+ @abstractmethod
49
+ def lint_project(self, project_path: str, fix: bool = False) -> Dict[str, Any]:
50
+ """
51
+ Lint an entire project.
52
+
53
+ Args:
54
+ project_path (str): Path to the project directory.
55
+ fix (bool): Whether to automatically fix fixable issues.
56
+
57
+ Returns:
58
+ Dict[str, Any]: Lint results.
59
+ """
60
+ pass
61
+
62
+ @abstractmethod
63
+ def format_lint_result(self, lint_result: Dict[str, Any]) -> str:
64
+ """
65
+ Format lint results into a human-readable string.
66
+
67
+ Args:
68
+ lint_result (Dict[str, Any]): The lint result dictionary.
69
+
70
+ Returns:
71
+ str: A formatted string representation of the lint results.
72
+ """
73
+ pass
74
+
75
+ def get_file_extension(self, file_path: str) -> str:
76
+ """
77
+ Get the file extension from a file path.
78
+
79
+ Args:
80
+ file_path (str): Path to the file.
81
+
82
+ Returns:
83
+ str: The file extension (lowercase, with dot).
84
+ """
85
+ _, ext = os.path.splitext(file_path)
86
+ return ext.lower()
87
+
88
+ def is_supported_file(self, file_path: str) -> bool:
89
+ """
90
+ Check if a file is supported by this linter.
91
+
92
+ Args:
93
+ file_path (str): Path to the file.
94
+
95
+ Returns:
96
+ bool: True if the file is supported, False otherwise.
97
+ """
98
+ return self.get_file_extension(file_path) in self.get_supported_extensions()
99
+
100
+ @abstractmethod
101
+ def get_supported_extensions(self) -> List[str]:
102
+ """
103
+ Get the list of file extensions supported by this linter.
104
+
105
+ Returns:
106
+ List[str]: List of supported file extensions (lowercase, with dot).
107
+ """
108
+ pass