Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(skills): make chanlun and ashare-pre-st-filter references reachable

Haozhe Wu18bd2fc86491
diff --git a/agent/src/skills/ashare-pre-st-filter/SKILL.md b/agent/src/skills/ashare-pre-st-filter/SKILL.md
index dde4341e0..1f90d7f6b 100644
--- a/agent/src/skills/ashare-pre-st-filter/SKILL.md
+++ b/agent/src/skills/ashare-pre-st-filter/SKILL.md
@@ -30,7 +30,7 @@ category: risk-analysis
1. **所有财务/基本面/分红/审计/ST 状态数据,必须先调用 [tushare skill](../tushare/SKILL.md)**,按下表指定的接口名、`ts_code`、`period` 拉取。
2. 当 tushare 接口因积分不足、token 缺失或返回空时,**回退到 [akshare skill](../akshare/SKILL.md)** 对应函数。
3. **akshare 兜底数据必须在最终输出"备注"中显式标注**:`数据源:akshare(非官方聚合,不保证完整性,建议核对原始公告)`。**不允许只用 akshare 给出"高可信度"预测**——akshare 兜底的红线项可信度强制降一档(高→中高,中高→中,中→低)。
-4. 监管处罚(E2)走本 skill 自带的 [scripts/fetch_sina_penalties.py](scripts/fetch_sina_penalties.py),不经过 tushare/akshare。
+4. 监管处罚(E2)走本 skill 自带的 [scripts/fetch_sina_penalties.py](ashare-pre-st-filter/scripts/fetch_sina_penalties.py),不经过 tushare/akshare。
### 数据需求映射表
@@ -399,7 +399,7 @@ E2_综合等级 = max(E2_单条等级, E2_频次等级)
## 自带脚本
-- [scripts/fetch_sina_penalties.py](scripts/fetch_sina_penalties.py) — 抓取新浪财经 vGP_GetOutOfLine 处罚页,stdlib 实现,无外部依赖;reason / issuer 标准化。
+- [scripts/fetch_sina_penalties.py](ashare-pre-st-filter/scripts/fetch_sina_penalties.py) — 抓取新浪财经 vGP_GetOutOfLine 处罚页,stdlib 实现,无外部依赖;reason / issuer 标准化。
调用方式:
diff --git a/agent/src/skills/chanlun/SKILL.md b/agent/src/skills/chanlun/SKILL.md
index 7c7f48083..1dec84f06 100644
--- a/agent/src/skills/chanlun/SKILL.md
+++ b/agent/src/skills/chanlun/SKILL.md
@@ -19,17 +19,17 @@ category: strategy
| 概念 | 说明 | 详细文档 |
| --- | --- | --- |
-| 分型(FX) | 顶分型:中间K线最高;底分型:中间K线最低 | [分型](references/核心概念/分型.md) |
-| 笔(BI) | 相邻顶底分型之间的一段走势,最小单元 | [笔](references/核心概念/笔.md) |
-| 中枢(ZS) | 至少3笔构成的价格重叠区域,趋势的核心 | [中枢](references/核心概念/中枢.md) |
+| 分型(FX) | 顶分型:中间K线最高;底分型:中间K线最低 | [分型](chanlun/references/核心概念/分型.md) |
+| 笔(BI) | 相邻顶底分型之间的一段走势,最小单元 | [笔](chanlun/references/核心概念/笔.md) |
+| 中枢(ZS) | 至少3笔构成的价格重叠区域,趋势的核心 | [中枢](chanlun/references/核心概念/中枢.md) |
## 买卖点体系
| 买卖点 | 含义 | 详细文档 |
| --- | --- | --- |
-| 一买/一卖 | 趋势结束后的第一个反转信号(背驰点) | [一买一卖](references/买卖点/一买一卖.md) |
-| 二买/二卖 | 一买/一卖后回调不破底/顶的确认信号 | [二买二卖](references/买卖点/二买二卖.md) |
-| 三买/三卖 | 中枢上移/下移后回调不进入前中枢的信号 | [三买三卖](references/买卖点/三买三卖.md) |
+| 一买/一卖 | 趋势结束后的第一个反转信号(背驰点) | [一买一卖](chanlun/references/买卖点/一买一卖.md) |
+| 二买/二卖 | 一买/一卖后回调不破底/顶的确认信号 | [二买二卖](chanlun/references/买卖点/二买二卖.md) |
+| 三买/三卖 | 中枢上移/下移后回调不进入前中枢的信号 | [三买三卖](chanlun/references/买卖点/三买三卖.md) |
## 依赖安装
diff --git a/agent/tests/test_skill_reference_links.py b/agent/tests/test_skill_reference_links.py
index 793a3b97e..6d14b96bc 100644
--- a/agent/tests/test_skill_reference_links.py
+++ b/agent/tests/test_skill_reference_links.py
@@ -26,19 +26,39 @@ from src.tools.read_file_tool import ReadFileTool
# Bundled skills root (mirrors ReadFileTool's own allowed-root computation).
_SKILLS_DIR = Path(__file__).resolve().parents[1] / "src" / "skills"
-# Skills whose SKILL.md links into a references/ and/or scripts/ tree.
-_SKILLS_UNDER_TEST = ("tushare", "okx-market", "eastmoney", "sec-edgar", "yfinance")
-
# Markdown link whose target is a references/*.md or scripts/*.py path, e.g.
# "[label](tushare/references/foo/bar.md)" or "[ex](sec-edgar/scripts/x.py)".
# The target itself may contain parentheses (some tushare filenames do, e.g.
# "社融增量(月度).md"), so anchor on the trailing ".md)"/".py)" rather than the
-# first ")".
+# first ")". It must not contain "]" or a newline, though: excluding only "("
+# let a match start at one link's "](" and run through the prose to a later
+# link's ".py)", capturing a paragraph as a single "target".
_MD_LINK_RE = re.compile(
- r"\]\((?P<target>[^(]*(?:references/.+?\.md|scripts/.+?\.py))\)"
+ r"\]\((?P<target>[^\]\n]*?(?:references/|scripts/)[^\]\n]*?\.(?:md|py))\)"
)
+def _skills_with_reference_links() -> Tuple[str, ...]:
+ """Return every bundled skill whose SKILL.md links into its own tree.
+
+ Discovered, never listed. A hand-written tuple named five skills and let the
+ others drift out of coverage: ``chanlun`` and ``ashare-pre-st-filter``
+ shipped 8 links with no prefix — unreachable to the agent — precisely
+ because nothing was looking at them.
+ """
+ return tuple(
+ sorted(
+ path.parent.name
+ for path in _SKILLS_DIR.rglob("SKILL.md")
+ if _MD_LINK_RE.search(path.read_text(encoding="utf-8"))
+ )
+ )
+
+
+#: Skills whose SKILL.md links into a references/ and/or scripts/ tree.
+_SKILLS_UNDER_TEST = _skills_with_reference_links()
+
+
def _extract_reference_links(skill: str) -> List[str]:
"""Return every markdown link target containing ``references/``.
@@ -79,6 +99,24 @@ def test_skills_have_reference_links() -> None:
assert _extract_reference_links(skill), f"{skill} has no references/ links"
+def test_every_skill_with_reference_links_is_covered() -> None:
+ """Discovery must find every such skill, not a subset someone typed out.
+
+ The parametrised tests below are only as wide as this set. While it was a
+ literal tuple, a skill could add prefix-less links and stay green forever —
+ which is exactly what two of them did.
+ """
+ linking = {
+ path.parent.name
+ for path in _SKILLS_DIR.rglob("SKILL.md")
+ if _MD_LINK_RE.search(path.read_text(encoding="utf-8"))
+ }
+ assert set(_SKILLS_UNDER_TEST) == linking
+ assert len(_all_links()) == sum(
+ len(_extract_reference_links(skill)) for skill in linking
+ )
+
+
@pytest.mark.parametrize("skill,link", _all_links())
def test_reference_links_carry_skill_prefix(skill: str, link: str) -> None:
"""Every references/ or scripts/ link is written with its skill-name prefix.