docs: 补充完整测试和文档

- 添加 README.md(功能说明、快速开始、API 文档)
- 修复冲突检测字段提取正则表达式
- 添加集成测试 tests/integration/test_full_flow.py

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 4.7 committed 2026-05-11 22:45:57 +08:00
1 parent 220f6db288
commit 0e37c30ae8
3 files changed
+383 -2

No files matched your search

+6 -2
View File
@@ -58,12 +58,16 @@ class ConflictDetector:
def _conditions_may_overlap(self, code_a: str, code_b: str) -> bool:
"""检查两条规则的条件可能重叠。"""
import re
# 提取 facts.get() 调用的字段
pattern = r'facts\.get\(["\']([^"\']+)["\']\)'
# 提取 .get() 调用的字段(支持 f.get 和 facts.get)
pattern = r'\.\s*get\s*\(["\']([^"\']+)["\']\)'
fields_a = set(re.findall(pattern, code_a))
fields_b = set(re.findall(pattern, code_b))
# 如果没有字段信息,假设可能重叠
if not fields_a and not fields_b:
return True
# 如果任一规则没有字段,假设可能重叠
if not fields_a or not fields_b:
return True