---
name: wiki-search
description: Manage Wiki.js pages via GraphQL. CRITICAL - always POST to /graphql, never use /api/v1 or REST endpoints.
metadata: {"openclaw":{"emoji":"📖","requires":{"env":["WIKIJS_URL","WIKIJS_API_TOKEN"]},"primaryEnv":"WIKIJS_API_TOKEN"}}
---

# Wiki.js Skill

CRITICAL: Wiki.js is GraphQL only. Always POST to $WIKIJS_URL/graphql. Never use /api or REST.

## List pages
curl -s -X POST -H "Authorization: Bearer $WIKIJS_API_TOKEN" -H "Content-Type: application/json" -d '{"query":"{ pages { list(limit: 20) { id title path } } }"}' "$WIKIJS_URL/graphql"

## Create page
curl -s -X POST -H "Authorization: Bearer $WIKIJS_API_TOKEN" -H "Content-Type: application/json" -d '{"query":"mutation { pages { create(content: \"CONTENT\", description: \"\", editor: \"markdown\", isPrivate: false, isPublished: true, locale: \"en\", path: \"PATH\", tags: [], title: \"TITLE\") { responseResult { succeeded message } } } }"}' "$WIKIJS_URL/graphql"

## Update page
curl -s -X POST -H "Authorization: Bearer $WIKIJS_API_TOKEN" -H "Content-Type: application/json" -d '{"query":"mutation { pages { update(id: ID, content: \"CONTENT\", description: \"\", editor: \"markdown\", isPrivate: false, isPublished: true, locale: \"en\", path: \"PATH\", tags: [], title: \"TITLE\") { responseResult { succeeded message } } } }"}' "$WIKIJS_URL/graphql"

## 已验证可用的命令（必须按此格式执行）

### 创建页面（已验证成功）
curl -s -X POST \
  -H "Authorization: Bearer $WIKIJS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"mutation { pages { create(content: \"CONTENT\", description: \"\", editor: \"markdown\", isPrivate: false, isPublished: true, locale: \"en\", path: \"PATH\", tags: [], title: \"TITLE\") { responseResult { succeeded message } page { id path } } } }"}' \
  "$WIKIJS_URL/graphql"

### 列出页面（已验证成功）
curl -s -X POST \
  -H "Authorization: Bearer $WIKIJS_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"{ pages { list(limit: 20) { id title path updatedAt } } }"}' \
  "$WIKIJS_URL/graphql"

## 重要提示
- Wiki.js 只支持 GraphQL，端点是 /graphql
- 绝对不能用 /api/v1、/api/v2、/rest 等 REST 端点
- 上面的命令已经在 https://wiki.140103.xyz 测试通过

## 用浏览器创建 Wiki.js 文章（已验证流程）
1. openclaw browser open https://wiki.140103.xyz
2. snapshot 找 New Page ref，click 它
3. snapshot 找 path textbox ref，triple-click 后 type 路径，click Select
4. snapshot 找 Markdown ref，click 它
5. snapshot 找 Title ref（textbox Title），triple-click 后 type 标题，click OK ref
6. 注入内容：openclaw browser evaluate --fn "() => { document.querySelector('.CodeMirror').CodeMirror.setValue('内容'); }"
7. snapshot 找第一个 button ref（保存按钮 icon=󰄬），click 保存
注意：每步必须重新 snapshot 获取最新 ref，ref 会变化
注意：CodeMirror 编辑器必须用 evaluate 注入内容，不能用 type
