mcpField
C
confluence-cli

confluence-cli

github.com/dcjanusProductivity2541 installsUpdated 2d ago
Repository

About confluence-cli

confluence-cli is a command-line skill for routine Confluence work, including reading, searching, updating pages, and handling attachments. It provides JSON output and can publish pages from Markdown.

Key features

  1. 01Query spaces, pages, and child pages
  2. 02Search by title or CQL
  3. 03Rename pages and publish Markdown
  4. 04List and download page attachments
  5. 05Expand API fields with parameters

Use cases

  1. 01Fetch page content by page ID
  2. 02Find pages in a specific space
  3. 03Publish a Markdown document under a parent page
  4. 04Download page attachments in bulk

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dcjanus/prompts --skill confluence-cli

After installing, type/confluence-cliin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

scripts/
confluence_api_client.py
confluence_cli.py
scripts/tests/
test_confluence_api_client.py
test_markdown_to_storage.py

Details

From the project README

说明:以下调用方式均以当前 SKILL.md 文件所在文件夹为 workdir。

脚本调用方式(必须直接执行,不要用 uv run python 或 python):

cd skills/confluence-cli && ./scripts/confluence_cli.py --json page get --page-id 3060336952

错误示例:

uv run python skills/confluence-cli/scripts/confluence_cli.py --json page get --page-id 3060336952
python skills/confluence-cli/scripts/confluence_cli.py --json page get --page-id 3060336952
  1. 常用子命令(覆盖日常场景)
  • space
    • list [--start --limit --expand]
    • get --space-key [--expand]
  • page
    • get --page-id [--body-format --expand --fresh]
    • by-title --space-key --title [--body-format --expand]
    • children --page-id [--start --limit --expand]
    • rename --page-id --title
    • publish-markdown --parent-id --title --markdown-path [--update-if-exists --body-format --expand]
  • attachment
    • list --page-id [--start --limit --expand]
    • download --page-id [--output-dir --name --filter --all --start --limit --expand]
  • search
    • --cql [--start --limit --body-format --expand]
  1. 输出格式
  • 所有调用统一在脚本后、子命令前加 --json(示例:./scripts/confluence_cli.py --json page get --page-id ...)
  1. 冷门参数/字段怎么查
  • 运行 ./scripts/confluence_cli.py <command> --help 查看该命令的参数
  • 需要更深入的 Confluence API 字段时,可扩展脚本中的 expand 参数
  1. 注意事项
  • page get 默认保持普通缓存读;刚更新页面后需要校验正文时,使用 --fresh 绕过 Confluence 或代理缓存,例如:./scripts/confluence_cli.py --json page get --page-id ... --body-format storage --expand body.storage,version --fresh
  1. 附件下载示例
  • 下载指定附件(可重复传入 --name):./scripts/confluence_cli.py attachment download --page-id 3060336952 --output-dir ./attachments --name a.png --name b.png
  • 下载全部附件(自动分页):./scripts/confluence_cli.py attachment download --page-id 3060336952 --all --output-dir ./attachments
  • 过滤下载(正则):./scripts/confluence_cli.py attachment download --page-id 3060336952 --filter 'image2026-1-19_.*\\.png' --all --output-dir ./attachments
  1. 发布 Markdown 示例
  • 发布到父页面(同名则更新):./scripts/confluence_cli.py --json page publish-markdown --parent-id 3061931928 --title "批量重置 Offset 功能测试" --markdown-path /path/to/doc.md
  • Markdown 表格支持 :---、:---:、---: 这类左对齐、居中、右对齐语法,会转换为 Confluence storage 的 table cell text-align 样式。
  • 本地图片发布时会按最大展示框自动生成单个 Confluence 尺寸属性:默认最大宽度 1000、最大高度 800,可用 --image-max-width / --image-max-height 覆盖;只写触发缩放的 ac:width 或 ac:height,不修改附件原图。
  • 如需覆盖单张图片展示尺寸,可使用 Markdown title:![图](./a.png "confluence-width=1200")、![图](./a.png "confluence-height=600")、![图](./a.png "confluence-size=original")。

资源

Comments

Markdown supported