confluence-markdown 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. confluence_markdown-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +52 -0
  2. confluence_markdown-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +29 -0
  3. confluence_markdown-0.1.0/.github/pull_request_template.md +18 -0
  4. confluence_markdown-0.1.0/.github/workflows/ci.yml +47 -0
  5. confluence_markdown-0.1.0/.github/workflows/docs.yml +30 -0
  6. confluence_markdown-0.1.0/.github/workflows/release.yml +42 -0
  7. confluence_markdown-0.1.0/.gitignore +58 -0
  8. confluence_markdown-0.1.0/.python-version +1 -0
  9. confluence_markdown-0.1.0/CHANGELOG.md +116 -0
  10. confluence_markdown-0.1.0/LICENSE +13 -0
  11. confluence_markdown-0.1.0/MARKETPLACE.md +193 -0
  12. confluence_markdown-0.1.0/PKG-INFO +748 -0
  13. confluence_markdown-0.1.0/README.md +710 -0
  14. confluence_markdown-0.1.0/RELEASE_NOTES.md +138 -0
  15. confluence_markdown-0.1.0/SECURITY.md +29 -0
  16. confluence_markdown-0.1.0/docs/index.md +59 -0
  17. confluence_markdown-0.1.0/docs/usage.md +537 -0
  18. confluence_markdown-0.1.0/mcp.json +155 -0
  19. confluence_markdown-0.1.0/mkdocs.yml +48 -0
  20. confluence_markdown-0.1.0/pyproject.toml +63 -0
  21. confluence_markdown-0.1.0/src/confluence_markdown/__init__.py +3 -0
  22. confluence_markdown-0.1.0/src/confluence_markdown/cache.py +173 -0
  23. confluence_markdown-0.1.0/src/confluence_markdown/cli.py +1014 -0
  24. confluence_markdown-0.1.0/src/confluence_markdown/client.py +2487 -0
  25. confluence_markdown-0.1.0/src/confluence_markdown/config.py +201 -0
  26. confluence_markdown-0.1.0/src/confluence_markdown/exceptions.py +45 -0
  27. confluence_markdown-0.1.0/src/confluence_markdown/main.py +12 -0
  28. confluence_markdown-0.1.0/src/confluence_markdown/mcp_server.py +634 -0
  29. confluence_markdown-0.1.0/tests/__init__.py +1 -0
  30. confluence_markdown-0.1.0/tests/test_main.py +502 -0
  31. confluence_markdown-0.1.0/tests/test_mcp_server.py +614 -0
  32. confluence_markdown-0.1.0/todos.md +16 -0
  33. confluence_markdown-0.1.0/uv.lock +1892 -0
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug
4
+ labels: bug
5
+ ---
6
+
7
+ ## Description
8
+
9
+ <!-- Brief description of the bug -->
10
+
11
+ ## Steps to Reproduce
12
+
13
+ ```bash
14
+ # Command that triggers the bug
15
+ confluence-markdown --action ...
16
+ ```
17
+
18
+ 1.
19
+ 2.
20
+ 3.
21
+
22
+ ## Expected Behavior
23
+
24
+ <!-- What should happen? -->
25
+
26
+ ## Actual Behavior
27
+
28
+ <!-- What happens instead? Paste the error message below -->
29
+
30
+ ```
31
+ error message here
32
+ ```
33
+
34
+ ## Environment
35
+
36
+ - OS:
37
+ - Python version: (`python --version`)
38
+ - Tool version: (`confluence-markdown --version`)
39
+ - Confluence Data Center version:
40
+
41
+ ## Verbose Output
42
+
43
+ <!-- Run with `--verbose` and paste the output below. Redact any credentials. -->
44
+
45
+ <details>
46
+ <summary>Verbose log</summary>
47
+
48
+ ```
49
+ confluence-markdown --verbose --action ...
50
+ ```
51
+
52
+ </details>
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a new feature
4
+ labels: enhancement
5
+ ---
6
+
7
+ ## Summary
8
+
9
+ <!-- Brief description of the requested feature -->
10
+
11
+ ## Problem / Motivation
12
+
13
+ <!-- What problem does this feature solve? -->
14
+
15
+ ## Proposed Solution
16
+
17
+ <!-- How should it work? Example usage: -->
18
+
19
+ ```bash
20
+ confluence-markdown --action ...
21
+ ```
22
+
23
+ ## Alternatives Considered
24
+
25
+ <!-- Have you considered other approaches? -->
26
+
27
+ ## Additional Context
28
+
29
+ <!-- Screenshots, links, related issues -->
@@ -0,0 +1,18 @@
1
+ ## Description
2
+
3
+ <!-- What was changed and why? -->
4
+
5
+ ## Type of Change
6
+
7
+ - [ ] Bug fix
8
+ - [ ] New feature
9
+ - [ ] Refactoring (no functional changes)
10
+ - [ ] Documentation
11
+ - [ ] Other
12
+
13
+ ## Checklist
14
+
15
+ - [ ] `uv run ruff check src/` — no errors
16
+ - [ ] `uv run pytest` — all tests pass
17
+ - [ ] CHANGELOG.md updated
18
+ - [ ] Documentation updated (if applicable)
@@ -0,0 +1,47 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: uv sync --all-extras
26
+
27
+ - name: Lint (ruff)
28
+ run: uv run ruff check src/
29
+
30
+ - name: Run tests
31
+ run: uv run pytest --tb=short -q
32
+
33
+ docs:
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+
38
+ - name: Install uv
39
+ uses: astral-sh/setup-uv@v5
40
+ with:
41
+ python-version: "3.12"
42
+
43
+ - name: Install dependencies
44
+ run: uv sync --all-extras
45
+
46
+ - name: Build docs
47
+ run: uv run mkdocs build --strict
@@ -0,0 +1,30 @@
1
+ name: Deploy Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "docs/**"
8
+ - "mkdocs.yml"
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: write
13
+
14
+ jobs:
15
+ deploy:
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v5
23
+ with:
24
+ python-version: "3.12"
25
+
26
+ - name: Install dependencies
27
+ run: uv sync --all-extras
28
+
29
+ - name: Deploy to GitHub Pages
30
+ run: uv run mkdocs gh-deploy --force
@@ -0,0 +1,42 @@
1
+ name: Release to PyPI and GitHub
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ packages: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v4
20
+ with:
21
+ python-version: '3.12'
22
+
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v2
25
+
26
+ - name: Build package
27
+ run: uv build
28
+
29
+ - name: Create GitHub Release
30
+ uses: softprops/action-gh-release@v1
31
+ with:
32
+ files: dist/*
33
+ body_path: RELEASE_NOTES.md
34
+ draft: false
35
+ prerelease: false
36
+ env:
37
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38
+
39
+ - name: Publish to PyPI
40
+ run: uv publish
41
+ env:
42
+ UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,58 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Testing and coverage
13
+ .coverage
14
+ .coverage.*
15
+ htmlcov/
16
+ .pytest_cache/
17
+ .tox/
18
+
19
+ # Test files
20
+ test-*.md
21
+
22
+ # IDE and editor
23
+ .vscode/
24
+ .idea/
25
+ *.swp
26
+ *.swo
27
+ *~
28
+
29
+ # Claude Code
30
+ .claude/
31
+
32
+ # Agent and LLM configuration (kept out of version control)
33
+ AGENTS.md
34
+ CLAUDE.md
35
+ GEMINI.md
36
+ .codex/
37
+ .cursor/
38
+ .cursorrules
39
+ .windsurfrules
40
+ .aider*
41
+ .gemini/
42
+ .antigravity/
43
+ .junie/
44
+ .mcp.json
45
+
46
+ # MkDocs build output
47
+ site/
48
+
49
+ # Internal work plans / implementation prompts (kept out of version control)
50
+ .plan/
51
+
52
+ # One-off scripts with credentials
53
+ add_*.py
54
+ create_*.py
55
+ setup_*.py
56
+ fix_*.py
57
+ update_*.py
58
+ convert_*.py
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,116 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [Unreleased] - 2026-06-22
6
+
7
+ ### Added
8
+
9
+ #### Confluence storage format (XHTML) mode
10
+
11
+ Support for Confluence **storage format** (Atlassian's official format), the
12
+ lossless XHTML representation used by Confluence's REST API
13
+ (`representation: "storage"`). Unlike Markdown, storage format is a pure
14
+ passthrough: tables with colspan/rowspan, macros (`ac:` elements), layouts,
15
+ and all Confluence-specific constructs are preserved exactly.
16
+
17
+ See the [Confluence storage format documentation](https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html).
18
+
19
+ **MCP server — new `*_storage` tool family (recommended for agents):**
20
+ - `get_page_storage` — returns raw storage XHTML (pretty-printed); use as input for the other storage write tools.
21
+ - `edit_page_storage` — replaces page body with storage XHTML; validates well-formedness before upload.
22
+ - `create_page_storage` — creates a new page with storage XHTML content.
23
+ - `add_content_storage` — appends/prepends storage XHTML to an existing page.
24
+
25
+ All storage write tools preserve the human-in-the-loop elicitation confirmation.
26
+
27
+ **New diagnostic tool:** `check_elicitation_support` — returns
28
+ `{"elicitation_supported": true/false}` so you can verify at runtime
29
+ whether the connected MCP client will trigger the write confirmation prompt.
30
+
31
+ The MCP server `instructions` now steer agents toward the `*_storage` tools as
32
+ the preferred choice for content operations.
33
+
34
+ **New MCP resource:** `confluence://page/{page_id}/storage` — exposes raw
35
+ storage XHTML as an MCP resource.
36
+
37
+ **CLI:** `--format {md,storage}` flag (default `md`) for `download` and `edit`
38
+ actions. `--format storage` downloads/edits pages in Confluence storage format
39
+ (XHTML, Atlassian's official format) without any Markdown conversion.
40
+
41
+ **New helpers in `ConfluenceClient`:**
42
+ - `_validate_storage_xhtml(html)` — validates well-formedness, normalises `<br>` and void elements, detects bare `&`; rejects malformed input locally before the API call.
43
+ - `_prettify_storage(html)` — pretty-prints storage XHTML while preserving significant whitespace in `<pre>`, `<ac:plain-text-body>`, and `<ac:plain-text-link-body>`.
44
+
45
+ ### Fixed
46
+
47
+ - `edit_page_with_editor` with `content_type="html"` (non-interactive mode)
48
+ previously converted storage XHTML to Markdown and back (`html→md→html`),
49
+ silently destroying tables and macros. It now validates and uploads the
50
+ storage XHTML directly.
51
+
52
+ ### Breaking Changes
53
+
54
+ The following MCP tool names have been renamed with a format suffix to make
55
+ room for the new `*_storage` variants. Update any MCP client configurations
56
+ that reference the old names:
57
+
58
+ | Old name | New name |
59
+ |---|---|
60
+ | `get_page` | `get_page_md` |
61
+ | `edit_page` | `edit_page_md` |
62
+ | `create_page` | `create_page_md` |
63
+ | `add_content_to_page` | `add_content_md` |
64
+
65
+ The old names are fully removed; no aliases are provided.
66
+
67
+ ## [0.1.0] - 2026-02-26
68
+
69
+ ### Added
70
+
71
+ #### Core Actions
72
+ - `read` - Read a specific Confluence page rendered in terminal with Rich
73
+ - `read-recent` - Browse recently viewed pages interactively
74
+ - `edit` - Edit a page in your preferred editor and push changes back
75
+ - `edit-recent` - Select from recently edited pages and edit
76
+ - `download` - Download a page as markdown file
77
+ - `add` - Append or prepend content (markdown or HTML) to a page
78
+ - `create` - Create a new page from content
79
+ - `create-edit` - Create a new page via editor
80
+ - `create-task` - Create a task page with Page Properties macro
81
+ - `search` - Search pages by text query or CQL
82
+ - `list-children` - List child pages (optionally recursive)
83
+ - `test-auth` - Verify authentication credentials
84
+
85
+ #### Navigation
86
+ - Interactive page selection via fzf (fuzzy finder) with fallback to InquirerPy
87
+ - `--no-fzf` flag to force InquirerPy selector
88
+
89
+ #### Table Support
90
+ - Complex tables with colspan/rowspan preserved as HTML during round-trips
91
+ - Meeting tables preserved as-is
92
+ - `--table-format yaml` option for easier editing of complex tables
93
+
94
+ #### Configuration
95
+ - Config file at `~/.config/confluence-markdown/config.json`
96
+ - Multiple named profiles (`--profile`)
97
+ - Per-space editor and table-format settings
98
+ - `--init-config` to generate an example config
99
+ - `--save-config` to persist credentials
100
+ - `--list-profiles` / `--delete-profile` management commands
101
+
102
+ #### Performance
103
+ - Response caching with configurable TTL (default: 1 hour)
104
+ - Parallel async API calls for batch operations (recursive download, list-children)
105
+ - Automatic retry with exponential backoff on rate limit errors
106
+
107
+ #### Quality of Life
108
+ - `--raw` flag for plain markdown output (scripting-friendly)
109
+ - `--quiet` / `--verbose` logging modes
110
+ - `--recursive` for recursive child page operations
111
+ - `--output-dir` for batch downloads
112
+ - Shell tab completion via argcomplete (bash/zsh)
113
+ - `--version` flag
114
+ - `--clear-cache` / `--no-cache` cache management
115
+
116
+ [0.1.0]: https://github.com/jvanvinkenroye/confluence_markdown/releases/tag/v0.1.0
@@ -0,0 +1,13 @@
1
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
+ Version 2, December 2004
3
+
4
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5
+
6
+ Everyone is permitted to copy and distribute verbatim or modified
7
+ copies of this license document, and changing it is allowed as long
8
+ as the name is changed.
9
+
10
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12
+
13
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
@@ -0,0 +1,193 @@
1
+ # Claude Code Marketplace Distribution
2
+
3
+ This document describes how to distribute `confluence-markdown-mcp` via the Claude Code Marketplace.
4
+
5
+ ## Prerequisites
6
+
7
+ 1. **GitHub Repository** (already set up at https://github.com/jvanvinkenroye/confluence_markdown)
8
+ 2. **PyPI Account** with API token for publishing Python packages
9
+ 3. **GitHub Secrets** configured:
10
+ - `PYPI_TOKEN`: Your PyPI API token (with scope "Entire account")
11
+
12
+ ## Setup GitHub Secrets
13
+
14
+ 1. Go to: https://github.com/jvanvinkenroye/confluence_markdown/settings/secrets/actions
15
+ 2. Add new secret:
16
+ - **Name:** `PYPI_TOKEN`
17
+ - **Value:** Your PyPI API token (from https://pypi.org/account/token/)
18
+
19
+ ## Creating a Release
20
+
21
+ ### 1. Update Version
22
+
23
+ Edit `pyproject.toml`:
24
+
25
+ ```toml
26
+ [project]
27
+ version = "0.2.0" # Bump version
28
+ ```
29
+
30
+ ### 2. Create Release Notes
31
+
32
+ Create/update `RELEASE_NOTES.md`:
33
+
34
+ ```markdown
35
+ # v0.2.0 — Enhanced MCP Server
36
+
37
+ ## Features
38
+
39
+ - ✨ New `*_storage` tools for lossless XHTML access
40
+ - ✨ Human-in-the-loop write confirmation (elicitation support)
41
+ - 🐛 Fixed colspan/rowspan preservation in tables
42
+ - 📚 Comprehensive documentation for Claude Code & Desktop
43
+
44
+ ## Installation
45
+
46
+ ### Claude Code / Desktop
47
+
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "confluence": {
52
+ "command": "uv",
53
+ "args": [
54
+ "--directory",
55
+ "/path/to/confluence_markdown",
56
+ "run",
57
+ "confluence-markdown-mcp"
58
+ ]
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ ### Command Line
65
+
66
+ ```bash
67
+ uvx --from "git+https://github.com/jvanvinkenroye/confluence_markdown.git@v0.2.0[mcp]" confluence-markdown-mcp
68
+ ```
69
+
70
+ ## Tools
71
+
72
+ 13 MCP tools available:
73
+ - Navigation: `list_spaces`, `list_recent_pages`, `search_pages`, `list_children`
74
+ - Read: `get_page_storage`, `get_page_md`
75
+ - Write: `create_page_*`, `edit_page_*`, `add_content_*`
76
+ - Diagnostic: `check_elicitation_support`
77
+
78
+ ## Resources
79
+
80
+ - `confluence://page/{page_id}` — Markdown view
81
+ - `confluence://page/{page_id}/storage` — XHTML view (lossless)
82
+
83
+ ## Known Issues
84
+
85
+ - Elicitation (write confirmation) not yet supported by all clients
86
+ - Some Confluence macros may cause 500 errors on older server versions
87
+
88
+ ## Contributors
89
+
90
+ - Jan Vanvinkenroye (@jvanvinkenroye)
91
+ ```
92
+
93
+ ### 3. Commit and Tag
94
+
95
+ ```bash
96
+ git add pyproject.toml RELEASE_NOTES.md
97
+ git commit -m "chore: prepare v0.2.0 release"
98
+ git tag -a v0.2.0 -m "Version 0.2.0: Enhanced MCP Server"
99
+ git push origin main --tags
100
+ ```
101
+
102
+ The GitHub Actions workflow will automatically:
103
+ 1. Build the Python package
104
+ 2. Create a GitHub Release with artifacts
105
+ 3. Publish to PyPI
106
+
107
+ ## Registering in Claude Code Marketplace
108
+
109
+ ### Step 1: Marketplace Registration (via Anthropic)
110
+
111
+ The Claude Code Marketplace is currently managed by Anthropic. To register:
112
+
113
+ 1. Create an issue in the [Claude Code Marketplace Registry](https://github.com/anthropics/claude-code-marketplace)
114
+ 2. Include:
115
+ - **Title:** `[New Tool] confluence-markdown-mcp`
116
+ - **Description:**
117
+ ```
118
+ MCP server for read/write access to Confluence Data Center pages
119
+
120
+ - GitHub: https://github.com/jvanvinkenroye/confluence_markdown
121
+ - PyPI: https://pypi.org/project/confluence-markdown/
122
+ - Features: Storage format (lossless), Markdown, 13 tools
123
+ ```
124
+ - **Manifest:** Link to `mcp.json` in your repo
125
+ - **Installation:** Command for users to install
126
+
127
+ ### Step 2: Prepare Documentation
128
+
129
+ Ensure your README includes:
130
+ - ✅ Clear installation instructions
131
+ - ✅ MCP server setup for Claude Code and Claude Desktop
132
+ - ✅ All available tools documented
133
+ - ✅ Usage examples
134
+ - ✅ Authentication setup
135
+ - ✅ Troubleshooting
136
+
137
+ All covered in `/README.md`.
138
+
139
+ ### Step 3: Marketplace Listing
140
+
141
+ Once approved, the tool will appear in Claude Code's marketplace with:
142
+ - **Name:** confluence-markdown-mcp
143
+ - **Description:** Read and write Confluence pages from Claude
144
+ - **Installation:** One-click install (configured from `mcp.json`)
145
+ - **Authentication:** Guided setup for Confluence credentials
146
+
147
+ ## Distribution Channels
148
+
149
+ ### Users Can Install Via:
150
+
151
+ 1. **PyPI / uvx** (manual command):
152
+ ```bash
153
+ uvx --from "git+https://github.com/jvanvinkenroye/confluence_markdown.git[mcp]" confluence-markdown-mcp
154
+ ```
155
+
156
+ 2. **Claude Code Marketplace** (one-click, if approved):
157
+ - Search "confluence-markdown"
158
+ - Click "Install"
159
+ - Follow credential setup
160
+
161
+ 3. **Direct GitHub** (development):
162
+ ```bash
163
+ git clone https://github.com/jvanvinkenroye/confluence_markdown.git
164
+ cd confluence_markdown
165
+ uv pip install -e ".[mcp]"
166
+ ```
167
+
168
+ 4. **Homebrew** (optional, future):
169
+ ```bash
170
+ brew install confluence-markdown-mcp
171
+ ```
172
+
173
+ ## Update Process
174
+
175
+ 1. Make changes in a branch
176
+ 2. Update version in `pyproject.toml`
177
+ 3. Update `RELEASE_NOTES.md`
178
+ 4. Commit and push
179
+ 5. Create git tag (`v0.2.0`)
180
+ 6. Push tag: `git push origin v0.2.0`
181
+ 7. GitHub Actions builds, tests, and publishes automatically
182
+
183
+ ## Versioning
184
+
185
+ Follow [Semantic Versioning](https://semver.org/):
186
+ - `MAJOR.MINOR.PATCH`
187
+ - Example: `0.2.1` → `0.2.2` (patch fix), `0.3.0` (new features), `1.0.0` (stable release)
188
+
189
+ ## Support
190
+
191
+ - **Issues:** GitHub Issues (https://github.com/jvanvinkenroye/confluence_markdown/issues)
192
+ - **Discussions:** GitHub Discussions (enable in repo settings)
193
+ - **Documentation:** README.md and inline docstrings