Skip to content

配置参考

.spaceflow/spaceflow.json / .spaceflowrc 完整配置项参考,兼容项目根目录的 spaceflow.json

配置文件位置

按优先级从低到高排列,后者覆盖前者:

优先级路径说明
1(最低)~/.spaceflow/spaceflow.json全局配置
2~/.spaceflowrc全局 RC 文件
3spaceflow.json项目根配置
4.spaceflow/spaceflow.json项目配置
5(最高).spaceflowrc项目 RC 文件

完整配置示例

json
{
  "$schema": ".spaceflow/config-schema.json",
  "lang": "zh-CN",
  "support": ["agents", "cursor", "windsurf", "opencode"],
  "gitProvider": {
    "provider": "github",
    "serverUrl": "https://api.github.com"
  },
  "dependencies": {
    "@spaceflow/review": "latest",
    "@spaceflow/publish": "workspace:*",
    "@spaceflow/shell": "link:./extensions/shell",
    "@spaceflow/scripts": "link:./extensions/scripts"
  },
  "review": {
    "references": ["./references", "https://github.com/org/review-spec"],
    "includes": ["*/**/*.ts", "!*/**/*.spec.*", "!*/**/*.config.*"],
    "generateDescription": true,
    "autoUpdatePrTitle": true,
    "lineComments": true,
    "verifyFixes": true,
    "analyzeDeletions": false,
    "deletionAnalysisMode": "open-code",
    "concurrency": 10,
    "retries": 3,
    "retryDelay": 1000
  },
  "publish": {
    "monorepo": { "enabled": true, "propagateDeps": true },
    "changelog": {
      "preset": {
        "type": [
          { "type": "feat", "section": "新特性" },
          { "type": "fix", "section": "修复BUG" },
          { "type": "perf", "section": "性能优化" },
          { "type": "refactor", "section": "代码重构" },
          { "type": "docs", "section": "文档更新" },
          { "type": "style", "section": "代码格式" },
          { "type": "test", "section": "测试用例" },
          { "type": "chore", "section": "其他修改" }
        ]
      }
    },
    "npm": {
      "publish": true,
      "packageManager": "pnpm",
      "tag": "latest",
      "ignoreVersion": true,
      "versionArgs": ["--workspaces false"]
    },
    "git": {
      "lockBranch": false,
      "pushWhitelistUsernames": ["github-actions[bot]"]
    }
  },
  "commit": {
    "strategy": "rules-first",
    "rules": [
      { "pattern": "docs/**", "scope": "docs" },
      { "pattern": ".github/**", "scope": "ci" }
    ]
  }
}

顶层字段

$schema

  • 类型string
  • 说明:JSON Schema 路径,用于编辑器自动补全
  • 示例".spaceflow/config-schema.json"

lang

  • 类型string
  • 默认值"zh-CN"
  • 说明:界面语言。支持 zh-CNen

support

  • 类型string[]
  • 默认值["agents"]
  • 说明:需要关联的 AI 编辑器列表
  • 可选值"agents" | "windsurf" | "cursor" | "opencode"

dependencies

  • 类型Record<string, string>
  • 说明:已安装的外部 Extension 注册表,由 spaceflow install 自动管理

gitProvider 配置

字段类型默认值说明
providerstring"github"Git 平台类型:"github" / "gitea" / "gitlab"
serverUrlstring自动检测平台 API 地址

review 配置

需安装 @spaceflow/review

字段类型默认值说明
referencesstring[][]审查规范来源(本地目录或远程仓库 URL)
includesstring[]["*/**/*"]审查文件匹配模式(glob)
generateDescriptionbooleanfalse自动生成 PR 描述
autoUpdatePrTitlebooleanfalse自动更新 PR 标题
lineCommentsbooleantrue生成行内评论
verifyFixesbooleanfalse验证修复建议
analyzeDeletionsbooleanfalse分析删除代码影响
deletionAnalysisModestring"open-code"删除分析模式
fastModeobject快速模式(条件触发 + 行为策略)
concurrencynumber10并发审查文件数
retriesnumber3失败重试次数
retryDelaynumber1000重试间隔(毫秒)

fastMode 结构

字段类型默认值说明
enabledbooleanfalse是否启用快速模式
descriptionModestring"commit-classified"功能描述策略:off / commit-classified
when.opstring"and"条件组合方式:and / or
when.rulesobject[]触发条件规则,支持 lt/lte/gt/gte/eq

when.rules[].field 支持 addedmodifieddeletedtotalround(当前轮次,从 1 开始)。

LLM 配置要求

默认情况下,review 需要配置 LLM 服务;但以下场景可以在未配置 LLM 时运行:

  • 快速模式首轮(--fast、PR 标题 [/review --fast],或 review.fastMode 命中并进入首轮)
  • --flush / PR closed 事件且 verifyFixes=false

以下场景仍必须配置 LLM:

  • 常规审查
  • 修复验证(verifyFixes=true
  • 删除代码分析(analyzeDeletions / deletionOnly

references 支持的格式

格式示例
本地目录"./references"
GitHub 仓库"https://github.com/org/review-spec"
GitHub 目录"https://github.com/org/repo/tree/main/references"
Gitea 仓库"https://git.example.com/org/review-spec"
SSH"git+ssh://git@github.com/org/repo.git"

publish 配置

需安装 @spaceflow/publish

publish.monorepo

字段类型默认值说明
enabledbooleanfalse启用 Monorepo 模式
propagateDepsbooleanfalse传播依赖版本更新

publish.changelog

变更日志配置,基于 conventional-changelog

publish.npm

字段类型默认值说明
publishbooleantrue是否发布到 npm
packageManagerstring"pnpm"包管理器
tagstring"latest"npm tag
ignoreVersionbooleanfalse忽略版本检查

publish.git

字段类型说明
lockBranchboolean发布时是否锁定分支
pushWhitelistUsernamesstring[]允许推送的用户名白名单

commit 配置

字段类型默认值说明
strategystring"rules-first"Scope 策略
rulesobject[][]Scope 规则(pattern + scope)

基于 MIT 许可发布