Files
baozaotumao 39fe248f9f feat: 重组为标准 skill 包结构 + 修复 verify.sh bash 3.2 兼容
- 新增 .claude/skills/new-project/SKILL.md(标准 skill 格式)
- install-skill.sh 安装时组装 SKILL.md + verify.sh,单一源无重复
- verify.sh 改用索引数组替代 declare -A,兼容 macOS bash 3.2
- log_pass/log_skip 显式 return 0,避免 set -e 下非 verbose 误退出
- README 改为 skill 优先;补全 copier.yml/scripts/template 入库
2026-06-01 21:19:45 -07:00

27 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 配置管理
> .env 规约 + 命名映射坑 + API 文档开关。每个服务用 `.env` 注入配置,**不硬编码、不提交密钥**。
- `{服务}/.env.example` 提交 git(模板);`{服务}/.env` gitignore(含密钥)
- backend/agent`pydantic-settings``.env`,启动即校验类型,fail-fast
- frontendVite 读 `.env`**仅 `VITE_` 前缀变量**注入浏览器
- 优先级:环境变量 > `.env` 文件 > 代码默认值
## 命名映射(关键坑 —— 无需自定义 alias_generator
`.env`**SCREAMING_SNAKE_CASE**`AGENT_WS_URL`);Settings 字段用 **snake_case**`agent_ws_url`)。字段已是 snake_case`agent_ws_url``AGENT_WS_URL` 正是 **pydantic-settings 默认映射**。**不要引入任何自定义 `alias_generator`** —— 旧版 `to_screaming_snake` 桥接函数已删除。
```python
class Settings(BaseSettings):
agent_ws_url: str = "ws://localhost:8001"
enable_api_docs: bool = True # dev 默认开,prod 关
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
# 无 alias_generatorAGENT_WS_URL → agent_ws_url 为默认行为
```
## API 文档(Swagger / OpenAPI
- FastAPI 由 `.env``ENABLE_API_DOCS` 控制 `/docs` `/redoc` `/openapi.json`**dev trueprod false**(关闭时三者设 `None`
- 主要用于 backendagent 内部 WS 服务可直接关
- 外部可替换依赖(LLM CLI 命令、skill 来源/路径)也经 `.env` 注入,不硬编码(见 `architecture.md``agent.md`