Skip to content

配置说明

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
}
配置项类型默认值说明
largeFileThresholdnumber1048576大文件阈值(字节)
staleBranchDaysnumber90僵尸分支天数
commitMessageMinLengthnumber10提交消息最小长度
enableConventionalCommitsbooleantrue启用规范检测

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.enabledbooleanfalse启用 AI
ai.providerstring"deepseek"AI 提供商
ai.apiKeystring""API Key
ai.baseUrlstring""自定义 API 地址
ai.modelstring""模型名称

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.defaultstring"gitcode"默认平台
platform.gitcode.tokenstring""GitCode Token
platform.gitcode.usernamestring""GitCode 用户名
platform.github.tokenstring""GitHub Token
platform.github.usernamestring""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.churnThresholdnumber10最小修改次数
hotspot.timeRangenumber90时间范围(天)
hotspot.excludePatternsarray[...]排除模式
hotspot.bugFixKeywordsarray[...]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

配置优先级

  1. 命令行参数(最高)
  2. 项目 .vscode/settings.json
  3. 用户 VS Code 设置
  4. 默认值(最低)

基于 MIT 许可发布