confluence-ai-cli
v0.1.0
Published
CLI to export Confluence pages (with draw.io and inline-SVG diagrams) to Markdown
Maintainers
Readme
confluence-cli
A command-line tool for Confluence pages: exports a page with its diagrams to Markdown.
Features
- Export a Confluence page to Markdown by
pageIdor page URL. - Diagrams are saved too:
- draw.io — PNG is taken from page attachments by macro-id;
- inline SVG (use-case, ER, sequence, etc.) — saved as files.
- Page metadata in the output (title, source link).
- Image format: SVG (default, vector) or PNG.
- Authentication via Personal Access Token (PAT), read-only.
Requirements
- Bun — the only dependency; no npm packages needed at runtime.
Installation
From npm (requires bun >= 1.0):
bun install -g confluence-ai-cli # or: npm install -g confluence-ai-cliFrom source:
git clone <repository-url>
cd confluence-cli
bun install # dev types only
bun run build # builds the executable bundle ./bundle/confluence.tsUsage
Run the built bundle ./bundle/confluence.ts, or run from source with bun start ....
confluence <cmd> <options> ...The export command
Export a page (with diagrams) to Markdown:
confluence export <pageId|URL> [options]Options:
| Option | Description |
|---|---|
| --out-dir <dir> | where to write the result (default: /tmp) |
| --image-format <fmt> | svg (default, vector) or png (needs a converter) |
| --base-url <url> | Confluence base URL (default: $CONFLUENCE_BASE_URL) |
| --token-env <name> | name of the env variable with the PAT (default: CONFLUENCE_PAT) |
| --insecure | skip TLS certificate verification |
| -h, --help | show help |
Examples
export CONFLUENCE_BASE_URL=https://wiki.example.com
export CONFLUENCE_PAT=<your-personal-access-token>
confluence export 12345
confluence export 'https://wiki.example.com/pages/viewpage.action?pageId=12345'
confluence export 12345 --out-dir ./docs --image-format pngHow to get a PAT
Confluence (Data Center / Server): profile → Settings → Personal Access Tokens → Create token. The token is sent in the Authorization: Bearer header and is used read-only.
Project structure
src/
cli.ts # entry point (shebang); the bundle is built from it
main.ts # CLI: argument parsing, help
confluence-api/ # Confluence REST API client
drawio/ # draw.io macro handling
svg/ # inline SVG handling
markdown/ # final Markdown assembly
.archi/ # architecture (archispec): use cases, API contracts
openspec/ # change specifications (openspec)