docspecbridge 0.2.0b1__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.
@@ -0,0 +1,85 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ build:
10
+ name: Build and validate distributions
11
+ runs-on: ubuntu-latest
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ steps:
17
+ - name: Checkout repository
18
+ uses: actions/checkout@v4
19
+ with:
20
+ persist-credentials: false
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v6
24
+ with:
25
+ enable-cache: true
26
+
27
+ - name: Install Python 3.14
28
+ run: uv python install 3.14
29
+
30
+ - name: Check tag matches package version
31
+ shell: bash
32
+ run: |
33
+ VERSION=$(uv run --python 3.14 --no-project python -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')
34
+ TAG_VERSION="${GITHUB_REF_NAME#v}"
35
+ echo "pyproject.toml version: $VERSION"
36
+ echo "Git tag version: $TAG_VERSION"
37
+ test "$VERSION" = "$TAG_VERSION"
38
+
39
+ - name: Build distributions
40
+ run: uv build --no-sources
41
+
42
+ - name: Validate distributions
43
+ run: uvx twine check dist/*
44
+
45
+ - name: Smoke test built wheel
46
+ shell: bash
47
+ run: |
48
+ WHEEL=$(find dist -maxdepth 1 -type f -name '*.whl' -print -quit)
49
+ test -n "$WHEEL"
50
+ echo "Testing wheel: $WHEEL"
51
+ uv run --python 3.14 --isolated --no-project --with "$WHEEL" docspecbridge doctor
52
+
53
+ - name: Upload validated distributions
54
+ uses: actions/upload-artifact@v4
55
+ with:
56
+ name: pypi-dist
57
+ path: dist/
58
+ if-no-files-found: error
59
+ retention-days: 7
60
+
61
+ publish:
62
+ name: Publish validated distributions to PyPI
63
+ needs: build
64
+ runs-on: ubuntu-latest
65
+
66
+ permissions:
67
+ contents: read
68
+
69
+ steps:
70
+ - name: Install uv
71
+ uses: astral-sh/setup-uv@v6
72
+ with:
73
+ enable-cache: false
74
+
75
+ - name: Download validated distributions
76
+ uses: actions/download-artifact@v4
77
+ with:
78
+ name: pypi-dist
79
+ path: dist/
80
+
81
+ - name: Publish to PyPI
82
+ run: uvx twine upload dist/*
83
+ env:
84
+ TWINE_USERNAME: __token__
85
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,47 @@
1
+ # Python virtual environments
2
+ .venv/
3
+ venv/
4
+ env/
5
+
6
+ # Python caches / tooling
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+ .pytest_cache/
11
+ .ruff_cache/
12
+ .mypy_cache/
13
+ .coverage
14
+ .coverage.*
15
+ htmlcov/
16
+
17
+ # Build / packaging artifacts
18
+ build/
19
+ dist/
20
+ *.egg-info/
21
+ .eggs/
22
+
23
+ # Local DocSpecBridge configuration / secrets
24
+ docspecbridge.yaml
25
+ docspecbridge.yml
26
+ .env
27
+ .env.*
28
+ !.env.example
29
+
30
+ # Local source documents and generated corpus
31
+ # Keep only the harmless placeholder README in input/ if present.
32
+ input/*
33
+ !input/README.txt
34
+ output/
35
+
36
+ # Logs / temporary files
37
+ *.log
38
+ *.tmp
39
+ *.bak
40
+ ~$*
41
+
42
+ # IDE / OS noise
43
+ .vscode/
44
+ .idea/
45
+ .DS_Store
46
+ Thumbs.db
47
+ Desktop.ini
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.5
2
+ Name: docspecbridge
3
+ Version: 0.2.0b1
4
+ Summary: Document ETL bridge: Office/PDF -> Markdown + images -> Confluence/RAG-ready packages
5
+ Author: DocSpecBridge contributors
6
+ License: MIT
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: httpx<1,>=0.28
9
+ Requires-Dist: markdown-to-confluence==0.6.3
10
+ Requires-Dist: pillow<13,>=11.3
11
+ Requires-Dist: pymupdf<2,>=1.26
12
+ Requires-Dist: python-pptx<2,>=1.0.2
13
+ Requires-Dist: pyyaml<7,>=6.0.2
14
+ Requires-Dist: rich<15,>=14
15
+ Requires-Dist: typer<1,>=0.16
16
+ Requires-Dist: xberg==1.0.14
17
+ Description-Content-Type: text/markdown
18
+
19
+ # DocSpecBridge 0.2.0b1 (Beta)
20
+
21
+ DocSpecBridge is a Python document ETL bridge:
22
+
23
+ ```text
24
+ DOCX / PDF / PPTX
25
+ |
26
+ v
27
+ Xberg
28
+ |
29
+ +--> normalized source assets + source geometry
30
+ |
31
+ +--> publication Markdown --> md2conf --> Confluence Cloud
32
+ |
33
+ +--> RAG Markdown + chunks.jsonl
34
+ ```
35
+
36
+ The 0.2.0b1 release separates **publication fidelity** from **RAG efficiency**. Layout metadata is never injected into RAG text; it is stored in JSON and used to build publication-specific image variants.
37
+
38
+ ## 1. Installation with uv
39
+
40
+ Python 3.14.7 is recommended for the current POC.
41
+
42
+ ```powershell
43
+ cd C:\DEV\docspecbridge
44
+ uv venv --python 3.14.7
45
+ .\.venv\Scripts\Activate.ps1
46
+ uv sync
47
+ uv run docspecbridge doctor
48
+ ```
49
+
50
+ `uv.lock` should be committed once generated. `.venv/` must stay in `.gitignore`.
51
+
52
+ ## 2. First extraction
53
+
54
+ Interactive:
55
+
56
+ ```powershell
57
+ uv run docspecbridge
58
+ ```
59
+
60
+ CLI:
61
+
62
+ ```powershell
63
+ uv run docspecbridge extract `
64
+ --source "C:\MD\input" `
65
+ --dest "C:\MD\output"
66
+ ```
67
+
68
+ A package is created per source and the extension is part of the package name to avoid collisions:
69
+
70
+ ```text
71
+ output/
72
+ ├── specification__docx/
73
+ │ ├── specification.docx
74
+ │ ├── specification.md
75
+ │ ├── specification.rag.md
76
+ │ ├── specification.raw.md
77
+ │ ├── images/
78
+ │ ├── publication_images/
79
+ │ ├── manifest.json
80
+ │ ├── document.json
81
+ │ ├── rag.json
82
+ │ └── chunks.jsonl
83
+ └── specification__pdf/
84
+ └── ...
85
+ ```
86
+
87
+ ### Files
88
+
89
+ - `*.md`: publication/human Markdown. Images can point to display-sized raster derivatives.
90
+ - `*.rag.md`: lean Markdown for RAG. No x/y/width/height metadata is written in the text.
91
+ - `*.raw.md`: raw Xberg Markdown for diagnostics/comparison.
92
+ - `images/`: canonical extracted images, kept at the extraction quality for RAG/multimodal use.
93
+ - `publication_images/`: display-size derivatives used by publication Markdown when source geometry is known.
94
+ - `manifest.json`: provenance, assets, geometry, fidelity warnings, output paths.
95
+ - `document.json`: structured technical metadata without binary payloads.
96
+ - `chunks.jsonl`: heading-aware RAG chunks.
97
+ - `rag.json`: portable descriptor for a future vector/RAG publisher.
98
+
99
+ ## 3. Image size and geometry
100
+
101
+ DocSpecBridge 0.2.0b1 treats image display geometry as a cross-format concern:
102
+
103
+ - **PPTX**: picture shape `left/top/width/height` through `python-pptx`.
104
+ - **DOCX**: DrawingML/VML image extents from OOXML, including headers/footers where available.
105
+ - **PDF**: image rectangles through PyMuPDF.
106
+
107
+ The source geometry is stored in JSON, not in RAG Markdown.
108
+
109
+ For publication, DocSpecBridge can create a raster derivative close to the source display size. This prevents small PowerPoint icons from becoming giant images in Markdown/Confluence while keeping the original high-resolution image in `images/` for RAG.
110
+
111
+ This is still **best effort**. The same binary image can be reused at different sizes in a source; DocSpecBridge maps successive Markdown occurrences to successive source display occurrences where possible.
112
+
113
+ ## 4. Vector content
114
+
115
+ DOCX/PPTX OOXML connectors, grouped shapes, charts, SmartArt/diagram markers and VML shapes are detected and reported in `manifest.json`.
116
+
117
+ PDF vector drawing operations are counted through PyMuPDF.
118
+
119
+ 0.2.0b1 does **not** yet rasterize arbitrary vector groups automatically. When vector graphics are detected, the fidelity status is marked `partial` and a warning is emitted. This is the next fallback to implement after qualification on real documents.
120
+
121
+ ## 5. Publication profile vs RAG profile
122
+
123
+ `docspecbridge.yaml` contains two independent profiles.
124
+
125
+ ```yaml
126
+ profiles:
127
+ publication:
128
+ enabled: true
129
+ preserve_image_display_size: true
130
+
131
+ rag:
132
+ enabled: true
133
+ keep_image_references: true
134
+ include_header_images: false
135
+ include_footer_images: false
136
+ chunking:
137
+ enabled: true
138
+ max_characters: 1600
139
+ overlap: 150
140
+ ```
141
+
142
+ The RAG profile is intentionally conservative: no rewriting/paraphrasing and no aggressive token reduction. Headings, lists, tables, constraints and image references are kept. Repetitive presentation artifacts can be excluded while the original information remains available in the source, raw Markdown and JSON metadata.
143
+
144
+ ## 6. YAML configuration menu
145
+
146
+ 0.1.x could **read** a YAML file but had no editor. 0.2.0b1 adds one.
147
+
148
+ ```powershell
149
+ uv run docspecbridge config
150
+ ```
151
+
152
+ or in the main menu:
153
+
154
+ ```text
155
+ [5] Configuration YAML
156
+ ```
157
+
158
+ The menu can edit:
159
+
160
+ - source/destination/extensions;
161
+ - recursive extraction;
162
+ - publication and RAG profile switches;
163
+ - chunk sizes;
164
+ - multiple Confluence Cloud instances;
165
+ - the default Confluence instance.
166
+
167
+ No PAT/token value is stored in YAML; only the environment variable name is stored.
168
+
169
+ ## 7. Multiple Confluence Cloud instances
170
+
171
+ 0.2.0b1 targets **Confluence Cloud only** and uses REST API v2.
172
+
173
+ Example:
174
+
175
+ ```yaml
176
+ confluence:
177
+ default_instance: "production"
178
+ instances:
179
+ production:
180
+ domain: "company.atlassian.net"
181
+ user_name: "user@example.com"
182
+ token_env: "ATLASSIAN_API_TOKEN"
183
+ default_space: "DOC"
184
+ root_page: ""
185
+
186
+ sandbox:
187
+ domain: "company-sandbox.atlassian.net"
188
+ user_name: "user@example.com"
189
+ token_env: "ATLASSIAN_SANDBOX_API_TOKEN"
190
+ default_space: "TEST"
191
+ root_page: ""
192
+ ```
193
+
194
+ Then:
195
+
196
+ ```powershell
197
+ $env:ATLASSIAN_API_TOKEN="..."
198
+ $env:ATLASSIAN_SANDBOX_API_TOKEN="..."
199
+
200
+ uv run docspecbridge spaces --instance production
201
+ uv run docspecbridge spaces --instance sandbox
202
+ ```
203
+
204
+ Publication:
205
+
206
+ ```powershell
207
+ uv run docspecbridge publish `
208
+ --instance production `
209
+ --source ".\output\specification__docx" `
210
+ --space DOC `
211
+ --parent 123456789
212
+ ```
213
+
214
+ The interactive publication menu first asks for the configured instance, then loads the spaces visible with that instance/token.
215
+
216
+ DocSpecBridge publishes the **publication Markdown**, never the RAG Markdown. Local publication images are uploaded by `markdown-to-confluence` as Confluence page attachments and displayed inline.
217
+
218
+ ## 8. Configuration file
219
+
220
+ Copy the example:
221
+
222
+ ```powershell
223
+ Copy-Item config.example.yaml docspecbridge.yaml
224
+ ```
225
+
226
+ `docspecbridge.yaml` is intentionally ignored by Git because it contains local paths and account identifiers. `config.example.yaml` belongs in Git.
227
+
228
+ Legacy 0.1.x YAML with a single `confluence:` endpoint and a top-level `rag:` section is migrated in memory when loaded.
229
+
230
+ ## 9. Useful commands
231
+
232
+ ```powershell
233
+ uv run docspecbridge doctor
234
+ uv run docspecbridge config
235
+ uv run docspecbridge extract --source .\input --dest .\output
236
+ uv run docspecbridge spaces --instance production
237
+ uv run docspecbridge publish --instance production --source .\output\mydoc__docx --space DOC
238
+ ```
239
+
240
+ ## 10. Mermaid
241
+
242
+ The configuration keeps a `render_mermaid` switch because `markdown-to-confluence` already has Mermaid support. DocSpecBridge 0.2.0b1 does not yet attempt to transform legacy diagrams/images into Mermaid. That remains an enrichment stage for a later version.
@@ -0,0 +1,224 @@
1
+ # DocSpecBridge 0.2.0b1 (Beta)
2
+
3
+ DocSpecBridge is a Python document ETL bridge:
4
+
5
+ ```text
6
+ DOCX / PDF / PPTX
7
+ |
8
+ v
9
+ Xberg
10
+ |
11
+ +--> normalized source assets + source geometry
12
+ |
13
+ +--> publication Markdown --> md2conf --> Confluence Cloud
14
+ |
15
+ +--> RAG Markdown + chunks.jsonl
16
+ ```
17
+
18
+ The 0.2.0b1 release separates **publication fidelity** from **RAG efficiency**. Layout metadata is never injected into RAG text; it is stored in JSON and used to build publication-specific image variants.
19
+
20
+ ## 1. Installation with uv
21
+
22
+ Python 3.14.7 is recommended for the current POC.
23
+
24
+ ```powershell
25
+ cd C:\DEV\docspecbridge
26
+ uv venv --python 3.14.7
27
+ .\.venv\Scripts\Activate.ps1
28
+ uv sync
29
+ uv run docspecbridge doctor
30
+ ```
31
+
32
+ `uv.lock` should be committed once generated. `.venv/` must stay in `.gitignore`.
33
+
34
+ ## 2. First extraction
35
+
36
+ Interactive:
37
+
38
+ ```powershell
39
+ uv run docspecbridge
40
+ ```
41
+
42
+ CLI:
43
+
44
+ ```powershell
45
+ uv run docspecbridge extract `
46
+ --source "C:\MD\input" `
47
+ --dest "C:\MD\output"
48
+ ```
49
+
50
+ A package is created per source and the extension is part of the package name to avoid collisions:
51
+
52
+ ```text
53
+ output/
54
+ ├── specification__docx/
55
+ │ ├── specification.docx
56
+ │ ├── specification.md
57
+ │ ├── specification.rag.md
58
+ │ ├── specification.raw.md
59
+ │ ├── images/
60
+ │ ├── publication_images/
61
+ │ ├── manifest.json
62
+ │ ├── document.json
63
+ │ ├── rag.json
64
+ │ └── chunks.jsonl
65
+ └── specification__pdf/
66
+ └── ...
67
+ ```
68
+
69
+ ### Files
70
+
71
+ - `*.md`: publication/human Markdown. Images can point to display-sized raster derivatives.
72
+ - `*.rag.md`: lean Markdown for RAG. No x/y/width/height metadata is written in the text.
73
+ - `*.raw.md`: raw Xberg Markdown for diagnostics/comparison.
74
+ - `images/`: canonical extracted images, kept at the extraction quality for RAG/multimodal use.
75
+ - `publication_images/`: display-size derivatives used by publication Markdown when source geometry is known.
76
+ - `manifest.json`: provenance, assets, geometry, fidelity warnings, output paths.
77
+ - `document.json`: structured technical metadata without binary payloads.
78
+ - `chunks.jsonl`: heading-aware RAG chunks.
79
+ - `rag.json`: portable descriptor for a future vector/RAG publisher.
80
+
81
+ ## 3. Image size and geometry
82
+
83
+ DocSpecBridge 0.2.0b1 treats image display geometry as a cross-format concern:
84
+
85
+ - **PPTX**: picture shape `left/top/width/height` through `python-pptx`.
86
+ - **DOCX**: DrawingML/VML image extents from OOXML, including headers/footers where available.
87
+ - **PDF**: image rectangles through PyMuPDF.
88
+
89
+ The source geometry is stored in JSON, not in RAG Markdown.
90
+
91
+ For publication, DocSpecBridge can create a raster derivative close to the source display size. This prevents small PowerPoint icons from becoming giant images in Markdown/Confluence while keeping the original high-resolution image in `images/` for RAG.
92
+
93
+ This is still **best effort**. The same binary image can be reused at different sizes in a source; DocSpecBridge maps successive Markdown occurrences to successive source display occurrences where possible.
94
+
95
+ ## 4. Vector content
96
+
97
+ DOCX/PPTX OOXML connectors, grouped shapes, charts, SmartArt/diagram markers and VML shapes are detected and reported in `manifest.json`.
98
+
99
+ PDF vector drawing operations are counted through PyMuPDF.
100
+
101
+ 0.2.0b1 does **not** yet rasterize arbitrary vector groups automatically. When vector graphics are detected, the fidelity status is marked `partial` and a warning is emitted. This is the next fallback to implement after qualification on real documents.
102
+
103
+ ## 5. Publication profile vs RAG profile
104
+
105
+ `docspecbridge.yaml` contains two independent profiles.
106
+
107
+ ```yaml
108
+ profiles:
109
+ publication:
110
+ enabled: true
111
+ preserve_image_display_size: true
112
+
113
+ rag:
114
+ enabled: true
115
+ keep_image_references: true
116
+ include_header_images: false
117
+ include_footer_images: false
118
+ chunking:
119
+ enabled: true
120
+ max_characters: 1600
121
+ overlap: 150
122
+ ```
123
+
124
+ The RAG profile is intentionally conservative: no rewriting/paraphrasing and no aggressive token reduction. Headings, lists, tables, constraints and image references are kept. Repetitive presentation artifacts can be excluded while the original information remains available in the source, raw Markdown and JSON metadata.
125
+
126
+ ## 6. YAML configuration menu
127
+
128
+ 0.1.x could **read** a YAML file but had no editor. 0.2.0b1 adds one.
129
+
130
+ ```powershell
131
+ uv run docspecbridge config
132
+ ```
133
+
134
+ or in the main menu:
135
+
136
+ ```text
137
+ [5] Configuration YAML
138
+ ```
139
+
140
+ The menu can edit:
141
+
142
+ - source/destination/extensions;
143
+ - recursive extraction;
144
+ - publication and RAG profile switches;
145
+ - chunk sizes;
146
+ - multiple Confluence Cloud instances;
147
+ - the default Confluence instance.
148
+
149
+ No PAT/token value is stored in YAML; only the environment variable name is stored.
150
+
151
+ ## 7. Multiple Confluence Cloud instances
152
+
153
+ 0.2.0b1 targets **Confluence Cloud only** and uses REST API v2.
154
+
155
+ Example:
156
+
157
+ ```yaml
158
+ confluence:
159
+ default_instance: "production"
160
+ instances:
161
+ production:
162
+ domain: "company.atlassian.net"
163
+ user_name: "user@example.com"
164
+ token_env: "ATLASSIAN_API_TOKEN"
165
+ default_space: "DOC"
166
+ root_page: ""
167
+
168
+ sandbox:
169
+ domain: "company-sandbox.atlassian.net"
170
+ user_name: "user@example.com"
171
+ token_env: "ATLASSIAN_SANDBOX_API_TOKEN"
172
+ default_space: "TEST"
173
+ root_page: ""
174
+ ```
175
+
176
+ Then:
177
+
178
+ ```powershell
179
+ $env:ATLASSIAN_API_TOKEN="..."
180
+ $env:ATLASSIAN_SANDBOX_API_TOKEN="..."
181
+
182
+ uv run docspecbridge spaces --instance production
183
+ uv run docspecbridge spaces --instance sandbox
184
+ ```
185
+
186
+ Publication:
187
+
188
+ ```powershell
189
+ uv run docspecbridge publish `
190
+ --instance production `
191
+ --source ".\output\specification__docx" `
192
+ --space DOC `
193
+ --parent 123456789
194
+ ```
195
+
196
+ The interactive publication menu first asks for the configured instance, then loads the spaces visible with that instance/token.
197
+
198
+ DocSpecBridge publishes the **publication Markdown**, never the RAG Markdown. Local publication images are uploaded by `markdown-to-confluence` as Confluence page attachments and displayed inline.
199
+
200
+ ## 8. Configuration file
201
+
202
+ Copy the example:
203
+
204
+ ```powershell
205
+ Copy-Item config.example.yaml docspecbridge.yaml
206
+ ```
207
+
208
+ `docspecbridge.yaml` is intentionally ignored by Git because it contains local paths and account identifiers. `config.example.yaml` belongs in Git.
209
+
210
+ Legacy 0.1.x YAML with a single `confluence:` endpoint and a top-level `rag:` section is migrated in memory when loaded.
211
+
212
+ ## 9. Useful commands
213
+
214
+ ```powershell
215
+ uv run docspecbridge doctor
216
+ uv run docspecbridge config
217
+ uv run docspecbridge extract --source .\input --dest .\output
218
+ uv run docspecbridge spaces --instance production
219
+ uv run docspecbridge publish --instance production --source .\output\mydoc__docx --space DOC
220
+ ```
221
+
222
+ ## 10. Mermaid
223
+
224
+ The configuration keeps a `render_mermaid` switch because `markdown-to-confluence` already has Mermaid support. DocSpecBridge 0.2.0b1 does not yet attempt to transform legacy diagrams/images into Mermaid. That remains an enrichment stage for a later version.