Skip to content

配置参考

spaceflow.json / .spaceflowrc 完整配置项参考。

配置文件位置

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

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

完整配置示例

json
{
  "$schema": ".spaceflow/config-schema.json",
  "lang": "zh-CN",
  "support": ["claudeCode", "windsurf", "cursor"],
  "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[]
  • 默认值["claudeCode"]
  • 说明:需要关联的 AI 编辑器列表
  • 可选值"claudeCode" | "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"删除分析模式
concurrencynumber10并发审查文件数
retriesnumber3失败重试次数
retryDelaynumber1000重试间隔(毫秒)

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 许可发布