← 返回 Skills 市场
d1gl3

GitLab API

作者 d1gl3 · GitHub ↗ · v0.1.0
cross-platform ⚠ suspicious
2078
总下载
1
收藏
5
当前安装
1
版本数
在 OpenClaw 中安装
/install gitlab-api
功能描述
GitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations.
使用说明 (SKILL.md)

GitLab API

Interact with GitLab repositories via the REST API. Supports both GitLab.com and self-hosted instances.

Setup

Store your GitLab personal access token:

mkdir -p ~/.config/gitlab
echo "glpat-YOUR_TOKEN_HERE" > ~/.config/gitlab/api_token

Token scopes needed: api or read_api + write_repository

Get a token:

Configuration

Default instance: https://gitlab.com

For self-hosted GitLab, create a config file:

echo "https://gitlab.example.com" > ~/.config/gitlab/instance_url

Common Operations

List Projects

GITLAB_TOKEN=$(cat ~/.config/gitlab/api_token)
GITLAB_URL=$(cat ~/.config/gitlab/instance_url 2>/dev/null || echo "https://gitlab.com")

curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  "$GITLAB_URL/api/v4/projects?owned=true&per_page=20"

Get Project ID

Projects are identified by ID or URL-encoded path (namespace%2Fproject).

# By path
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  "$GITLAB_URL/api/v4/projects/username%2Frepo"

# Extract ID from response: jq '.id'

Read File

PROJECT_ID="12345"
FILE_PATH="src/main.py"
BRANCH="main"

curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  "$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}?ref=$BRANCH" \
  | jq -r '.content' | base64 -d

Create/Update File

PROJECT_ID="12345"
FILE_PATH="src/new_file.py"
BRANCH="main"
CONTENT=$(echo "print('hello')" | base64)

curl -X POST -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  -H "Content-Type: application/json" \
  "$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}" \
  -d @- \x3C\x3CEOF
{
  "branch": "$BRANCH",
  "content": "$CONTENT",
  "commit_message": "Add new file",
  "encoding": "base64"
}
EOF

For updates, use -X PUT instead of -X POST.

Delete File

curl -X DELETE -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  -H "Content-Type: application/json" \
  "$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}" \
  -d '{"branch": "main", "commit_message": "Delete file"}'

List Files in Directory

curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  "$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/tree?path=src&ref=main"

Get Repository Content (Archive)

curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  "$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/archive.tar.gz" \
  -o repo.tar.gz

List Branches

curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  "$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/branches"

Create Branch

curl -X POST -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  -H "Content-Type: application/json" \
  "$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/branches" \
  -d '{"branch": "feature-xyz", "ref": "main"}'

Helper Script

Use scripts/gitlab_api.sh for common operations:

# List projects
./scripts/gitlab_api.sh list-projects

# Read file
./scripts/gitlab_api.sh read-file \x3Cproject-id> \x3Cfile-path> [branch]

# Write file
./scripts/gitlab_api.sh write-file \x3Cproject-id> \x3Cfile-path> \x3Ccontent> \x3Ccommit-msg> [branch]

# Delete file
./scripts/gitlab_api.sh delete-file \x3Cproject-id> \x3Cfile-path> \x3Ccommit-msg> [branch]

# List directory
./scripts/gitlab_api.sh list-dir \x3Cproject-id> \x3Cdir-path> [branch]

Rate Limits

  • GitLab.com: 300 requests/minute (authenticated)
  • Self-hosted: Configurable by admin

API Reference

Full API docs: https://docs.gitlab.com/ee/api/api_resources.html

Key endpoints:

  • Projects: /api/v4/projects
  • Repository files: /api/v4/projects/:id/repository/files
  • Repository tree: /api/v4/projects/:id/repository/tree
  • Branches: /api/v4/projects/:id/repository/branches
安全使用建议
This skill implements a straightforward GitLab API helper, but before installing you should: 1) Verify you are comfortable giving it a GitLab personal access token — create a token with the minimum scopes needed (prefer read_api or limited repo write scopes rather than full 'api' if possible). 2) Note the SKILL.md recommends storing the token in plaintext at ~/.config/gitlab/api_token; consider using an environment variable or a secrets manager instead to reduce exposure. 3) Ensure the host running the skill has curl, jq and base64 available (the registry metadata did not declare these dependencies). 4) Review and test the included scripts in a safe environment (especially write-file and delete-file commands) before allowing autonomous agent use. 5) If you expect strict provenance, ask the publisher to correct the metadata to declare the required credential and runtime binaries so the permission surface is clear.
功能分析
Type: OpenClaw Skill Name: gitlab-api Version: 0.1.0 The skill bundle provides a helper script and documentation for interacting with the GitLab API. It requires a GitLab Personal Access Token, which is read from `~/.config/gitlab/api_token` or an environment variable. All `curl` commands are directed at the configured GitLab instance and perform standard repository operations (read/write files, list projects, manage branches). There is no evidence of data exfiltration to unauthorized endpoints, malicious execution, persistence mechanisms, or prompt injection attempts against the agent. The requested token scopes (`api` or `read_api` + `write_repository`) are appropriate for the skill's stated purpose.
能力评估
Purpose & Capability
Name, description, SKILL.md, and the included script all align on GitLab repository operations (read/write/delete files, list projects/branches). However the registry metadata claims no primary credential and no required binaries even though the skill expects a GitLab personal access token and uses curl/jq/base64. The missing declarations are an inconsistency (likely oversight) but not evidence of malicious intent.
Instruction Scope
The SKILL.md and scripts confine themselves to interacting with GitLab APIs and local config under ~/.config/gitlab. They do not instruct reading unrelated system files or exfiltrating data to unexpected endpoints; all network calls target the configured GitLab instance. Examples and helper script consistently use the token and instance URL stored under ~/.config/gitlab or via GITLAB_TOKEN/GITLAB_URL env vars.
Install Mechanism
This is an instruction-only skill with no install spec. Nothing is downloaded or written by an installer. The helper script is included in the package; no installation mechanism risk was found.
Credentials
The skill requires a GitLab personal access token (and optionally GITLAB_URL/GITLAB_TOKEN env vars), but the registry metadata lists no required env vars or primary credential. The script also implicitly requires external binaries (curl, jq, base64) which are not declared. Requiring an API token is reasonable for the stated purpose, but the omission in metadata reduces transparency and could lead to accidental misconfiguration or credential exposure. Users should note the token is stored in plaintext at ~/.config/gitlab/api_token by the recommended steps.
Persistence & Privilege
The skill does not request always:true and does not modify other skills or system-wide agent settings. It reads a local config file and may be run by the agent, which is normal for a connector of this type.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gitlab-api
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gitlab-api 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Basic GitLab repository operations
元数据
Slug gitlab-api
版本 0.1.0
许可证
累计安装 5
当前安装数 5
历史版本数 1
常见问题

GitLab API 是什么?

GitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 2078 次。

如何安装 GitLab API?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install gitlab-api」即可一键安装,无需额外配置。

GitLab API 是免费的吗?

是的,GitLab API 完全免费(开源免费),可自由下载、安装和使用。

GitLab API 支持哪些平台?

GitLab API 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 GitLab API?

由 d1gl3(@d1gl3)开发并维护,当前版本 v0.1.0。

💬 留言讨论