refactor: 缠论引擎包化与 Web 分层(ECR-001)

将根目录引擎迁入 chanlun/ 并保留兼容 shim;拆分 TF_DF 与 web 服务;
前端模块化;strategies 改用 chanlun 导入;补充 ESS 文档与 golden 回归。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-05 18:48:20 +08:00
co-authored by Cursor
parent e2e45bc1bc
commit 74dec4e50b
160 changed files with 25576 additions and 23104 deletions
+46
View File
@@ -0,0 +1,46 @@
"""Golden 回归:缠论流水线序列化结果应与基线一致。"""
from __future__ import annotations
import json
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_golden_pipeline():
r = subprocess.run(
[sys.executable, str(ROOT / "tests" / "generate_golden.py"), "--check"],
cwd=str(ROOT),
capture_output=True,
text=True,
)
assert r.returncode == 0, r.stdout + r.stderr
def test_package_imports():
from chanlun import ChanLun, TF_DF
from chanlun.core.ChanEnum import Chan_BI_DIR
assert ChanLun is not None and TF_DF is not None and Chan_BI_DIR is not None
def test_compat_shim_still_works():
"""根目录 shim 保留给外部旧脚本。"""
from ChanLun import ChanLun as C1
from TF_DF import TF_DF as T1
from ChanEnum import Chan_BI_DIR
from chanlun import ChanLun as C2, TF_DF as T2
assert C1 is C2 and T1 is T2 and Chan_BI_DIR is not None
def test_analyze_contract_keys_file():
keys = json.loads(
(ROOT / "tests" / "fixtures" / "analyze_contract_keys.json").read_text(
encoding="utf-8"
)
)
for k in ("kline_data", "bi_list", "seg_list", "zs_list", "bsp_list"):
assert k in keys