Git-style CLI for bidirectional Confluence ↔ Markdown sync.
⚠️ Lossy conversion warning: This tool uses a simplified conversion and may drop or flatten complex Confluence constructs. It’s best for:
- Publishing simple Markdown docs to Confluence.
- Exporting Confluence pages to Markdown for agent/LLM consumption.
It is not well suited for round‑trip sync or editing complex Confluence pages that rely on rich macros or advanced formatting.
npm installSet credentials via environment variables (highest priority):
export CONFLUENCE_URL="https://company.atlassian.net"
export CONFLUENCE_EMAIL="user@company.com"
export CONFLUENCE_TOKEN="your-api-token"Or use ~/.confluence-md/credentials:
{
"profiles": {
"default": {
"url": "https://company.atlassian.net",
"email": "user@company.com",
"token": "your-api-token"
}
}
}# Dev mode (defaults to fake server creds at http://localhost:3000)
npm run dev -- clone "https://company.atlassian.net/wiki/spaces/PROJ/pages/123456789/My+Page"
# Clone a page or space
confluence-md clone "https://company.atlassian.net/wiki/spaces/PROJ/pages/123456789/My+Page"
# Pull updates
confluence-md pull
# Push local changes
confluence-md push
# Diff local vs remote
confluence-md diff
# Diff summary only
confluence-md diff --stat
# Sync markdown from a source repo into a cloned workspace
confluence-md sync /path/to/docs
# Prefix synced pages under a root path (avoids wrapper directories)
confluence-md sync /path/to/docs --prefix agent-workspaces
# For a single-page clone, root README/index maps to the root page
confluence-md sync /path/to/docs
# View history
confluence-md logUse this flow when your Git repo is the source of truth and Confluence is a published view. You manage docs in Git and re-publish to Confluence as needed.
- Create an empty root page in Confluence (UI) and copy its URL.
- Clone that page (includes sub-pages if any):
confluence-md clone "<root page url>" ./workspace
cd ./workspace- Sync your repo into the workspace and push:
confluence-md sync /path/to/repo
confluence-md push --new --prune-attachmentsconfluence-md sync /path/to/repo
confluence-md push --prune-attachmentsIf new files were added since last push, include --new once to create new pages.
confluence-md sync /path/to/repo --prune
confluence-md push --prune-pages --prune-attachmentsPreview changes (including deletions) with:
confluence-md push --dry-run --prune-pages --prune-attachmentsnpm run serverUse --port or --data to customize the server:
npm run server -- --port 8080 --data ./test-dataCreate a test page and get a ready-to-use clone URL:
npm run seed:page -- --space TEST --title "My Page"Optional flags:
--base-url(defaults toCONFLUENCE_URLorhttp://localhost:3000)--markdownor--markdown-file--email/--token(defaults toCONFLUENCE_EMAIL/CONFLUENCE_TOKEN)