From da2e0b367129b1b378a1f5fc12ec04daa61655a5 Mon Sep 17 00:00:00 2001 From: Magnus Hedemark Date: Thu, 21 May 2026 23:09:33 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20add=20confluence-cli=20skill=20?= =?UTF-8?q?=E2=80=94=20Confluence=20wiki=20from=20the=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CLI wrapper for the Atlassian Confluence Cloud REST API. Commands: - me: current user profile - spaces: list spaces with keys and IDs - pages: list pages by space with version info - view: full page content with HTML body extraction - search: CQL search with result excerpts - create: create pages with HTML body and parent support All cli-builder patterns: --json, --dry-run, --quiet, --verbose, lazy auth, emit() dual-output, structured logging, pre-parsed global flags. Auth via CONFLUENCE_EMAIL + CONFLUENCE_API_TOKEN. Handles v2 API for CRUD, rest API for search and user. Signed-off-by: Jasper --- confluence-cli/SKILL.md | 128 +++++++ confluence-cli/scripts/confluence-cli | 509 ++++++++++++++++++++++++++ 2 files changed, 637 insertions(+) create mode 100644 confluence-cli/SKILL.md create mode 100755 confluence-cli/scripts/confluence-cli diff --git a/confluence-cli/SKILL.md b/confluence-cli/SKILL.md new file mode 100644 index 0000000..15f1955 --- /dev/null +++ b/confluence-cli/SKILL.md @@ -0,0 +1,128 @@ +--- +name: confluence-cli +description: >- + Interact with Atlassian Confluence from the terminal: list spaces, + browse pages, view page content, search with CQL, and create pages. + Use when the user mentions Confluence, a space key (e.g. DEV), or + asks about documentation, wiki pages, space content, or knowledge + base articles. +license: MIT +compatibility: Requires CONFLUENCE_EMAIL and CONFLUENCE_API_TOKEN env vars + (free from id.atlassian.com/manage/api-tokens), Python 3.8+, and the + `requests` library. Also requires CONFLUENCE_SERVER (defaults to + your-domain.atlassian.net). +metadata: + tags: [confluence, atlassian, wiki, documentation, knowledge-base, api-client] + sources: + - https://developer.atlassian.com/cloud/confluence/rest/v2/ + - https://id.atlassian.com/manage/api-tokens +--- + +# confluence-cli — Confluence Wiki from the Terminal + +Interact with Atlassian Confluence Cloud via the REST API. List spaces, browse pages, view page content with body, search with CQL, and create pages. + +## Setup + +1. Generate an API token at [id.atlassian.com/manage/api-tokens](https://id.atlassian.com/manage/api-tokens) +2. Set environment variables: + +```bash +export CONFLUENCE_EMAIL="your-email@example.com" +export CONFLUENCE_API_TOKEN="your-api-token" +export CONFLUENCE_SERVER="https://your-domain.atlassian.net" +``` + +`--help` and `--dry-run` work without credentials. + +## Essential Commands + +### me — Current user profile + +```bash +confluence-cli me # your account info +confluence-cli me --json # machine-readable +``` + +### spaces — List spaces + +```bash +confluence-cli spaces # all accessible spaces +confluence-cli spaces --limit 50 # more results +confluence-cli spaces --json # machine-readable +``` + +### pages — List pages + +```bash +confluence-cli pages # recent pages across all spaces +confluence-cli pages --space DEV # pages in a specific space +confluence-cli pages --space DEV --limit 10 # top 10 +confluence-cli pages --space DEV --json # machine-readable +``` + +Filters by space key. Resolves the key to an internal ID automatically. + +### view — View a page by ID + +```bash +confluence-cli view 123456 # full page with body +confluence-cli view 123456 --json # machine-readable +``` + +Shows title, status, version, author, timestamps, and HTML body (stripped to plain text for display). The full HTML body is available in `--json` output up to 5000 chars. + +### search — Search with CQL + +```bash +confluence-cli search --cql 'text~"deploy"' # full-text search +confluence-cli search --cql 'space=DEV AND type=page' # by space and type +confluence-cli search --cql 'creator=currentuser()' # my content +confluence-cli search --cql 'text~"api"' --limit 5 # top 5 results +``` + +CQL (Confluence Query Language) is Confluence's search syntax. Common patterns: +- `text~"keyword"` — full-text search +- `space=KEY` — filter by space +- `type=page` — filter by content type +- `creator=currentuser()` — your content +- `label="name"` — by label +- Combine with `AND`: `space=DEV AND text~"deploy"` + +### create — Create a page + +```bash +confluence-cli create --space DEV --title "My Page" # basic +confluence-cli create --space DEV --title "API Docs" --body "

Content

" # with HTML body +confluence-cli create --space DEV --title "Test" --parent 123456 # as child page +confluence-cli create --space DEV --title "Test" --dry-run # preview +``` + +Creates pages in Confluence Cloud (v2 API). The body is HTML using Confluence's storage format. For simple pages, basic HTML tags work (`

`, `