Api Integration
指导前端与后端API集成的类型、错误、鉴权及实时通信设计规范。
下载 255
通过命令行管理 GitLab 项目、问题、合并请求等,支持自动化运维。
openclaw skills install @jonasgao/gitlab-api-client命令、参数、文件名以原文为准
Node.js 编写的 GitLab REST API (v4) 客户端。从 ./.env 文件读取配置。
GITLAB_TOKEN 的值。curl、wget 或任何工具直接调用 GitLab API。所有访问必须通过 gitlab-client 进行。.env 文件以管理 GITLAB_URL,但 **GITLAB_TOKEN 必须由用户手动设置**。需要在 ./.env 文件中包含以下内容:
GITLAB_URL=https://gitlab.fullnine.com.cn
GITLAB_TOKEN=<your-personal-access-token>如果未提供令牌,将提示用户编辑 ./.env 文件,并在 <GITLAB_URL>/-/profile/personal_access_tokens 处创建个人访问令牌(权限范围:api)。
首次安装:source ~/.nvm/nvm.sh && npm install
gitlab-client users me # 当前用户信息
gitlab-client projects list --owned # 我的项目列表
gitlab-client issues list --project 42 --state opened # 项目中的打开问题
gitlab-client mrs create --project 42 --source-branch feat --target-branch main --title "My MR"格式:gitlab-client <资源> <操作> [ID] [--key 值 ...]
所有列表操作支持 --page N --per-page N(默认每页 20 条,最大 100 条)。
| 操作 | 使用方式 | 选项 |
|---|---|---|
| 列表 | projects list | --search --owned --membership --visibility |
| 获取 | projects get <id> | |
| 搜索 | projects search "term" | |
| 创建 | projects create --name "name" | --description --visibility --namespace-id --initialize-with-readme |
| 编辑 | projects edit <id> | --name --description --visibility |
| 删除 | projects delete <id> | |
| 分叉 | projects fork <id> | --namespace |
| 成员 | projects members <id> | |
| 钩子 | projects hooks <id> |
| 操作 | 使用方式 | 选项 |
|---|---|---|
| 列表 | issues list --project <id> | --state --labels --milestone --assignee-id --search |
| 获取 | issues get --project <id> --iid <iid> | |
| 创建 | issues create --project <id> --title "T" | --description --labels --assignee-ids --milestone-id --due-date --confidential |
| 编辑 | issues edit --project <id> --iid <iid> | --title --description --state-event --labels --assignee-ids |
| 关闭 | issues close --project <id> --iid <iid> | |
| 重新打开 | issues reopen --project <id> --iid <iid> | |
| 删除 | issues delete --project <id> --iid <iid> | |
| 评论 | issues notes --project <id> --iid <iid> | |
| 添加评论 | issues add-note --project <id> --iid <iid> --body "text" |
| 操作 | 使用方式 | 选项 |
|---|---|---|
| 列表 | mrs list --project <id> | --state --labels --milestone --source-branch --target-branch --search |
| 获取 | mrs get --project <id> --iid <iid> | |
| 创建 | mrs create --project <id> --source-branch "src" --target-branch "tgt" --title "T" | --description --assignee-id --reviewer-ids --labels --milestone-id --remove-source-branch --squash |
| 编辑 | mrs edit --project <id> --iid <iid> | --title --description --state-event --labels --assignee-id |
| 合并 | mrs merge --project <id> --iid <iid> | --merge-commit-message --squash --should-remove-source-branch |
| 变更 | mrs changes --project <id> --iid <iid> | |
| 提交记录 | mrs commits --project <id> --iid <iid> | |
| 评论 | mrs notes --project <id> --iid <iid> | |
| 添加评论 | mrs add-note --project <id> --iid <iid> --body "text" | |
| 审核通过 | mrs approve --project <id> --iid <iid> | |
| 流水线 | mrs pipelines --project <id> --iid <iid> |
| 操作 | 使用方式 | 选项 |
|---|---|---|
| 列表 | branches list --project <id> | --search |
| 获取 | branches get --project <id> --branch "name" | |
| 创建 | branches create --project <id> --branch "name" --ref "main" | |
| 删除 | branches delete --project <id> --branch "name" | |
| 删除已合并分支 | branches delete-merged --project <id> |
| 操作 | 使用方式 | 选项 |
|---|---|---|
| 列表 | commits list --project <id> | --ref-name --since --until --path |
| 获取 | commits get --project <id> --sha "abc123" | |
| 差异 | commits diff --project <id> --sha "abc123" | |
| 评论 | commits comments --project <id> --sha "abc123" | |
| 添加评论 | commits add-comment --project <id> --sha "abc123" --note "text" |
| 操作 | 使用方式 | 选项 |
|---|---|---|
| 目录树 | repo tree --project <id> | --path --ref --recursive |
| 文件内容 | repo file --project <id> --file-path "path" | --ref |
| 原始文件 | repo raw --project <id> --file-path "path" | --ref |
| 创建文件 | repo create-file --project <id> --file-path "p" --branch "b" --content "c" --commit-message "m" | |
| 更新文件 | repo update-file --project <id> --file-path "p" --branch "b" --content "c" --commit-message "m" | |
| 删除文件 | repo delete-file --project <id> --file-path "p" --branch "b" --commit-message "m" | |
| 比较版本 | repo compare --project <id> --from "main" --to "feat" |
| 操作 | 使用方式 | 选项 |
|---|---|---|
| 列表 | pipelines list --project <id> | --status --ref |
| 获取 | pipelines get --project <id> --pipeline-id <pid> | |
| 作业 | pipelines jobs --project <id> --pipeline-id <pid> | |
| 作业日志 | pipelines job-log --project <id> --job-id <jid> | |
| 重试 | pipelines retry --project <id> --pipeline-id <pid> | |
| 取消 | pipelines cancel --project <id> --pipeline-id <pid> | |
| 创建 | pipelines create --project <id> --ref "main" | --variables "K1=v1,K2=v2" |
| 操作 | 使用方式 | 选项 |
|---|---|---|
| 列表 | groups list | --search --owned |
| 获取 | groups get <id> | |
| 项目 | groups projects <id> | --search |
| 成员 | groups members <id> | |
| 问题 | groups issues <id> | --state |
| 合并请求 | groups mrs <id> | --state |
| 操作 | 用法 |
|---|---|
| 自身信息 | users me |
| 列表 | users list [--search "john"] |
| 获取 | users get <id> |
| 项目列表 | users projects <id> |
| 操作 | 用法 | 选项 |
|---|---|---|
| 列表 | labels list --project <id> | |
| 创建 | labels create --project <id> --name "bug" --color "#FF0000" | --description |
| 编辑 | labels edit --project <id> --name "bug" | --new-name --color |
| 删除 | labels delete --project <id> --name "bug" |
| 操作 | 用法 | 选项 |
|---|---|---|
| 列表 | milestones list --project <id> | --state |
| 获取 | milestones get --project <id> --milestone-id <mid> | |
| 创建 | milestones create --project <id> --title "v1.0" | --description --due-date --start-date |
| 编辑 | milestones edit --project <id> --milestone-id <mid> | --title --state-event |
| 删除 | milestones delete --project <id> --milestone-id <mid> |
| 操作 | 用法 | 选项 |
|---|---|---|
| 标签 列表 | tags list --project <id> | --search |
| 标签 创建 | tags create --project <id> --tag-name "v1.0" --ref "main" | --message |
| 标签 删除 | tags delete --project <id> --tag-name "v1.0" | |
| 发布 列表 | releases list --project <id> | |
| 发布 创建 | releases create --project <id> --tag-name "v1.0" --name "R1" | --description |
| 操作 | 用法 | 选项 |
|---|---|---|
| 列表 | snippets list --project <id> | |
| 获取 | snippets get --project <id> --snippet-id <sid> | |
| 创建 | snippets create --project <id> --title "T" --file-name "f" --content "c" | --visibility |
| 操作 | 用法 |
|---|---|
| 全局搜索 | search global --scope <scope> --search "query" |
| 项目搜索 | search project --project <id> --scope <scope> --search "query" |
| 组织搜索 | search group --group <id> --scope <scope> --search "query" |
支持的范围:
全局:projects|issues|merge_requests|milestones|snippet_titles|users
项目:issues|merge_requests|milestones|notes|wiki_blobs|commits|blobs
组织:projects|issues|merge_requests|milestones
| 操作 | 用法 | 选项 |
|---|---|---|
| 列表 | runners list --project <id> | |
| 所有运行器 | runners all | --type --status |
| 操作 | 用法 | 选项 |
|---|---|---|
| 列表 | hooks list --project <id> | |
| 创建 | hooks create --project <id> --url "url" | --push-events --merge-requests-events --issues-events --token |
| 删除 | hooks delete --project <id> --hook-id <hid> |
PRIVATE-TOKEN 请求头。权限范围:api(完整访问)、read_api(只读)、read_user、read_repository。my-group%2Fmy-project)。jq 工具进行过滤,例如:gitlab-client projects list | jq '.[].name'。YYYY-MM-DDTHH:MM:SSZ)。--labels "bug,feature,urgent"。401 未授权,403 禁止访问,404 未找到,422 验证失败,429 请求过于频繁。已收录 1 个 Skill