auto-coder 0.1.331__py3-none-any.whl → 0.1.333__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.
- {auto_coder-0.1.331.dist-info → auto_coder-0.1.333.dist-info}/METADATA +1 -1
- {auto_coder-0.1.331.dist-info → auto_coder-0.1.333.dist-info}/RECORD +28 -26
- autocoder/agent/agentic_filter.py +929 -0
- autocoder/auto_coder.py +5 -23
- autocoder/auto_coder_runner.py +2 -0
- autocoder/commands/auto_command.py +1 -1
- autocoder/commands/tools.py +68 -3
- autocoder/common/__init__.py +2 -0
- autocoder/common/auto_coder_lang.py +9 -1
- autocoder/common/code_modification_ranker.py +6 -2
- autocoder/common/conf_utils.py +36 -0
- autocoder/common/stream_out_type.py +4 -2
- autocoder/common/types.py +2 -2
- autocoder/common/v2/code_auto_merge_editblock.py +1 -1
- autocoder/common/v2/code_diff_manager.py +73 -6
- autocoder/common/v2/code_editblock_manager.py +480 -163
- autocoder/compilers/provided_compiler.py +39 -0
- autocoder/helper/project_creator.py +282 -100
- autocoder/index/entry.py +35 -10
- autocoder/linters/reactjs_linter.py +55 -61
- autocoder/linters/shadow_linter.py +4 -0
- autocoder/shadows/shadow_manager.py +1 -1
- autocoder/utils/project_structure.py +2 -2
- autocoder/version.py +1 -1
- {auto_coder-0.1.331.dist-info → auto_coder-0.1.333.dist-info}/LICENSE +0 -0
- {auto_coder-0.1.331.dist-info → auto_coder-0.1.333.dist-info}/WHEEL +0 -0
- {auto_coder-0.1.331.dist-info → auto_coder-0.1.333.dist-info}/entry_points.txt +0 -0
- {auto_coder-0.1.331.dist-info → auto_coder-0.1.333.dist-info}/top_level.txt +0 -0
|
@@ -207,22 +207,59 @@ class ReactJSLinter(BaseLinter):
|
|
|
207
207
|
Returns:
|
|
208
208
|
str: The extracted JSON string, or the original text if no separator is found.
|
|
209
209
|
"""
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if
|
|
220
|
-
|
|
210
|
+
return output_text.split("=============")[-1]
|
|
211
|
+
|
|
212
|
+
def _convert_raw_lint_result_to_dict(self, raw_result: str,result: Dict[str, Any], project_path: str):
|
|
213
|
+
try:
|
|
214
|
+
output_text = raw_result
|
|
215
|
+
eslint_output = []
|
|
216
|
+
try:
|
|
217
|
+
eslint_output = json.loads(output_text)
|
|
218
|
+
except json.JSONDecodeError:
|
|
219
|
+
# Try to extract JSON from output if it contains separator
|
|
220
|
+
json_text = self._extract_json_from_output(output_text)
|
|
221
|
+
try:
|
|
222
|
+
eslint_output = json.loads(json_text)
|
|
223
|
+
except json.JSONDecodeError:
|
|
224
|
+
print(json_text[0:100],"...",json_text[-100:])
|
|
221
225
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
+
# print(f"eslint_output: {json.dumps(eslint_output, indent=4,ensure_ascii=False)}")
|
|
227
|
+
|
|
228
|
+
# Count files analyzed (should be 1)
|
|
229
|
+
result['files_analyzed'] = len(eslint_output)
|
|
230
|
+
|
|
231
|
+
# Track overall counts
|
|
232
|
+
total_errors = 0
|
|
233
|
+
total_warnings = 0
|
|
234
|
+
|
|
235
|
+
# Process the file result
|
|
236
|
+
for file_result in eslint_output:
|
|
237
|
+
file_rel_path = os.path.relpath(
|
|
238
|
+
file_result['filePath'], project_path)
|
|
239
|
+
|
|
240
|
+
# Add error and warning counts
|
|
241
|
+
total_errors += file_result.get('errorCount', 0)
|
|
242
|
+
total_warnings += file_result.get('warningCount', 0)
|
|
243
|
+
|
|
244
|
+
# Process individual messages
|
|
245
|
+
for message in file_result.get('messages', []):
|
|
246
|
+
issue = {
|
|
247
|
+
'file': file_rel_path,
|
|
248
|
+
'line': message.get('line', 0),
|
|
249
|
+
'column': message.get('column', 0),
|
|
250
|
+
'severity': 'error' if message.get('severity', 1) == 2 else 'warning',
|
|
251
|
+
'message': message.get('message', ''),
|
|
252
|
+
'rule': message.get('ruleId', 'unknown')
|
|
253
|
+
}
|
|
254
|
+
result['issues'].append(issue)
|
|
255
|
+
|
|
256
|
+
result['error_count'] = total_errors
|
|
257
|
+
result['warning_count'] = total_warnings
|
|
258
|
+
result['success'] = True
|
|
259
|
+
except json.JSONDecodeError:
|
|
260
|
+
# Handle case where ESLint output is not valid JSON
|
|
261
|
+
result['error'] = "Failed to parse ESLint output"
|
|
262
|
+
|
|
226
263
|
|
|
227
264
|
def lint_file(self, file_path: str, fix: bool = False, project_path: str = None) -> Dict[str, Any]:
|
|
228
265
|
"""
|
|
@@ -296,51 +333,7 @@ class ReactJSLinter(BaseLinter):
|
|
|
296
333
|
|
|
297
334
|
# Parse ESLint output
|
|
298
335
|
if process.stdout:
|
|
299
|
-
|
|
300
|
-
output_text = process.stdout
|
|
301
|
-
try:
|
|
302
|
-
eslint_output = json.loads(output_text)
|
|
303
|
-
except json.JSONDecodeError:
|
|
304
|
-
# Try to extract JSON from output if it contains separator
|
|
305
|
-
json_text = self._extract_json_from_output(output_text)
|
|
306
|
-
eslint_output = json.loads(json_text)
|
|
307
|
-
|
|
308
|
-
# print(f"eslint_output: {json.dumps(eslint_output, indent=4,ensure_ascii=False)}")
|
|
309
|
-
|
|
310
|
-
# Count files analyzed (should be 1)
|
|
311
|
-
result['files_analyzed'] = len(eslint_output)
|
|
312
|
-
|
|
313
|
-
# Track overall counts
|
|
314
|
-
total_errors = 0
|
|
315
|
-
total_warnings = 0
|
|
316
|
-
|
|
317
|
-
# Process the file result
|
|
318
|
-
for file_result in eslint_output:
|
|
319
|
-
file_rel_path = os.path.relpath(
|
|
320
|
-
file_result['filePath'], project_path)
|
|
321
|
-
|
|
322
|
-
# Add error and warning counts
|
|
323
|
-
total_errors += file_result.get('errorCount', 0)
|
|
324
|
-
total_warnings += file_result.get('warningCount', 0)
|
|
325
|
-
|
|
326
|
-
# Process individual messages
|
|
327
|
-
for message in file_result.get('messages', []):
|
|
328
|
-
issue = {
|
|
329
|
-
'file': file_rel_path,
|
|
330
|
-
'line': message.get('line', 0),
|
|
331
|
-
'column': message.get('column', 0),
|
|
332
|
-
'severity': 'error' if message.get('severity', 1) == 2 else 'warning',
|
|
333
|
-
'message': message.get('message', ''),
|
|
334
|
-
'rule': message.get('ruleId', 'unknown')
|
|
335
|
-
}
|
|
336
|
-
result['issues'].append(issue)
|
|
337
|
-
|
|
338
|
-
result['error_count'] = total_errors
|
|
339
|
-
result['warning_count'] = total_warnings
|
|
340
|
-
result['success'] = True
|
|
341
|
-
except json.JSONDecodeError:
|
|
342
|
-
# Handle case where ESLint output is not valid JSON
|
|
343
|
-
result['error'] = "Failed to parse ESLint output"
|
|
336
|
+
self._convert_raw_lint_result_to_dict(process.stdout, result, project_path)
|
|
344
337
|
else:
|
|
345
338
|
# Handle case where ESLint didn't produce any output
|
|
346
339
|
stderr = process.stderr.strip()
|
|
@@ -577,4 +570,5 @@ def format_lint_result(lint_result: Dict[str, Any]) -> str:
|
|
|
577
570
|
str: A formatted string representation of the lint results.
|
|
578
571
|
"""
|
|
579
572
|
linter = ReactJSLinter()
|
|
580
|
-
return linter.format_lint_result(lint_result)
|
|
573
|
+
return linter.format_lint_result(lint_result)
|
|
574
|
+
|
|
@@ -16,6 +16,7 @@ from autocoder.linters.models import (
|
|
|
16
16
|
IssuePosition,
|
|
17
17
|
IssueSeverity
|
|
18
18
|
)
|
|
19
|
+
from loguru import logger as global_logger
|
|
19
20
|
|
|
20
21
|
class ShadowLinter:
|
|
21
22
|
"""
|
|
@@ -32,6 +33,7 @@ class ShadowLinter:
|
|
|
32
33
|
"""
|
|
33
34
|
self.shadow_manager = shadow_manager
|
|
34
35
|
self.verbose = verbose
|
|
36
|
+
self.logger = global_logger.bind(name="ShadowLinter")
|
|
35
37
|
|
|
36
38
|
def lint_shadow_file(self, shadow_path: str, fix: bool = False) -> FileLintResult:
|
|
37
39
|
"""
|
|
@@ -117,8 +119,10 @@ class ShadowLinter:
|
|
|
117
119
|
|
|
118
120
|
# 处理每个影子文件
|
|
119
121
|
for shadow_path in shadow_files:
|
|
122
|
+
self.logger.info(f"正在检查文件: {shadow_path}")
|
|
120
123
|
try:
|
|
121
124
|
file_result = self.lint_shadow_file(shadow_path, fix=fix)
|
|
125
|
+
self.logger.info(f"检查完成: {shadow_path}")
|
|
122
126
|
# lint_shadow_file现在总是返回有效的FileLintResult,不再需要检查None
|
|
123
127
|
project_path = self.shadow_manager.from_shadow_path(shadow_path)
|
|
124
128
|
|
|
@@ -285,7 +285,7 @@ class ShadowManager:
|
|
|
285
285
|
# 删除链接项目目录中的所有内容
|
|
286
286
|
for item in os.listdir(self.link_projects_dir):
|
|
287
287
|
item_path = os.path.join(self.link_projects_dir, item)
|
|
288
|
-
if os.path.isfile(item_path):
|
|
288
|
+
if os.path.isfile(item_path) or os.path.islink(item_path):
|
|
289
289
|
os.unlink(item_path)
|
|
290
290
|
elif os.path.isdir(item_path):
|
|
291
291
|
shutil.rmtree(item_path)
|
|
@@ -127,9 +127,9 @@ class EnhancedFileAnalyzer:
|
|
|
127
127
|
return self._basic_analysis(extensions)
|
|
128
128
|
|
|
129
129
|
def _collect_extensions(self) -> Set[str]:
|
|
130
|
-
"""
|
|
130
|
+
"""带过滤的文件后缀收集,支持软链接目录和文件"""
|
|
131
131
|
extensions = set()
|
|
132
|
-
for root, dirs, files in os.walk(self.directory):
|
|
132
|
+
for root, dirs, files in os.walk(self.directory, followlinks=True):
|
|
133
133
|
dirs[:] = [d for d in dirs if not self.file_filter.should_ignore(d, True)]
|
|
134
134
|
for file in files:
|
|
135
135
|
if self.file_filter.should_ignore(file, False):
|
autocoder/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.333"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|