mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Contributors and coding agents need one local command that both reports and enforces the quality contract. This change turns the PR gate into the shared verification entrypoint, adds path-selected local lanes, tightens coverage accounting around changed lines, and documents the repair loop in contributor and agent-facing guidance. Constraint: Ordinary PR verification must stay non-live and runnable without provider credentials Constraint: Coverage policy updates in this commit require maintainer approval before push/merge Rejected: Keep quality guidance only in docs | agents need executable scripts and AGENTS.md instructions to follow the loop consistently Confidence: high Scope-risk: broad Directive: Do not bypass `bun run verify` for production changes; fix failed lanes and coverage reports instead of lowering thresholds Tested: bun run check:policy Tested: ALLOW_CLI_CORE_CHANGE=1 ALLOW_COVERAGE_BASELINE_CHANGE=1 bun run verify Not-tested: live provider baseline; no provider credentials were required for this non-live PR gate
62 lines
2.0 KiB
Markdown
62 lines
2.0 KiB
Markdown
# 环境变量说明
|
||
|
||
|
||
| 变量 | 必填 | 说明 |
|
||
|------|------|------|
|
||
| `ANTHROPIC_API_KEY` | 二选一 | API Key,通过 `x-api-key` 头发送 |
|
||
| `ANTHROPIC_AUTH_TOKEN` | 二选一 | Auth Token,通过 `Authorization: Bearer` 头发送 |
|
||
| `ANTHROPIC_BASE_URL` | 否 | 自定义 API 端点,默认 Anthropic 官方 |
|
||
| `ANTHROPIC_MODEL` | 否 | 默认模型 |
|
||
| `ANTHROPIC_DEFAULT_SONNET_MODEL` | 否 | Sonnet 级别模型映射 |
|
||
| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | 否 | Haiku 级别模型映射 |
|
||
| `ANTHROPIC_DEFAULT_OPUS_MODEL` | 否 | Opus 级别模型映射 |
|
||
| `API_TIMEOUT_MS` | 否 | API 请求超时,默认 600000 (10min) |
|
||
| `DISABLE_TELEMETRY` | 否 | 设为 `1` 禁用遥测 |
|
||
| `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | 否 | 设为 `1` 禁用非必要网络请求 |
|
||
|
||
## 配置方式
|
||
|
||
### 方式一:`.env` 文件
|
||
|
||
```bash
|
||
cp .env.example .env
|
||
```
|
||
|
||
编辑 `.env`(以下示例使用 [MiniMax](https://platform.minimaxi.com/subscribe/token-plan?code=1TG2Cseab2&source=link) 作为 API 提供商,也可替换为其他兼容服务):
|
||
|
||
```bash
|
||
# API 认证(二选一)
|
||
ANTHROPIC_API_KEY=sk-xxx # 标准 API Key(x-api-key 头)
|
||
ANTHROPIC_AUTH_TOKEN=sk-xxx # Bearer Token(Authorization 头)
|
||
|
||
# API 端点(可选,默认 Anthropic 官方)
|
||
ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic
|
||
|
||
# 模型配置
|
||
ANTHROPIC_MODEL=MiniMax-M2.7-highspeed
|
||
ANTHROPIC_DEFAULT_SONNET_MODEL=MiniMax-M2.7-highspeed
|
||
ANTHROPIC_DEFAULT_HAIKU_MODEL=MiniMax-M2.7-highspeed
|
||
ANTHROPIC_DEFAULT_OPUS_MODEL=MiniMax-M2.7-highspeed
|
||
|
||
# 超时(毫秒)
|
||
API_TIMEOUT_MS=3000000
|
||
|
||
# 禁用遥测和非必要网络请求
|
||
DISABLE_TELEMETRY=1
|
||
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
|
||
```
|
||
|
||
### 方式二:`~/.claude/settings.json`
|
||
|
||
```json
|
||
{
|
||
"env": {
|
||
"ANTHROPIC_AUTH_TOKEN": "sk-xxx",
|
||
"ANTHROPIC_BASE_URL": "https://api.minimaxi.com/anthropic",
|
||
"ANTHROPIC_MODEL": "MiniMax-M2.7-highspeed"
|
||
}
|
||
}
|
||
```
|
||
|
||
> 配置优先级:环境变量 > `.env` 文件 > `~/.claude/settings.json`
|