Files
dc-docs/scripts/config.py
T
2026-06-24 12:02:57 +08:00

58 lines
2.2 KiB
Python

"""共享配置:dws / lark-cli 路径解析 + 群组定义"""
import os
import shutil
import platform
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_ROOT = os.path.dirname(SCRIPT_DIR)
TOOLS_DIR = os.path.join(PROJECT_ROOT, "tools")
# ──────────────────────────────────────────────
# dws (钉钉工作空间 CLI)
# ──────────────────────────────────────────────
_WUKONG_PATHS = [
os.path.expanduser(r"~\.real\.bin\dws\bin\dws.exe"),
r"C:\Program Files\Wukong\0.9.51-26052503\bin\dws.exe",
]
def _find_dws():
env = os.environ.get("DWS_PATH")
if env and os.path.isfile(env):
return env
ext = ".exe" if platform.system() == "Windows" else ""
local = os.path.join(TOOLS_DIR, "dws" + ext)
if os.path.isfile(local):
return local
for p in _WUKONG_PATHS:
if os.path.isfile(p):
return p
found = shutil.which("dws")
if found:
return found
raise FileNotFoundError(
"找不到 dws CLI。请将 dws.exe 放到 tools/ 目录或设置 DWS_PATH 环境变量。"
)
DWS = _find_dws()
# ──────────────────────────────────────────────
# lark-cli (飞书文档 CLI)
# ──────────────────────────────────────────────
LARK_CLI = os.path.join(TOOLS_DIR, "lark-cli", "lark-cli.exe")
LARK_CONFIG_DIR = os.path.join(TOOLS_DIR, "lark-config")
# ──────────────────────────────────────────────
# 钉钉群组 ID
# ──────────────────────────────────────────────
GROUPS = {
"dc战略问题研究院": "cidoUneRB4Db8TAXaTrKxkQAw==",
"创新组": "cidMuM+itt5PeY7xNSWsv3M0g==",
"天龙计划X小游戏矩阵": "cid/Vb3hSjdv4sIIs8Fp7sC4g==",
}