@xberg-io/opencode-xberg 1.3.7 → 1.3.11
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.
- package/.opencode/ai-rulez-bundle.json +52 -0
- package/.opencode/ai-rulez-content.js +167 -0
- package/.opencode/commands/xberg-extract.md +14 -0
- package/.opencode/commands/xberg-ocr.md +14 -0
- package/.opencode/plugins/xberg.js +75 -62
- package/.opencode/skills/xberg/SKILL.md +422 -0
- package/.opencode/skills/xberg/index.md +10 -0
- package/.opencode/skills/xberg/references/advanced-features.md +628 -0
- package/.opencode/skills/xberg/references/cli-reference.md +462 -0
- package/.opencode/skills/xberg/references/configuration.md +587 -0
- package/.opencode/skills/xberg/references/nodejs-api.md +485 -0
- package/.opencode/skills/xberg/references/other-bindings.md +345 -0
- package/.opencode/skills/xberg/references/python-api.md +657 -0
- package/.opencode/skills/xberg/references/rust-api.md +412 -0
- package/.opencode/skills/xberg/references/supported-formats.md +252 -0
- package/.opencode/skills/xberg-batch-extraction/SKILL.md +170 -0
- package/.opencode/skills/xberg-batch-extraction/index.md +10 -0
- package/.opencode/skills/xberg-batch-extraction/references/advanced-features.md +628 -0
- package/.opencode/skills/xberg-batch-extraction/references/cli-reference.md +462 -0
- package/.opencode/skills/xberg-batch-extraction/references/configuration.md +587 -0
- package/.opencode/skills/xberg-batch-extraction/references/nodejs-api.md +485 -0
- package/.opencode/skills/xberg-batch-extraction/references/other-bindings.md +345 -0
- package/.opencode/skills/xberg-batch-extraction/references/python-api.md +657 -0
- package/.opencode/skills/xberg-batch-extraction/references/rust-api.md +412 -0
- package/.opencode/skills/xberg-batch-extraction/references/supported-formats.md +252 -0
- package/.opencode/skills/xberg-chunking/SKILL.md +163 -0
- package/.opencode/skills/xberg-chunking/index.md +10 -0
- package/.opencode/skills/xberg-chunking/references/advanced-features.md +628 -0
- package/.opencode/skills/xberg-chunking/references/cli-reference.md +462 -0
- package/.opencode/skills/xberg-chunking/references/configuration.md +587 -0
- package/.opencode/skills/xberg-chunking/references/nodejs-api.md +485 -0
- package/.opencode/skills/xberg-chunking/references/other-bindings.md +345 -0
- package/.opencode/skills/xberg-chunking/references/python-api.md +657 -0
- package/.opencode/skills/xberg-chunking/references/rust-api.md +412 -0
- package/.opencode/skills/xberg-chunking/references/supported-formats.md +252 -0
- package/.opencode/skills/xberg-extracting-keywords/SKILL.md +170 -0
- package/.opencode/skills/xberg-extracting-keywords/index.md +10 -0
- package/.opencode/skills/xberg-extracting-keywords/references/advanced-features.md +628 -0
- package/.opencode/skills/xberg-extracting-keywords/references/cli-reference.md +462 -0
- package/.opencode/skills/xberg-extracting-keywords/references/configuration.md +587 -0
- package/.opencode/skills/xberg-extracting-keywords/references/nodejs-api.md +485 -0
- package/.opencode/skills/xberg-extracting-keywords/references/other-bindings.md +345 -0
- package/.opencode/skills/xberg-extracting-keywords/references/python-api.md +657 -0
- package/.opencode/skills/xberg-extracting-keywords/references/rust-api.md +412 -0
- package/.opencode/skills/xberg-extracting-keywords/references/supported-formats.md +252 -0
- package/.opencode/skills/xberg-extracting-tables/SKILL.md +155 -0
- package/.opencode/skills/xberg-extracting-tables/index.md +10 -0
- package/.opencode/skills/xberg-extracting-tables/references/advanced-features.md +628 -0
- package/.opencode/skills/xberg-extracting-tables/references/cli-reference.md +462 -0
- package/.opencode/skills/xberg-extracting-tables/references/configuration.md +587 -0
- package/.opencode/skills/xberg-extracting-tables/references/nodejs-api.md +485 -0
- package/.opencode/skills/xberg-extracting-tables/references/other-bindings.md +345 -0
- package/.opencode/skills/xberg-extracting-tables/references/python-api.md +657 -0
- package/.opencode/skills/xberg-extracting-tables/references/rust-api.md +412 -0
- package/.opencode/skills/xberg-extracting-tables/references/supported-formats.md +252 -0
- package/.opencode/skills/xberg-extracting-with-ocr/SKILL.md +129 -0
- package/.opencode/skills/xberg-extracting-with-ocr/index.md +10 -0
- package/.opencode/skills/xberg-extracting-with-ocr/references/advanced-features.md +628 -0
- package/.opencode/skills/xberg-extracting-with-ocr/references/cli-reference.md +462 -0
- package/.opencode/skills/xberg-extracting-with-ocr/references/configuration.md +587 -0
- package/.opencode/skills/xberg-extracting-with-ocr/references/nodejs-api.md +485 -0
- package/.opencode/skills/xberg-extracting-with-ocr/references/other-bindings.md +345 -0
- package/.opencode/skills/xberg-extracting-with-ocr/references/python-api.md +657 -0
- package/.opencode/skills/xberg-extracting-with-ocr/references/rust-api.md +412 -0
- package/.opencode/skills/xberg-extracting-with-ocr/references/supported-formats.md +252 -0
- package/.opencode/skills/xberg-picking-a-format/SKILL.md +104 -0
- package/.opencode/skills/xberg-picking-a-format/index.md +10 -0
- package/.opencode/skills/xberg-picking-a-format/references/advanced-features.md +628 -0
- package/.opencode/skills/xberg-picking-a-format/references/cli-reference.md +462 -0
- package/.opencode/skills/xberg-picking-a-format/references/configuration.md +587 -0
- package/.opencode/skills/xberg-picking-a-format/references/nodejs-api.md +485 -0
- package/.opencode/skills/xberg-picking-a-format/references/other-bindings.md +345 -0
- package/.opencode/skills/xberg-picking-a-format/references/python-api.md +657 -0
- package/.opencode/skills/xberg-picking-a-format/references/rust-api.md +412 -0
- package/.opencode/skills/xberg-picking-a-format/references/supported-formats.md +252 -0
- package/.pi/prompts/xberg-extract.md +14 -0
- package/.pi/prompts/xberg-ocr.md +14 -0
- package/.pi/skills/xberg/SKILL.md +422 -0
- package/.pi/skills/xberg/index.md +10 -0
- package/.pi/skills/xberg/references/advanced-features.md +628 -0
- package/.pi/skills/xberg/references/cli-reference.md +462 -0
- package/.pi/skills/xberg/references/configuration.md +587 -0
- package/.pi/skills/xberg/references/nodejs-api.md +485 -0
- package/.pi/skills/xberg/references/other-bindings.md +345 -0
- package/.pi/skills/xberg/references/python-api.md +657 -0
- package/.pi/skills/xberg/references/rust-api.md +412 -0
- package/.pi/skills/xberg/references/supported-formats.md +252 -0
- package/.pi/skills/xberg-batch-extraction/SKILL.md +170 -0
- package/.pi/skills/xberg-batch-extraction/index.md +10 -0
- package/.pi/skills/xberg-batch-extraction/references/advanced-features.md +628 -0
- package/.pi/skills/xberg-batch-extraction/references/cli-reference.md +462 -0
- package/.pi/skills/xberg-batch-extraction/references/configuration.md +587 -0
- package/.pi/skills/xberg-batch-extraction/references/nodejs-api.md +485 -0
- package/.pi/skills/xberg-batch-extraction/references/other-bindings.md +345 -0
- package/.pi/skills/xberg-batch-extraction/references/python-api.md +657 -0
- package/.pi/skills/xberg-batch-extraction/references/rust-api.md +412 -0
- package/.pi/skills/xberg-batch-extraction/references/supported-formats.md +252 -0
- package/.pi/skills/xberg-chunking/SKILL.md +163 -0
- package/.pi/skills/xberg-chunking/index.md +10 -0
- package/.pi/skills/xberg-chunking/references/advanced-features.md +628 -0
- package/.pi/skills/xberg-chunking/references/cli-reference.md +462 -0
- package/.pi/skills/xberg-chunking/references/configuration.md +587 -0
- package/.pi/skills/xberg-chunking/references/nodejs-api.md +485 -0
- package/.pi/skills/xberg-chunking/references/other-bindings.md +345 -0
- package/.pi/skills/xberg-chunking/references/python-api.md +657 -0
- package/.pi/skills/xberg-chunking/references/rust-api.md +412 -0
- package/.pi/skills/xberg-chunking/references/supported-formats.md +252 -0
- package/.pi/skills/xberg-extracting-keywords/SKILL.md +170 -0
- package/.pi/skills/xberg-extracting-keywords/index.md +10 -0
- package/.pi/skills/xberg-extracting-keywords/references/advanced-features.md +628 -0
- package/.pi/skills/xberg-extracting-keywords/references/cli-reference.md +462 -0
- package/.pi/skills/xberg-extracting-keywords/references/configuration.md +587 -0
- package/.pi/skills/xberg-extracting-keywords/references/nodejs-api.md +485 -0
- package/.pi/skills/xberg-extracting-keywords/references/other-bindings.md +345 -0
- package/.pi/skills/xberg-extracting-keywords/references/python-api.md +657 -0
- package/.pi/skills/xberg-extracting-keywords/references/rust-api.md +412 -0
- package/.pi/skills/xberg-extracting-keywords/references/supported-formats.md +252 -0
- package/.pi/skills/xberg-extracting-tables/SKILL.md +155 -0
- package/.pi/skills/xberg-extracting-tables/index.md +10 -0
- package/.pi/skills/xberg-extracting-tables/references/advanced-features.md +628 -0
- package/.pi/skills/xberg-extracting-tables/references/cli-reference.md +462 -0
- package/.pi/skills/xberg-extracting-tables/references/configuration.md +587 -0
- package/.pi/skills/xberg-extracting-tables/references/nodejs-api.md +485 -0
- package/.pi/skills/xberg-extracting-tables/references/other-bindings.md +345 -0
- package/.pi/skills/xberg-extracting-tables/references/python-api.md +657 -0
- package/.pi/skills/xberg-extracting-tables/references/rust-api.md +412 -0
- package/.pi/skills/xberg-extracting-tables/references/supported-formats.md +252 -0
- package/.pi/skills/xberg-extracting-with-ocr/SKILL.md +129 -0
- package/.pi/skills/xberg-extracting-with-ocr/index.md +10 -0
- package/.pi/skills/xberg-extracting-with-ocr/references/advanced-features.md +628 -0
- package/.pi/skills/xberg-extracting-with-ocr/references/cli-reference.md +462 -0
- package/.pi/skills/xberg-extracting-with-ocr/references/configuration.md +587 -0
- package/.pi/skills/xberg-extracting-with-ocr/references/nodejs-api.md +485 -0
- package/.pi/skills/xberg-extracting-with-ocr/references/other-bindings.md +345 -0
- package/.pi/skills/xberg-extracting-with-ocr/references/python-api.md +657 -0
- package/.pi/skills/xberg-extracting-with-ocr/references/rust-api.md +412 -0
- package/.pi/skills/xberg-extracting-with-ocr/references/supported-formats.md +252 -0
- package/.pi/skills/xberg-picking-a-format/SKILL.md +104 -0
- package/.pi/skills/xberg-picking-a-format/index.md +10 -0
- package/.pi/skills/xberg-picking-a-format/references/advanced-features.md +628 -0
- package/.pi/skills/xberg-picking-a-format/references/cli-reference.md +462 -0
- package/.pi/skills/xberg-picking-a-format/references/configuration.md +587 -0
- package/.pi/skills/xberg-picking-a-format/references/nodejs-api.md +485 -0
- package/.pi/skills/xberg-picking-a-format/references/other-bindings.md +345 -0
- package/.pi/skills/xberg-picking-a-format/references/python-api.md +657 -0
- package/.pi/skills/xberg-picking-a-format/references/rust-api.md +412 -0
- package/.pi/skills/xberg-picking-a-format/references/supported-formats.md +252 -0
- package/README.md +112 -6
- package/package.json +184 -16
- package/scripts/mcp-launch.sh +189 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Use when extracting tabular data from PDFs, spreadsheets, or images. Covers layout-aware table detection, table model selection, output formats (markdown / JSON cells), and known limits.
|
|
3
|
+
name: xberg-extracting-tables
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!--
|
|
7
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
8
|
+
Content-Hash: blake3:80d26904ff70da39df4ee2b35bcfc06a186b30c0d2566cf4b60832cd42e475ef
|
|
9
|
+
Source-Hash: blake3:662aa704cf97ad20f02258c9dcd1c73822213a426e27ec7ebc292d3f599fb7c2
|
|
10
|
+
Schema-Version: v1
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
# Extracting tables
|
|
14
|
+
|
|
15
|
+
Use this when the user wants structured tabular data — financial
|
|
16
|
+
statements, scientific tables, invoices, spreadsheet-style PDFs. Xberg
|
|
17
|
+
detects tables via a layout model (RT-DETR v2) and reconstructs cell
|
|
18
|
+
structure with a configurable table model.
|
|
19
|
+
|
|
20
|
+
## Basic usage
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Markdown tables embedded in the content stream
|
|
24
|
+
xberg extract report.pdf --layout --content-format markdown
|
|
25
|
+
|
|
26
|
+
# Structured JSON output, tables appear under result.tables
|
|
27
|
+
xberg extract report.pdf --layout --format json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`--layout` turns on layout-aware extraction; without it, tables fall back
|
|
31
|
+
to plain text reflow and you lose cell boundaries.
|
|
32
|
+
|
|
33
|
+
## Output shapes
|
|
34
|
+
|
|
35
|
+
Two surfaces, picked via `--format` (CLI shape) and `--content-format`
|
|
36
|
+
(content rendering):
|
|
37
|
+
|
|
38
|
+
- **Markdown tables in `content`** — `--content-format markdown`. Tables
|
|
39
|
+
appear inline as `| col | col |` blocks. Good for LLM ingestion.
|
|
40
|
+
- **Structured `tables` array** — `--format json`. Each entry has
|
|
41
|
+
`cells[][]` (rows × cols), `markdown` (pre-rendered), `page_number`,
|
|
42
|
+
`bounding_box`. Use this when downstream code needs exact cell access.
|
|
43
|
+
(`bounding_box` is omitted when no position data is available.)
|
|
44
|
+
|
|
45
|
+
Both are populated at once when `--layout` is on. The `tables` array is
|
|
46
|
+
always structured; the `content` stream switches representation.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
xberg extract financials.pdf --layout --format json \
|
|
50
|
+
| jq '.result.tables[] | {page: .page_number, rows: (.cells | length)}'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Table models
|
|
54
|
+
|
|
55
|
+
`--layout-table-model` picks the reconstruction backend:
|
|
56
|
+
|
|
57
|
+
| Model | Best for | Notes |
|
|
58
|
+
| ------------------ | ----------------------------------------------------- | ------------------------------------------- |
|
|
59
|
+
| `tatr` | dense complex tables (academic, financial) | **Default.** Heaviest, highest accuracy. |
|
|
60
|
+
| `slanet_auto` | dispatches per-table to wired/wireless | Good when table styles are mixed. |
|
|
61
|
+
| `slanet_wired` | tables with visible borders | Faster than tatr. |
|
|
62
|
+
| `slanet_wireless` | tables without borders (whitespace-separated) | For invoices, simple grids. |
|
|
63
|
+
| `slanet_plus` | hybrid wired / wireless | Lighter than `slanet_auto`. |
|
|
64
|
+
| `disabled` | layout detection only, no table structure | Use to skip table model cost. |
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
xberg extract bank-statement.pdf \
|
|
68
|
+
--layout --layout-table-model tatr --content-format markdown
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Drop `--layout-confidence` when the layout model misses tables (default
|
|
72
|
+
threshold ~0.5):
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
xberg extract noisy-scan.pdf --layout --layout-confidence 0.3
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Spreadsheets
|
|
79
|
+
|
|
80
|
+
`.xlsx`, `.ods`, `.csv`, `.tsv` are extracted by dedicated parsers — no
|
|
81
|
+
layout model needed. Each sheet becomes a markdown table (or structured
|
|
82
|
+
table) automatically:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
xberg extract workbook.xlsx --content-format markdown
|
|
86
|
+
xberg extract data.csv --format json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Pass `--no-cache=true` only when iterating on the same file with different
|
|
90
|
+
configs.
|
|
91
|
+
|
|
92
|
+
## Config file alternative
|
|
93
|
+
|
|
94
|
+
```toml
|
|
95
|
+
# `output_format` in config files equals `--content-format` on the CLI.
|
|
96
|
+
output_format = "markdown"
|
|
97
|
+
|
|
98
|
+
[layout]
|
|
99
|
+
confidence_threshold = 0.5
|
|
100
|
+
table_model = "tatr"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Then:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
xberg extract report.pdf --format json
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Programmatic access
|
|
110
|
+
|
|
111
|
+
From Python, structured tables live on the document in the result envelope
|
|
112
|
+
(`result.results[0].tables`):
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from xberg import ExtractInput, extract, ExtractionConfig, LayoutDetectionConfig
|
|
116
|
+
|
|
117
|
+
config = ExtractionConfig(
|
|
118
|
+
layout=LayoutDetectionConfig(table_model="tatr"),
|
|
119
|
+
output_format="markdown",
|
|
120
|
+
)
|
|
121
|
+
result = await extract(ExtractInput(uri="report.pdf"), config)
|
|
122
|
+
for table in result.results[0].tables:
|
|
123
|
+
print(table.markdown) # rendered markdown
|
|
124
|
+
print(table.cells[0][0]) # cell access
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Node.js mirrors this (`extract`, `output.results[0].tables`, camelCase fields).
|
|
128
|
+
See `references/python-api.md` and `references/nodejs-api.md` for full type signatures.
|
|
129
|
+
|
|
130
|
+
## Known limitations
|
|
131
|
+
|
|
132
|
+
- **Merged cells** — reconstructed as repeated values across the spanned
|
|
133
|
+
region; the merge is not preserved as metadata.
|
|
134
|
+
- **Rotated tables** — enable `--ocr-auto-rotate true` for image-based
|
|
135
|
+
PDFs before extraction.
|
|
136
|
+
- **Nested tables** — flattened. Detection succeeds; structural nesting is
|
|
137
|
+
lost.
|
|
138
|
+
- **Multi-page tables** — each page yields a separate `tables[]` entry.
|
|
139
|
+
Stitch by matching column headers if needed.
|
|
140
|
+
- **ONNX Runtime required** — layout and table models are unavailable in
|
|
141
|
+
WASM builds and on the Android x86_64 emulator; native targets ship
|
|
142
|
+
full support.
|
|
143
|
+
|
|
144
|
+
## Common failure modes
|
|
145
|
+
|
|
146
|
+
- **Empty `tables` with `--layout` on** — confidence threshold too high or
|
|
147
|
+
table model mismatched. Drop `--layout-confidence` to 0.3, try
|
|
148
|
+
`--layout-table-model tatr`.
|
|
149
|
+
- **Markdown tables look ragged** — switch `--layout-table-model` to
|
|
150
|
+
`slanet_wired` for bordered grids or `slanet_wireless` for invoices.
|
|
151
|
+
- **Slow extraction** — `tatr` is heavy. Use `slanet_auto` or
|
|
152
|
+
`slanet_plus` as a default; reach for `tatr` only when accuracy matters.
|
|
153
|
+
|
|
154
|
+
See `references/cli-reference.md` for the full layout flag set and
|
|
155
|
+
`references/advanced-features.md` for the layout pipeline internals.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
3
|
+
Content-Hash: blake3:386ae93f69821b9e4a1d5b41d8e1e0999a592175f65263a67de5601249829887
|
|
4
|
+
Source-Hash: blake3:662aa704cf97ad20f02258c9dcd1c73822213a426e27ec7ebc292d3f599fb7c2
|
|
5
|
+
Schema-Version: v1
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Concepts
|
|
9
|
+
|
|
10
|
+
* [Extracting Tables](SKILL.md) - Use when extracting tabular data from PDFs, spreadsheets, or images. Covers layout-aware table detection, table model selection, output formats (markdown / JSON cells), and known limits.
|