Appearance
配置说明
Git Doctor 的所有配置项详解。
VS Code 设置
在 VS Code 设置中搜索 gitDoctor 进行配置。
基础配置
json
{
// 大文件检测阈值(字节),默认 1MB
"gitDoctor.largeFileThreshold": 1048576,
// 僵尸分支判定天数,默认 90 天
"gitDoctor.staleBranchDays": 90,
// 提交信息最小长度,默认 10 字符
"gitDoctor.commitMessageMinLength": 10,
// 是否检测 Conventional Commits 规范
"gitDoctor.enableConventionalCommits": true
}| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
largeFileThreshold | number | 1048576 | 大文件阈值(字节) |
staleBranchDays | number | 90 | 僵尸分支天数 |
commitMessageMinLength | number | 10 | 提交消息最小长度 |
enableConventionalCommits | boolean | true | 启用规范检测 |
AI 配置
json
{
// 是否启用 AI 功能
"gitDoctor.ai.enabled": false,
// AI 提供商:deepseek 或 kimi
"gitDoctor.ai.provider": "deepseek",
// API Key
"gitDoctor.ai.apiKey": "",
// 自定义 API 地址(可选)
"gitDoctor.ai.baseUrl": "",
// 模型名称(留空使用默认)
"gitDoctor.ai.model": ""
}| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
ai.enabled | boolean | false | 启用 AI |
ai.provider | string | "deepseek" | AI 提供商 |
ai.apiKey | string | "" | API Key |
ai.baseUrl | string | "" | 自定义 API 地址 |
ai.model | string | "" | 模型名称 |
AI 提供商选项:
deepseek- DeepSeek,性价比高kimi- 月之暗面,支持超长上下文
模型名称:
- DeepSeek:
deepseek-chat(默认),deepseek-coder - Kimi:
moonshot-v1-8k,moonshot-v1-32k,moonshot-v1-128k
平台配置
json
{
// 默认代码托管平台
"gitDoctor.platform.default": "gitcode",
// GitCode 配置
"gitDoctor.platform.gitcode.token": "",
"gitDoctor.platform.gitcode.username": "",
// GitHub 配置
"gitDoctor.platform.github.token": "",
"gitDoctor.platform.github.username": ""
}| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
platform.default | string | "gitcode" | 默认平台 |
platform.gitcode.token | string | "" | GitCode Token |
platform.gitcode.username | string | "" | GitCode 用户名 |
platform.github.token | string | "" | GitHub Token |
platform.github.username | string | "" | GitHub 用户名 |
热点分析配置
json
{
// 热点判定的最小修改次数
"gitDoctor.hotspot.churnThreshold": 10,
// 分析时间范围(天)
"gitDoctor.hotspot.timeRange": 90,
// 排除的文件模式
"gitDoctor.hotspot.excludePatterns": [
"**/node_modules/**",
"**/*.min.js",
"**/dist/**",
"**/build/**",
"**/*.lock",
"**/package-lock.json"
],
// Bug Fix 识别关键词
"gitDoctor.hotspot.bugFixKeywords": [
"fix", "bug", "issue", "hotfix", "patch",
"修复", "问题", "修正"
]
}| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
hotspot.churnThreshold | number | 10 | 最小修改次数 |
hotspot.timeRange | number | 90 | 时间范围(天) |
hotspot.excludePatterns | array | [...] | 排除模式 |
hotspot.bugFixKeywords | array | [...] | Bug 关键词 |
完整配置示例
json
{
// 基础配置
"gitDoctor.largeFileThreshold": 1048576,
"gitDoctor.staleBranchDays": 90,
"gitDoctor.commitMessageMinLength": 10,
"gitDoctor.enableConventionalCommits": true,
// AI 配置
"gitDoctor.ai.enabled": true,
"gitDoctor.ai.provider": "deepseek",
"gitDoctor.ai.apiKey": "sk-xxx",
"gitDoctor.ai.model": "deepseek-chat",
// 平台配置
"gitDoctor.platform.default": "github",
"gitDoctor.platform.github.token": "ghp_xxx",
"gitDoctor.platform.github.username": "your-username",
// 热点分析
"gitDoctor.hotspot.churnThreshold": 10,
"gitDoctor.hotspot.timeRange": 30,
"gitDoctor.hotspot.excludePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/*.lock"
]
}项目级配置
在项目根目录创建 .vscode/settings.json:
json
{
"gitDoctor.hotspot.timeRange": 30,
"gitDoctor.hotspot.excludePatterns": [
"**/node_modules/**",
"**/vendor/**"
]
}环境变量
CLI 模式支持环境变量:
bash
# AI API Key
export GIT_DOCTOR_AI_KEY=sk-xxx
# 使用
git-doctor ai -a analyze配置优先级
- 命令行参数(最高)
- 项目
.vscode/settings.json - 用户 VS Code 设置
- 默认值(最低)