feat:飞书文档补全

This commit is contained in:
Evilom
2026-06-08 10:04:12 +08:00
parent ab2ca1d836
commit 3b77605591
659 changed files with 51251 additions and 1340 deletions
+52
View File
@@ -0,0 +1,52 @@
import json
import os
from typing import Dict, Any
import sys
class TBConfig:
"""TeamBition 配置加载器,指向 tb/tb_config.json"""
def __init__(self, config_path: str = None):
if config_path is None:
base_path = os.path.dirname(os.path.abspath(__file__))
config_path = os.path.join(base_path, "tb_config.json")
self.config_path = config_path
self.config = self._load_config()
def _load_config(self) -> Dict[str, Any]:
if os.path.exists(self.config_path):
with open(self.config_path, "r", encoding="utf-8") as f:
return json.load(f)
return {}
def get(self, key: str, default=None):
keys = key.split(".")
value = self.config
for k in keys:
if isinstance(value, dict) and k in value:
value = value[k]
else:
return default
return value
def get_teambition_config(self) -> Dict[str, Any]:
return self.config.get("teambition", {})
def get_export_config(self) -> Dict[str, Any]:
return self.config.get("export", {})
def get_scheduler_config(self) -> Dict[str, Any]:
return self.config.get("scheduler", {})
def get_output_config(self) -> Dict[str, Any]:
return self.config.get("output", {})
def load(self) -> Dict[str, Any]:
self.config = self._load_config()
return self.config
def save(self, new_config: Dict[str, Any]):
self.config = new_config
with open(self.config_path, "w", encoding="utf-8") as f:
json.dump(self.config, f, indent=2, ensure_ascii=False)