{"id":49969267,"url":"https://github.com/studyzy/gongfeng-cli","last_synced_at":"2026-05-18T07:01:20.385Z","repository":{"id":358498565,"uuid":"1239699308","full_name":"studyzy/gongfeng-cli","owner":"studyzy","description":"面向腾讯工蜂的cli工具，专门对AI Agent优化","archived":false,"fork":false,"pushed_at":"2026-05-17T18:07:34.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-17T18:44:22.485Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/studyzy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-15T10:55:44.000Z","updated_at":"2026-05-17T18:07:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/studyzy/gongfeng-cli","commit_stats":null,"previous_names":["studyzy/gongfeng-cli"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/studyzy/gongfeng-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studyzy%2Fgongfeng-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studyzy%2Fgongfeng-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studyzy%2Fgongfeng-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studyzy%2Fgongfeng-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/studyzy","download_url":"https://codeload.github.com/studyzy/gongfeng-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/studyzy%2Fgongfeng-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33168910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T05:43:36.989Z","status":"ssl_error","status_checked_at":"2026-05-18T05:43:19.133Z","response_time":71,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-18T07:01:15.428Z","updated_at":"2026-05-18T07:01:20.375Z","avatar_url":"https://github.com/studyzy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gongfeng-cli\n\n面向 AI Agent 的腾讯工蜂命令行工具，通过工蜂 API 实现代码托管核心操作。输出针对最小 token 消耗优化，列表默认紧凑 JSON、详情默认 Markdown。\n\n## 安装\n\n### 方式一：go install（推荐）\n\n```bash\ngo install github.com/studyzy/gongfeng-cli/cmd/gongfeng@latest\n```\n\n### 方式二：从源码构建并安装\n\n```bash\ngit clone git@github.com:studyzy/gongfeng-cli.git\ncd gongfeng-cli\nmake install   # 编译并安装到 $GOPATH/bin\n```\n\n### 方式三：仅构建二进制\n\n```bash\ngit clone git@github.com:studyzy/gongfeng-cli.git\ncd gongfeng-cli\nmake build     # 在当前目录生成 ./gongfeng\n```\n\n## 认证\n\n使用工蜂 Private Token 进行认证。\n\n```bash\n# 命令行登录（写入 ~/.gongfeng.json）\ngongfeng auth login --token \u003cyour_private_token\u003e\n\n# 写入当前目录 .gongfeng.json\ngongfeng auth login --token \u003cyour_private_token\u003e --local\n\n# 或设置环境变量\nexport GONGFENG_TOKEN=\u003cyour_private_token\u003e\n```\n\n凭据也可以直接写入配置文件 `~/.gongfeng.json` 或当前目录的 `.gongfeng.json`。\n\n**凭据优先级**：环境变量 \u003e `./.gongfeng.json` \u003e `~/.gongfeng.json`，CLI flag（`--token`）可在调用时再次覆盖。\n\n### 自定义工蜂站点地址\n\n如需连接私有部署的工蜂实例，可通过环境变量、配置文件或 `--base-url` 指定：\n\n```bash\n# 环境变量\nexport GONGFENG_BASE_URL=https://your-gongfeng.example.com/\n```\n\n或写入配置文件：\n\n```json\n{\n  \"token\": \"your-token\",\n  \"base_url\": \"https://your-gongfeng.example.com/\"\n}\n```\n\n| 配置项 | 环境变量 | JSON 字段 | 默认值 |\n|--------|----------|-----------|--------|\n| Private Token | `GONGFENG_TOKEN` | `token` | — |\n| 项目 ID | `GONGFENG_PROJECT_ID` | `project_id` | — |\n| API 地址 | `GONGFENG_BASE_URL` | `base_url` | `https://git.code.tencent.com/` |\n\n## 基本用法\n\n```bash\n# 查询项目列表\ngongfeng project list\n\n# 查看项目详情（支持 namespace/project 路径或数字 ID）\ngongfeng project show namespace/myproject\n\n# 查询 MR 列表\ngongfeng mr list\n\n# 创建 MR\ngongfeng mr create --source-branch feature/xxx --target-branch main --title \"feat: 新功能\"\n\n# 合并 MR（参数为全局 id，非 iid）\ngongfeng mr accept 42\n\n# 查询分支列表\ngongfeng branch list\n\n# 查询提交列表\ngongfeng commit list\n\n# 查询缺陷列表\ngongfeng issue list\n\n# 创建缺陷\ngongfeng issue create --title \"Bug: 登录失败\" --description \"详情...\"\n\n# 查看所有命令参考（AI 自发现）\ngongfeng --help\n```\n\n## 命令一览\n\n以 `gongfeng --help` 实际输出为准，下表用于快速概览：\n\n```\ngongfeng\n├── auth           login\n├── project        list | owned | show | create | update | delete | search\n│                  members | member-show | share | shares | unshare\n│                  events | star | unstar | star-status | stars\n├── mr             list | show | create | update | accept\n│                  changes | commits | comments | download-files\n├── commit         list | show | diff | refs | comments | create-comment\n├── commit-status  list | create | result\n├── branch         list | show | create | delete\n├── tag            list | show | create | delete\n├── issue          list | my-list | show | create | update\n│                  subscribe | unsubscribe\n├── release        list | show | create | update | delete\n├── review         invite | remove | mr-show | approve | reject | mr-reopen | mr-cancel\n│                  commit-list | commit-show | commit-create | commit-update\n│                  commit-approve | commit-reject | commit-reopen\n├── repo           tree | file | create-file | update-file | delete-file\n│                  compare | raw | commit-blob\n├── group          list | show | create | update | delete | members\n├── namespace      list\n├── label          list | create | update | delete\n├── milestone      list | show | create | update | delete | issues\n├── note           mr-list | mr-show | mr-create | mr-update\n│                  issue-list | issue-show | issue-create | issue-update\n│                  review-list | review-show | review-create | review-update\n├── fork           create | link | unlink\n├── user           list | show | me | watched\n│                  ssh-keys | ssh-key-show | ssh-key-create | ssh-key-delete\n│                  emails | email-show | email-create | email-delete\n│                  find-by-email\n├── watcher        list | status | watch | unwatch\n├── webhook        list | show | create | update | delete\n└── skill          init\n```\n\n`gongfeng --version` 打印版本号。\n\n## 全局标志\n\n| 标志 | 说明 |\n|------|------|\n| `--project-id \u003cid\u003e` | 项目 ID 或 `namespace/project` 路径（覆盖配置）。支持整数 ID 或字符串路径 |\n| `--token \u003ctoken\u003e` | 工蜂 Private Token（覆盖配置） |\n| `--base-url \u003curl\u003e` | 工蜂实例 URL（覆盖配置） |\n| `--json` | 强制 JSON 输出（列表默认已是 JSON，详情默认 Markdown 更省 token） |\n| `--pretty` | 输出带缩进的 JSON，仅供人类阅读；AI Agent 不应使用（浪费 token），隐含 `--json` |\n\n## 配置文件\n\n配置文件为 `~/.gongfeng.json`（全局）或 `./.gongfeng.json`（项目级），两者可共存，项目级优先。\n\n```json\n{\n  \"token\": \"your-private-token\",\n  \"project_id\": \"namespace/project\",\n  \"base_url\": \"https://git.code.tencent.com/\"\n}\n```\n\n## 输出格式\n\n- **列表命令**：默认输出紧凑 JSON（无缩进），最小化 token 消耗\n- **详情命令**：默认输出 Markdown 格式，加 `--json` 可切换为 JSON\n- **人类阅读**：使用 `--pretty` 输出带缩进的 JSON\n\n## AI Coding 工具集成\n\n为 Cursor / Codex / Claude Code 等 AI Coding 工具一键生成 SKILL 指令文件：\n\n```bash\ngongfeng skill init\n```\n\n命令会扫描当前目录、交互式选择需要生成的工具，并在对应位置写入 `SKILL.md`，让 AI Agent 自动发现 gongfeng CLI 的使用规范。\n\n## SDK\n\n工蜂 Go SDK 已独立为单独的模块，可直接引入使用：\n\n```bash\ngo get github.com/studyzy/gongfeng-sdk-go@latest\n```\n\n详见 [gongfeng-sdk-go](https://github.com/studyzy/gongfeng-sdk-go)。\n\n## 开发\n\n```bash\nmake build           # 构建\nmake install         # 安装到 $GOPATH/bin\nmake test            # 运行测试（含 -race 与覆盖率）\nmake coverage        # 生成 HTML 覆盖率报告\nmake lint            # gofmt-check + go vet + golangci-lint\nmake fmt             # gofmt -w + goimports -w\nmake ci              # 本地完整复现 GitHub CI 流程\nmake tidy            # go mod tidy\nmake release-check   # 校验 .goreleaser.yml\nmake release-snapshot # 本地快照构建（不发布），生成跨平台产物到 dist/\nmake clean           # 清理构建产物\n```\n\nCI 由 [`.github/workflows/ci.yml`](.github/workflows/ci.yml) 定义，包含 build / test / lint 三个并行 Job。\n\n## 发布\n\n推送 `v*` 形式的 tag 时，[`.github/workflows/release.yml`](.github/workflows/release.yml) 会自动通过 [GoReleaser](https://goreleaser.com) 构建并发布到 GitHub Releases，包含以下产物：\n\n- `gongfeng_\u003cversion\u003e_linux_x86_64.tar.gz`\n- `gongfeng_\u003cversion\u003e_macos_arm64.tar.gz`\n- `gongfeng_\u003cversion\u003e_windows_x86_64.zip`\n- `checksums.txt`（SHA-256）\n\n发布流程：\n\n```bash\ngit tag v0.1.0\ngit push origin v0.1.0\n```\n\n构建配置见 [`.goreleaser.yml`](.goreleaser.yml)，本地试跑可执行 `make release-snapshot`。\n\n## 许可证\n\nApache License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstudyzy%2Fgongfeng-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstudyzy%2Fgongfeng-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstudyzy%2Fgongfeng-cli/lists"}