From 37a26ac67417c1a4262610fb9400a89a5c73e6c9 Mon Sep 17 00:00:00 2001 From: lidf Date: Wed, 1 Jul 2026 15:40:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20capability.py=20=5Fget=5Fvendor=5Fcommit?= =?UTF-8?q?=20=E5=8F=AA=E8=BF=94=E5=9B=9E=20commit=20hash=EF=BC=88?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=20health.py=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit capability.py 的 _get_vendor_commit() 和 health.py 之前有同样的 bug: f.read().strip() 返回整个 VENDOR_COMMIT 文件内容, 导致 scan_capabilities() 上报给 bridge 的 vendor 字段是多行文本。 对齐为逐行 commit: 前缀解析。 --- mindcli/capability.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mindcli/capability.py b/mindcli/capability.py index 1d37a97..52f38ba 100644 --- a/mindcli/capability.py +++ b/mindcli/capability.py @@ -71,9 +71,17 @@ def _scan_mcp_servers() -> list[dict[str, str]]: def _get_vendor_commit() -> str: + """读取 _vendor/VENDOR_COMMIT,只返回 commit hash。 + + VENDOR_COMMIT 是多行标记文件(source:/commit:/date:), + 只返回 commit: 行的值,不是整个文件内容。 + """ commit_file = os.path.join(mindcli._VENDOR_DIR, "VENDOR_COMMIT") try: with open(commit_file) as f: - return f.read().strip() + for line in f: + if line.startswith("commit:"): + return line.split(":", 1)[1].strip() + return "unknown" except FileNotFoundError: return "unknown"