mofox-plugin-dev-toolkit 0.2.7__tar.gz → 0.2.8__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.
- {mofox_plugin_dev_toolkit-0.2.7/mofox_plugin_dev_toolkit.egg-info → mofox_plugin_dev_toolkit-0.2.8}/PKG-INFO +1 -1
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8/mofox_plugin_dev_toolkit.egg-info}/PKG-INFO +1 -1
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/cli.py +2 -2
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/commands/check.py +75 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/component_validator.py +2 -2
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/metadata_validator.py +2 -1
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/pyproject.toml +1 -1
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/LICENSE +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/MANIFEST.in +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/README.md +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mofox_plugin_dev_toolkit.egg-info/SOURCES.txt +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mofox_plugin_dev_toolkit.egg-info/dependency_links.txt +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mofox_plugin_dev_toolkit.egg-info/entry_points.txt +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mofox_plugin_dev_toolkit.egg-info/requires.txt +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mofox_plugin_dev_toolkit.egg-info/top_level.txt +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/__init__.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/__main__.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/commands/__init__.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/commands/dev.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/commands/generate.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/commands/init.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/dev/bridge_plugin/__init__.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/dev/bridge_plugin/discovery_server.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/dev/bridge_plugin/plugin.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/__init__.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/action_template.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/adapter_template.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/chatter_template.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/event_template.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/plus_command_template.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/prompt_template.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/router_template.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/tool_template.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/__init__.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/code_parser.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/color_printer.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/config_loader.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/config_manager.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/file_ops.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/license_generator.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/plugin_parser.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/template_engine.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/__init__.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/auto_fix_validator.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/base.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/config_validator.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/structure_validator.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/style_validator.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/type_validator.py +0 -0
- {mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/setup.cfg +0 -0
|
@@ -102,8 +102,8 @@ def generate(ctx: click.Context, component_type: str | None, component_name: str
|
|
|
102
102
|
@click.option("--level", "-l", type=click.Choice(["error", "warning", "info"]), default="warning",
|
|
103
103
|
help="显示的最低级别")
|
|
104
104
|
@click.option("--fix", is_flag=True, help="自动修复可修复的问题")
|
|
105
|
-
@click.option("--report", type=click.Choice(["console","markdown"]), default="console",
|
|
106
|
-
help="
|
|
105
|
+
@click.option("--report", type=click.Choice(["console","markdown","json"]), default="console",
|
|
106
|
+
help="输出报告的格式")
|
|
107
107
|
@click.option("--output", "-o", type=click.Path(), help="报告输出路径")
|
|
108
108
|
@click.option("--no-structure", is_flag=True, help="跳过结构检查")
|
|
109
109
|
@click.option("--no-metadata", is_flag=True, help="跳过元数据检查")
|
|
@@ -300,6 +300,8 @@ def _save_report(results: list[ValidationResult], output_path: str, report_forma
|
|
|
300
300
|
"""
|
|
301
301
|
if report_format == "markdown":
|
|
302
302
|
_save_markdown_report(results, output_path, auto_fixer)
|
|
303
|
+
elif report_format == "json":
|
|
304
|
+
_save_json_report(results, output_path, auto_fixer)
|
|
303
305
|
else:
|
|
304
306
|
print_warning(f"不支持的报告格式: {report_format}")
|
|
305
307
|
|
|
@@ -392,3 +394,76 @@ def _save_markdown_report(results: list[ValidationResult], output_path: str, aut
|
|
|
392
394
|
print_success(f"报告已保存到: {output_path}")
|
|
393
395
|
except Exception as e:
|
|
394
396
|
print_error(f"保存报告失败: {e}")
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def _save_json_report(results: list[ValidationResult], output_path: str, auto_fixer: AutoFixValidator | None = None) -> None:
|
|
400
|
+
"""保存 JSON 格式的报告
|
|
401
|
+
|
|
402
|
+
Args:
|
|
403
|
+
results: 验证结果列表
|
|
404
|
+
output_path: 输出路径
|
|
405
|
+
auto_fixer: 自动修复器对象(如果启用了自动修复)
|
|
406
|
+
"""
|
|
407
|
+
import json
|
|
408
|
+
from datetime import datetime
|
|
409
|
+
|
|
410
|
+
# 统计总数
|
|
411
|
+
total_errors = sum(r.error_count for r in results)
|
|
412
|
+
total_warnings = sum(r.warning_count for r in results)
|
|
413
|
+
total_info = sum(r.info_count for r in results)
|
|
414
|
+
|
|
415
|
+
# 构建报告数据结构
|
|
416
|
+
report = {
|
|
417
|
+
"timestamp": datetime.now().isoformat(),
|
|
418
|
+
"summary": {
|
|
419
|
+
"total_errors": total_errors,
|
|
420
|
+
"total_warnings": total_warnings,
|
|
421
|
+
"total_info": total_info,
|
|
422
|
+
"success": total_errors == 0
|
|
423
|
+
},
|
|
424
|
+
"validators": [],
|
|
425
|
+
"issues": []
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
# 添加自动修复统计
|
|
429
|
+
if auto_fixer:
|
|
430
|
+
report["auto_fix"] = {
|
|
431
|
+
"enabled": True,
|
|
432
|
+
"fixes_applied": len(auto_fixer.fixes_applied),
|
|
433
|
+
"fixes_failed": len(auto_fixer.fixes_failed),
|
|
434
|
+
"applied_fixes": auto_fixer.fixes_applied,
|
|
435
|
+
"failed_fixes": auto_fixer.fixes_failed
|
|
436
|
+
}
|
|
437
|
+
else:
|
|
438
|
+
report["auto_fix"] = {"enabled": False}
|
|
439
|
+
|
|
440
|
+
# 添加每个验证器的结果
|
|
441
|
+
for result in results:
|
|
442
|
+
validator_data = {
|
|
443
|
+
"name": result.validator_name,
|
|
444
|
+
"success": result.success,
|
|
445
|
+
"error_count": result.error_count,
|
|
446
|
+
"warning_count": result.warning_count,
|
|
447
|
+
"info_count": result.info_count
|
|
448
|
+
}
|
|
449
|
+
report["validators"].append(validator_data)
|
|
450
|
+
|
|
451
|
+
# 添加问题详情
|
|
452
|
+
for issue in result.issues:
|
|
453
|
+
issue_data = {
|
|
454
|
+
"validator": result.validator_name,
|
|
455
|
+
"level": issue.level.value,
|
|
456
|
+
"message": issue.message,
|
|
457
|
+
"file_path": issue.file_path,
|
|
458
|
+
"line_number": issue.line_number,
|
|
459
|
+
"suggestion": issue.suggestion
|
|
460
|
+
}
|
|
461
|
+
report["issues"].append(issue_data)
|
|
462
|
+
|
|
463
|
+
# 写入文件
|
|
464
|
+
try:
|
|
465
|
+
with open(output_path, "w", encoding="utf-8") as f:
|
|
466
|
+
json.dump(report, f, ensure_ascii=False, indent=2)
|
|
467
|
+
print_success(f"报告已保存到: {output_path}")
|
|
468
|
+
except Exception as e:
|
|
469
|
+
print_error(f"保存报告失败: {e}")
|
|
@@ -444,7 +444,7 @@ class ComponentValidator(BaseValidator):
|
|
|
444
444
|
|
|
445
445
|
if not required_fields:
|
|
446
446
|
# 未知的组件类型
|
|
447
|
-
self.result.
|
|
447
|
+
self.result.add_error(
|
|
448
448
|
f"组件 {class_name} 的基类 {base_class} 不在已知类型列表中",
|
|
449
449
|
file_path=str(component_file.relative_to(self.plugin_path)),
|
|
450
450
|
)
|
|
@@ -758,7 +758,7 @@ class ComponentValidator(BaseValidator):
|
|
|
758
758
|
suggestion=f"建议修改返回类型注解为: -> {expected_return}",
|
|
759
759
|
)
|
|
760
760
|
elif expected_return and not method_node.returns:
|
|
761
|
-
self.result.
|
|
761
|
+
self.result.add_warning(
|
|
762
762
|
f"组件 {class_name} 的方法 {method_name} 缺少返回类型注解,建议添加: -> {expected_return}",
|
|
763
763
|
file_path=str(component_file.relative_to(self.plugin_path)),
|
|
764
764
|
)
|
|
@@ -101,10 +101,11 @@ class MetadataValidator(BaseValidator):
|
|
|
101
101
|
missing_recommended.append(field)
|
|
102
102
|
|
|
103
103
|
if missing_recommended:
|
|
104
|
+
fields_str = ', '.join(f'{f}="..."' for f in missing_recommended)
|
|
104
105
|
self.result.add_warning(
|
|
105
106
|
f"建议添加以下元数据字段: {', '.join(missing_recommended)}",
|
|
106
107
|
file_path="__init__.py",
|
|
107
|
-
suggestion=f"在 PluginMetadata 中添加: {
|
|
108
|
+
suggestion=f"在 PluginMetadata 中添加: {fields_str}",
|
|
108
109
|
)
|
|
109
110
|
|
|
110
111
|
return self.result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/dev/bridge_plugin/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/dev/bridge_plugin/plugin.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/__init__.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/action_template.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/adapter_template.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/chatter_template.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/event_template.py
RENAMED
|
File without changes
|
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/prompt_template.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/router_template.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/templates/tool_template.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/color_printer.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/config_loader.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/config_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/license_generator.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/plugin_parser.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/utils/template_engine.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/style_validator.py
RENAMED
|
File without changes
|
{mofox_plugin_dev_toolkit-0.2.7 → mofox_plugin_dev_toolkit-0.2.8}/mpdt/validators/type_validator.py
RENAMED
|
File without changes
|
|
File without changes
|