This commit is contained in:
2026-09-09 10:29:02 +08:00
parent 2aa49b5263
commit ccb12dad7c
102 changed files with 7879 additions and 559 deletions

View File

@@ -1,5 +1,7 @@
"""技能配置初始化:.env.example 落盘与用户 .env 缺失项合并。"""
"""配置初始化:从 .env.example 复制到用户 .env,并合并缺失键。
行为对齐模板:``main.py`` 与 ``cli.app.main()`` 启动时均会调用一次。
"""
from __future__ import annotations
import os
@@ -11,8 +13,11 @@ from util.runtime_paths import get_skill_root
def bootstrap_skill_config() -> str:
"""确保用户数据目录 .env 存在,并追加 .env.example 中的新配置项。"""
"""确保用户 .env 存在,并追加 .env.example 中的新配置项。"""
example_path = os.path.join(get_skill_root(), ".env.example")
if not os.path.isfile(example_path):
# demo 没有强制 .env.example,直接返回空路径
return ""
env_path = config.ensure_env_file(SKILL_SLUG, example_path)
comment = f"{SKILL_SLUG} v{SKILL_VERSION}" if SKILL_VERSION else None
config.merge_missing_env_keys(example_path, env_path, comment_skill=comment)