Confluence
Search and manage Confluence pages using confluence-cli.
REQUIRED: First-Time Setup
Before using this skill, complete these steps:
Step 1: Install the CLI
CODEBLOCK0
Step 2: Get an API token
- 1. Go to https://id.atlassian.com/manage-profile/security/api-tokens
- Click "Create API token"
- Give it a label (e.g., "confluence-cli")
- Copy the token
Step 3: Configure the CLI
CODEBLOCK1
When prompted, enter:
- - Domain:
yourcompany.atlassian.net (without https://) - Email: Your Atlassian account email
- API token: Paste the token from Step 2
Step 4: Verify setup
CODEBLOCK2
If you see your spaces listed, you're ready to use Confluence.
Search Pages
CODEBLOCK3
Read Page
CODEBLOCK4
Page IDs are in the URL: https://yoursite.atlassian.net/wiki/spaces/SPACE/pages/123456/Title → ID is INLINECODE2
Get Page Info
CODEBLOCK5
Find Page by Title
CODEBLOCK6
List Spaces
CODEBLOCK7
Create Page
CODEBLOCK8
Create Child Page
CODEBLOCK9
Or from a file:
CODEBLOCK10
Update Page
CODEBLOCK11
Or from a file:
CODEBLOCK12
List Child Pages
CODEBLOCK13
Export Page with Attachments
CODEBLOCK14
Tips
- - Domain in config should NOT include
https:// - just INLINECODE4 - Use
--format storage when content is in Confluence storage format (HTML-like) - Page IDs are numeric and found in page URLs
- Config is stored at INLINECODE6
Confluence
使用 confluence-cli 搜索和管理 Confluence 页面。
必需:首次设置
在使用此技能前,请完成以下步骤:
步骤 1:安装 CLI
bash
npm install -g confluence-cli
步骤 2:获取 API 令牌
- 1. 访问 https://id.atlassian.com/manage-profile/security/api-tokens
- 点击创建 API 令牌
- 为其添加标签(例如:confluence-cli)
- 复制令牌
步骤 3:配置 CLI
bash
confluence init
根据提示输入:
- - 域名:yourcompany.atlassian.net(不含 https://)
- 邮箱:您的 Atlassian 账户邮箱
- API 令牌:粘贴步骤 2 中获取的令牌
步骤 4:验证设置
bash
confluence spaces
如果看到空间列表,说明已准备好使用 Confluence。
搜索页面
bash
confluence search 部署指南
读取页面
bash
confluence read <页面ID>
页面 ID 位于 URL 中:https://yoursite.atlassian.net/wiki/spaces/SPACE/pages/123456/Title → ID 为 123456
获取页面信息
bash
confluence info <页面ID>
按标题查找页面
bash
confluence find 页面标题
列出空间
bash
confluence spaces
创建页面
bash
confluence create 页面标题 SPACEKEY --body 页面内容
创建子页面
bash
confluence create-child 子页面标题 <父页面ID> --body 内容
或从文件创建:
bash
confluence create-child 页面标题 <父页面ID> --file content.html --format storage
更新页面
bash
confluence update <页面ID> --body 更新后的内容
或从文件更新:
bash
confluence update <页面ID> --file content.html --format storage
列出子页面
bash
confluence children <页面ID>
导出页面及附件
bash
confluence export <页面ID> --output ./exported-page/
提示
- - 配置中的域名不应包含 https:// - 只需 yourcompany.atlassian.net
- 当内容为 Confluence 存储格式(类似 HTML)时,使用 --format storage
- 页面 ID 为数字,可在页面 URL 中找到
- 配置文件存储在 ~/.confluence-cli/config.json