Loading...
Loading...
GitLab wiki operations via API. ALWAYS use this skill when user wants to: (1) list wiki pages, (2) read wiki content, (3) create/update/delete wiki pages, (4) upload wiki attachments.
npx skill4agent add grandcamel/gitlab-assistant-skills gitlab-wikiglab api| Operation | Command Pattern | Risk |
|---|---|---|
| List pages | | - |
| Get page | | - |
| Create page | | ⚠️ |
| Update page | | ⚠️ |
| Delete page | | ⚠️⚠️ |
| Upload attachment | | ⚠️ |
wiki_blobsapi# List all wiki pages
glab api projects/123/wikis --method GET
# With pagination
glab api projects/123/wikis --paginate
# Using project path
glab api "projects/$(echo 'mygroup/myproject' | jq -Rr @uri)/wikis"# Get page by slug
glab api projects/123/wikis/home --method GET
# Get page with spaces in slug (URL-encode)
glab api "projects/123/wikis/$(echo 'Getting Started' | jq -Rr @uri)" --method GET
# Get nested page
glab api "projects/123/wikis/$(echo 'docs/installation' | jq -Rr @uri)" --method GET
# Get page with specific version
glab api "projects/123/wikis/home?version=abc123" --method GET
# Render HTML
glab api "projects/123/wikis/home?render_html=true" --method GET# Create simple page
glab api projects/123/wikis --method POST \
-f title="Getting Started" \
-f content="# Getting Started\n\nWelcome to the project!"
# Create with Markdown format
glab api projects/123/wikis --method POST \
-f title="Installation Guide" \
-f content="# Installation\n\n## Prerequisites\n\n- Node.js 18+\n- npm" \
-f format="markdown"
# Create with custom slug
glab api projects/123/wikis --method POST \
-f title="API Reference" \
-f slug="api-docs" \
-f content="# API Documentation\n\nEndpoints..."
# Create nested page (using directory in slug)
glab api projects/123/wikis --method POST \
-f title="Database Setup" \
-f slug="guides/database-setup" \
-f content="# Database Setup\n\nConfiguration steps..."# Update content
glab api "projects/123/wikis/$(echo 'Getting Started' | jq -Rr @uri)" --method PUT \
-f content="# Getting Started\n\n## Updated content\n\nNew information..."
# Update title and content
glab api projects/123/wikis/home --method PUT \
-f title="Home Page" \
-f content="# Welcome\n\nUpdated home page content."
# Change format (markdown, rdoc, asciidoc)
glab api projects/123/wikis/readme --method PUT \
-f format="asciidoc" \
-f content="= README\n\nAsciidoc content here."# Delete page
glab api projects/123/wikis/old-page --method DELETE
# Delete nested page (URL-encode)
glab api "projects/123/wikis/$(echo 'drafts/temp-page' | jq -Rr @uri)" --method DELETE# Upload image
glab api projects/123/wikis/attachments --method POST \
-F "file=@screenshot.png"
# The response contains the markdown link to use
# {"file_name":"screenshot.png","file_path":"uploads/...","branch":"master","link":{"url":"...","markdown":""}}| Option | Type | Description |
|---|---|---|
| string | Page title (required for create) |
| string | Page URL slug (auto-generated from title if not provided) |
| string | Page content |
| string | Content format: |
| Format | Extension | Description |
|---|---|---|
| | GitHub-flavored Markdown |
| | Ruby documentation format |
| | AsciiDoc format |
| | Org mode format |
project_id=123
# Create home page
glab api projects/$project_id/wikis --method POST \
-f title="Home" \
-f content="# Project Wiki\n\n- [Getting Started](Getting-Started)\n- [API Reference](API-Reference)\n- [FAQ](FAQ)"
# Create getting started guide
glab api projects/$project_id/wikis --method POST \
-f title="Getting Started" \
-f content="# Getting Started\n\n## Installation\n\n\`\`\`bash\nnpm install\n\`\`\`"
# Create API reference
glab api projects/$project_id/wikis --method POST \
-f title="API Reference" \
-f content="# API Reference\n\n## Endpoints\n\n| Method | Path | Description |\n|--------|------|-------------|\n| GET | /users | List users |"# List all pages and save content
mkdir -p wiki_backup
glab api projects/123/wikis --paginate | jq -r '.[].slug' | while read slug; do
echo "Backing up: $slug"
glab api "projects/123/wikis/$(echo "$slug" | jq -Rr @uri)" | \
jq -r '.content' > "wiki_backup/${slug//\//_}.md"
done# Get page from source project
content=$(glab api projects/123/wikis/home | jq -r '.content')
title=$(glab api projects/123/wikis/home | jq -r '.title')
# Create in target project
glab api projects/456/wikis --method POST \
-f title="$title" \
-f content="$content"# 1. Upload image
response=$(glab api projects/123/wikis/attachments --method POST -F "file=@diagram.png")
# 2. Get markdown link
markdown_link=$(echo "$response" | jq -r '.link.markdown')
# 3. Update page to include image
current_content=$(glab api projects/123/wikis/architecture | jq -r '.content')
new_content="$current_content
## Diagram
$markdown_link"
glab api projects/123/wikis/architecture --method PUT \
-f content="$new_content"glab api projects/123/wikis --paginate | \
jq -r '.[] | "[\(.title)](\(.slug))"'Getting StartedGetting-Startedguides/installationguides/| Issue | Cause | Solution |
|---|---|---|
| 404 Not Found | Wiki disabled or page doesn't exist | Enable wiki in project settings, check slug |
| 403 Forbidden | No write access | Need Developer+ role or check wiki permissions |
| Empty content | Encoding issue | Check content string escaping |
| Slug mismatch | Auto-generated slug differs | Explicitly set |
| Upload fails | Wrong content type | Use |