feat: 添加 GrowthBook 自定义服务器适配器

通过 CLAUDE_GB_ADAPTER_URL/KEY 环境变量连接自定义 GrowthBook 实例,
无配置时所有 feature 读取返回代码默认值。支持 GrowthBook Cloud(非 remoteEval),
含完整文档和 feature key 列表。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-04-03 10:37:15 +08:00
parent 78144b4dba
commit e74c009e02
5 changed files with 213 additions and 21 deletions

View File

@@ -3,6 +3,10 @@ import { isEnvTruthy } from '../utils/envUtils.js'
// Lazy read so ENABLE_GROWTHBOOK_DEV from globalSettings.env (applied after
// module load) is picked up. USER_TYPE is a build-time define so it's safe.
export function getGrowthBookClientKey(): string {
// 适配器优先:自定义 GrowthBook 服务器
const adapterKey = process.env.CLAUDE_GB_ADAPTER_KEY
if (adapterKey) return adapterKey
return process.env.USER_TYPE === 'ant'
? isEnvTruthy(process.env.ENABLE_GROWTHBOOK_DEV)
? 'sdk-yZQvlplybuXjYh6L'