Skip to content

GitCode CLI v0.12.0

Choose a tag to compare

@github-actions github-actions released this 12 Aug 08:16
· 238 commits to main since this release

GitCode CLI v0.12.0

v0.12.0 是 gh-parity 专项里程碑版本,新增 13 个命令对齐 GitHub CLI,覆盖 actions workflow 管理、仓库配置、用户/搜索/浏览等核心能力。

新功能

Actions 域

  • gc actions run watch — 轮询监控流水线运行直到终态,支持 --interval/--compact/--exit-status,非 TTY 输出单次快照不阻塞
  • gc actions workflow list — 列举仓库流水线文件(GET /api/v8/.../actions/workflows),支持 --json/--limit/--page
  • gc actions workflow run — 手动触发流水线 dispatch(POST .../workflows/{id}/dispatches),支持 --ref/-f key=value/--json

仓库管理

  • gc repo branch list — 列举仓库全部分支,标记默认分支
  • gc repo branch create — 从指定 ref 创建分支,支持 --ref/--description
  • gc repo branch-protection list/create/update/delete — 保护分支规则 CRUD(4 个 API 端点),delete 含 --yes 确认保护
  • gc repo pr-settings view/update — PR 门禁合入规则管理(24 字段:流水线必过/禁止自合入/评审人数/合并模式/Squash/CLA/轻量级 PR 等),指针类型区分未提供与零值
  • gc repo edit — 更新仓库设置(description/homepage/private/public/default-branch/name),PATCH 后 re-read 完整对象

通用命令

  • gc browse — 在浏览器打开 GitCode 资源(repo/issue/PR/branch/commit),纯客户端,--no-browser 仅输出 URL,非 TTY 自动不阻塞
  • gc repo set-default — 设置/查看/清除默认仓库,纯客户端配置,GC_DEFAULT_REPO 环境变量覆盖
  • gc config list — 列出全部配置项及来源(environment/config/default),update.mode 默认 notify
  • gc config clear-cache — 清除 CLI 缓存目录

用户与搜索

  • gc user view — 查看当前用户或指定用户资料(GET /user, GET /users/{username})
  • gc user edit — 更新用户资料(PATCH /user),--name/--bio/--email/--company/--location/--website,--bio 经 secret 扫描
  • gc search repos/issues/users — 搜索仓库/Issues/用户(3 个 GET 端点),issues 支持 --repo/--state 过滤

PR 增强

  • gc pr edit 增强扩展 — 新增 --add-assignee/--remove-assignee/--add-reviewer/--remove-reviewer/--add-tester/--remove-tester(9 个 API 端点),对齐 gh pr edit --reviewer

修复

  • Windows PATH 持久化与并发安全加固(序列化 PATH 更新、保护 mutex、持久化 user PATH)

安全

  • 所有 --description/--bio/--pusher/--merger 等自由文本字段经 cmdutil.ScanContentForSecrets 扫描
  • delete 类命令(branch-protection delete)含 ConfirmOrAbort 确认保护 + --yes 跳过
  • assertNoAccessTokenQuery 安全断言覆盖所有新 API 函数

Agent-Friendly 改进

  • --json 输出覆盖全部新只读和写路径命令
  • 空+JSON 始终输出 [](agent-friendly 契约)
  • --no-interactive 在 TTY 下抑制浏览器打开和非交互行为
  • docs/COMMANDS.md --json 命令索引完整维护

推荐升级方式

短命令快速升级

可信的个人本地环境可优先使用短命令:

npx -y @gitcode-cli/cli@latest install
gitcode version
gitcode doctor install

短命令会继承当前目录和用户的 npm 配置。请仅在确认这些配置(包括 .npmrc)可信时使用。

CI、审计、未知项目目录或自定义 npm registry 环境,使用安全强化命令:

npx --yes --ignore-scripts --registry=https://registry.npmjs.org --@gitcode-cli:registry=https://registry.npmjs.org @gitcode-cli/cli@latest install
gitcode version

锁定版本安装

npx --yes --ignore-scripts --registry=https://registry.npmjs.org --@gitcode-cli:registry=https://registry.npmjs.org @gitcode-cli/cli@0.12.0 install
gitcode version

完整变更

  • 里程碑 gh-parity
  • 13 个 PR 合入:#481/#489/#490/#493/#494/#496/#497/#498/#499/#500/#501/#502/#503/#505