Go to file
Your GitHub Username 5403ec3218 fix: adapt all shortcuts to real GitLink API
- client.go: fix .json suffix to insert before ? in query strings
- user +info: switch to /users/:login endpoint (get_user_info_by_login returns 401)
- issue +comment: fix journals path to /issues/:id/journals (no owner/repo prefix)
- issue +close: use PUT with status_id=5 instead of non-existent close_issue endpoint
- pr +diff: use /files endpoint (versions/diff doesn't exist)
- pr +create: default base branch changed from main to master
- branch +create: default source branch changed from main to master
- search +repos/+users: fix search param from keyword to search
- auth/transport: use access_token query param instead of cookie
- auth/login: support .json suffix and token from response body
- repo +list: add category filter support
2026-03-31 19:06:08 +08:00
cmd feat: initial implementation of gitlink-cli 2026-03-30 18:22:02 +08:00
doc fix: adapt all shortcuts to real GitLink API 2026-03-31 19:06:08 +08:00
internal fix: adapt all shortcuts to real GitLink API 2026-03-31 19:06:08 +08:00
shortcuts fix: adapt all shortcuts to real GitLink API 2026-03-31 19:06:08 +08:00
skills feat: initial implementation of gitlink-cli 2026-03-30 18:22:02 +08:00
.gitignore feat: initial implementation of gitlink-cli 2026-03-30 18:22:02 +08:00
LICENSE feat: initial implementation of gitlink-cli 2026-03-30 18:22:02 +08:00
Makefile feat: initial implementation of gitlink-cli 2026-03-30 18:22:02 +08:00
README.md docs: remove third-party CLI references from docs 2026-03-30 18:30:45 +08:00
go.mod feat: initial implementation of gitlink-cli 2026-03-30 18:22:02 +08:00
go.sum feat: initial implementation of gitlink-cli 2026-03-30 18:22:02 +08:00
main.go feat: initial implementation of gitlink-cli 2026-03-30 18:22:02 +08:00

README.md

gitlink-cli

GitLink CLI — 面向 GitLink确实开源 平台的命令行工具。

gitlink-cli 采用业界主流的分层 CLI 架构设计,提供 Shortcuts快捷命令、Raw API原始调用两层命令体系覆盖仓库管理、Issue 跟踪、Pull Request、CI/CD、组织管理等全流程操作并内置 AI Agent Skills 支持 Claude Code 自动化。

特性

  • 三层命令体系Shortcuts+ 前缀高频命令)→ Raw API覆盖全部 490+ 端点)
  • Git Remote 自动解析:在 git 仓库目录下自动推断 owner/repo
  • 统一输出格式JSON / Table / YAML标准 Envelope 结构
  • OS Keychain 存储Token 安全存储于系统密钥链
  • AI Agent Skills11 个 SKILL.md 文件5 个自动化工作流模板

安装

从源码构建

git clone https://github.com/FlagosEvangelist/gitlink-cli.git
cd gitlink-cli
make build
# 二进制文件生成在当前目录: ./gitlink-cli

安装到 PATH

make install
# 安装到 $GOPATH/bin

依赖Go 1.21+

快速开始

# 1. 初始化配置
gitlink-cli config init

# 2. 登录
gitlink-cli auth login

# 3. 查看当前用户
gitlink-cli user +me

# 4. 查看仓库信息
gitlink-cli repo +info --owner Gitlink --repo forgeplus

# 5. 在 git 仓库目录下自动解析 owner/repo
cd ~/my-gitlink-project
gitlink-cli issue +list

命令概览

gitlink-cli
├── auth          login / logout / status
├── config        init / set / get / list
├── repo          +list / +info / +create / +fork / +delete
├── issue         +list / +create / +view / +update / +close / +comment
├── pr            +list / +create / +view / +merge / +close / +files / +diff
├── release       +list / +create / +view / +delete
├── branch        +list / +create / +delete / +protect / +unprotect
├── org           +list / +info / +members / +create
├── ci            +builds / +logs / +restart / +stop
├── user          +me / +info
├── search        +repos / +users
├── api           GET / POST / PUT / DELETE原始 API 调用)
└── version

Shortcuts 示例

# 仓库
gitlink-cli repo +info --owner Gitlink --repo forgeplus
gitlink-cli repo +create --name my-project --description "新项目"

# Issue
gitlink-cli issue +create --title "Bug: 登录失败" --body "复现步骤..."
gitlink-cli issue +close --id 123

# Pull Request
gitlink-cli pr +create --title "feat: 搜索功能" --head feature/search --base master
gitlink-cli pr +merge --id 42

# Release
gitlink-cli release +create --tag v1.0.0 --name "v1.0.0" --body "首个正式版本"

# 搜索
gitlink-cli search +repos --keyword "machine learning"

Raw API

Shortcuts 未覆盖的接口可通过 Raw API 直接调用:

gitlink-cli api GET /users/me
gitlink-cli api GET /Gitlink/forgeplus/commits --query 'page=1&limit=5'
gitlink-cli api POST /Gitlink/forgeplus/issues --body '{"subject":"test","description":"..."}'

全局参数

参数 说明
--owner 仓库所有者(可从 git remote 自动解析)
--repo 仓库名称(可从 git remote 自动解析)
--format 输出格式:json / table / yaml
--debug 启用调试输出

AI Agent Skills

skills/ 目录包含 11 个 Claude Code Agent Skill 文件,支持 AI 自动化操作 GitLink 平台:

Skill 说明
gitlink-shared 认证、全局参数、安全规则
gitlink-repo 仓库操作
gitlink-issue Issue 操作
gitlink-pr Pull Request 操作
gitlink-ci CI/CD 操作
gitlink-org 组织管理
gitlink-release 发布管理
gitlink-search 搜索
gitlink-user 用户管理
gitlink-pm 项目管理
gitlink-workflow AI 自动化工作流Issue Triage、PR Review、Release Notes 等)

项目结构

gitlink-cli/
├── cmd/                  # Cobra 命令定义
│   ├── root.go           # 根命令 + 全局 flags
│   ├── auth/             # auth login/logout/status
│   ├── api/              # Raw API 层
│   ├── config/           # config init/set/get/list
│   └── cmdutil/          # 全局变量
├── internal/             # 内部包
│   ├── auth/             # 登录、Token 存储、Transport
│   ├── client/           # HTTP 客户端 + 分页
│   ├── config/           # 配置文件管理
│   ├── context/          # git remote 解析
│   └── output/           # Envelope + Formatter
├── shortcuts/            # Shortcut 实现
│   ├── common/           # 框架types, runner
│   ├── repo/issue/pr/... # 各领域 shortcuts
│   └── register.go       # 注册入口
├── skills/               # AI Agent Skills
│   └── gitlink-*/SKILL.md
├── doc/                  # 设计文档
├── main.go
├── Makefile
└── go.mod

设计文档

详见 doc/design.md — 包含完整的架构设计、三层命令体系、认证方案、API 客户端、AI Skills 设计和开发计划。

License

Apache License 2.0