ci: 添加 GitHub Actions CI + 93 个测试

CI 工作流 (.github/workflows/ci.yml):
- lint: 语法检查 + ruff 代码检查
- test: 插件功能测试 (Python 3.10/3.11/3.12 矩阵)
- structure: 项目结构完整性 + 旧文件清理检查

测试覆盖 (tests/test_plugins.py, 93 个用例):
- 插件加载: 13个插件 × 4项检查 (导入/类名/方法/tool_info)
- code_editor: 9 个功能测试 (edit/read_range/find/ast/stats/diff...)
- git_tools: 3 个测试 (status/log/branch)
- cmd_executor: 5 个测试 (echo/python/拦截/超时/空命令)
- file_manager: 7 个测试 (list/read/write/copy/delete/mkdir/info)
- auto_engineer: 4 个测试 (metrics/security/complexity)
- task_manager: 6 个测试 (add/list/complete/delete/clear)
- 引擎: 4 个测试 (加载/旧文件清理)
- 核心模块: 3 个导入测试

修复: code_editor diff_text 解析器被 split 拆坏的问题
This commit is contained in:
xiaoli-cli committed 2026-04-26 05:40:09 +08:00
1 parent 9aae8b2ca2
commit d57517197f
4 files changed
+562 -10

No files matched your search

+20 -10
View File
@@ -88,13 +88,25 @@ class Plugin:
def handle(self, args: str) -> str:
try:
parts = args.strip().split(maxsplit=2)
if not parts:
return "错误:请提供操作类型"
# 先提取操作名
first_space = args.strip().find(' ')
if first_space == -1:
operation = args.strip().lower()
arg1, arg2 = "", ""
else:
operation = args.strip()[:first_space].lower()
rest = args.strip()[first_space + 1:]
operation = parts[0].lower()
arg1 = parts[1] if len(parts) > 1 else ""
arg2 = parts[2] if len(parts) > 2 else ""
# diff_text 特殊处理:用 <<<>>> 分割
if operation == "diff_text" and " <<<>>> " in rest:
arg1, arg2 = rest.split(" <<<>>> ", 1)
else:
parts = rest.split(maxsplit=1)
arg1 = parts[0] if parts else ""
arg2 = parts[1] if len(parts) > 1 else ""
if not operation:
return "错误:请提供操作类型"
handlers = {
# 编辑
@@ -384,11 +396,9 @@ class Plugin:
diff = '\n'.join(difflib.unified_diff(l1, l2, fromfile=f1, tofile=f2, lineterm=''))
return diff or "两个文件完全相同"
def _op_diff_text(self, path: str, rest: str) -> str:
sep = " <<<>>> "
if sep not in rest:
def _op_diff_text(self, old: str, new: str) -> str:
if not old and not new:
return "错误:格式: diff_text <old> <<<>>> <new>"
old, new = rest.split(sep, 1)
return self._make_diff(old.strip(), new.strip())
def _op_ast_info(self, path: str, rest: str) -> str: