confluence-cli
Markdown-sync-first Confluence CLI in Rust.
confluence-cli is built around a safe local workflow:
pullConfluence content into Markdown plus sidecar metadata.planexactly what would change remotely.applyonly when the diff is correct.
It also exposes direct page, blog, search, attachment, label, comment, and property commands for non-sync use cases.
Status
Early release, but already live-verified against both Confluence Cloud and Confluence Data Center.
| Area | Cloud | Data Center | Notes |
|---|---|---|---|
| Auth, spaces, search, page/blog CRUD | Verified | Verified | Live e2e |
| Attachments, labels, properties, comments | Verified | Verified | Live e2e |
pull -> plan -> apply sync flow |
Verified | Verified | Includes drift refusal and noop checks |
doctor environment/profile validation |
Verified | Verified | Live checked |
| Markdown round-trip for common built-in macros | Verified | Verified | Unsupported cases preserve storage safely |
Installation
From crates.io:
From Homebrew:
Prebuilt macOS and Linux archives are published on the GitHub releases page.
Quick Start
Cloud profile:
Data Center profile:
Environment-driven mode also works without a stored profile:
Markdown Sync Workflow
Pull a page tree:
Inspect the planned changes:
Apply the diff:
Local content is stored as:
<slug>/index.md<slug>/.confluence.json<slug>/attachments/*
The frontmatter carries editable metadata like title, type, labels, status, parent, and properties. The sidecar stores remote ids, versions, hashes, and attachment mappings used for safe sync and drift detection.
doctor
Use doctor before a first sync, in CI, or when a profile behaves unexpectedly.
It checks:
- config loading and profile resolution
- base URL and auth shape
- provider reachability
- optional space access
- optional local sync path planning
doctor exits non-zero on failures and supports --json for machine-readable checks.
Commands
Top-level command groups:
auth login|status|logoutprofile add|list|use|removespace list|getsearchpage get|tree|create|update|deleteblog get|create|update|deletepull page|tree|spaceplanapplyattachment list|download|upload|deletelabel list|add|removecomment list|add|deleteproperty list|get|set|deletedoctorcompletions
All major commands accept --json.
Auth And Environment Overrides
Stored profiles live under the local config directory used by directories::ProjectDirs.
Supported environment overrides:
CONFLUENCE_PROFILECONFLUENCE_DOMAINCONFLUENCE_PROVIDERCONFLUENCE_API_PATHCONFLUENCE_AUTH_TYPECONFLUENCE_EMAILorCONFLUENCE_USERNAMECONFLUENCE_API_TOKEN,CONFLUENCE_TOKEN,CONFLUENCE_PASSWORD, orCONFLUENCE_BEARER_TOKENCONFLUENCE_READ_ONLY
CONFLUENCE_PROVIDER must be cloud or data-center. CONFLUENCE_AUTH_TYPE must be basic or bearer.
Shell Completions
Local Data Center
The repo includes a local Confluence Data Center stack for integration testing.
The default e2e path targets the local local-dc profile and the TEST space.
Available helpers:
make confluence-backupmake confluence-restoremake confluence-resetmake confluence-logs
Backups are written to:
docker/backup/confluence-data.tar.gzdocker/backup/postgres-data.tar.gz
The first boot after make confluence-restore can take several minutes before HTTP responds.
To point the e2e suite at another instance:
CONFLUENCE_E2E_PROFILE=other-profile CONFLUENCE_E2E_SPACE=SPACE
Or run fully env-driven:
CONFLUENCE_E2E_PROFILE= \
CONFLUENCE_E2E_BASE_URL=http://localhost:8090 \
CONFLUENCE_E2E_TOKEN="" \
CONFLUENCE_E2E_PROVIDER=data-center \
CONFLUENCE_E2E_SPACE=TEST \
Release And CI
Local release gate:
That runs formatting, clippy, tests, CLI smoke checks, and cargo package.
Local versioned releases use vership, matching the other CLI projects:
vership uses vership.toml in this repo so vership preflight runs the stricter make release-check gate rather than the default Rust-only lint/test commands.
GitHub Actions is set up to:
- run CI on pushes and pull requests
- publish tagged releases to crates.io
- build tagged macOS and Linux release archives
- attach release archives and checksum files to GitHub releases
- update
rvben/tapautomatically on tagged releases whenHOMEBREW_TAP_TOKENis configured
Markdown Fidelity
Remote canonical content stays in Confluence storage format. Markdown is the editable local representation.
The converter already handles a large set of common Confluence constructs directly, including:
- headings, lists, tables, code blocks, task lists, links, and attachments
- page links and typed page/user/space resource parameters
- layouts, panels, expand blocks, status, TOC-family macros, and search/navigation macros
- excerpt, excerpt-include, include-page, page-tree, page-tree-search, and page-index
- label/reporting/content-property/report-table/task-report families
- attachment preview and other common built-in macros
When a construct is unsupported or would be lossy, confluence-cli preserves the Confluence storage fragment instead of flattening the whole page.
Known Limits
- Storage fidelity is strongest for supported built-in macros and generic resource-aware macro fallback. Unknown provider-specific macro behavior can still vary between Cloud and Data Center.
- CI does not run live tenant e2e by default. Use
make test-e2eagainst a real instance for provider validation. applyrefuses remote version drift unless--forceis used.
License
MIT