@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.
Files changed (150) hide show
  1. package/.opencode/ai-rulez-bundle.json +52 -0
  2. package/.opencode/ai-rulez-content.js +167 -0
  3. package/.opencode/commands/xberg-extract.md +14 -0
  4. package/.opencode/commands/xberg-ocr.md +14 -0
  5. package/.opencode/plugins/xberg.js +75 -62
  6. package/.opencode/skills/xberg/SKILL.md +422 -0
  7. package/.opencode/skills/xberg/index.md +10 -0
  8. package/.opencode/skills/xberg/references/advanced-features.md +628 -0
  9. package/.opencode/skills/xberg/references/cli-reference.md +462 -0
  10. package/.opencode/skills/xberg/references/configuration.md +587 -0
  11. package/.opencode/skills/xberg/references/nodejs-api.md +485 -0
  12. package/.opencode/skills/xberg/references/other-bindings.md +345 -0
  13. package/.opencode/skills/xberg/references/python-api.md +657 -0
  14. package/.opencode/skills/xberg/references/rust-api.md +412 -0
  15. package/.opencode/skills/xberg/references/supported-formats.md +252 -0
  16. package/.opencode/skills/xberg-batch-extraction/SKILL.md +170 -0
  17. package/.opencode/skills/xberg-batch-extraction/index.md +10 -0
  18. package/.opencode/skills/xberg-batch-extraction/references/advanced-features.md +628 -0
  19. package/.opencode/skills/xberg-batch-extraction/references/cli-reference.md +462 -0
  20. package/.opencode/skills/xberg-batch-extraction/references/configuration.md +587 -0
  21. package/.opencode/skills/xberg-batch-extraction/references/nodejs-api.md +485 -0
  22. package/.opencode/skills/xberg-batch-extraction/references/other-bindings.md +345 -0
  23. package/.opencode/skills/xberg-batch-extraction/references/python-api.md +657 -0
  24. package/.opencode/skills/xberg-batch-extraction/references/rust-api.md +412 -0
  25. package/.opencode/skills/xberg-batch-extraction/references/supported-formats.md +252 -0
  26. package/.opencode/skills/xberg-chunking/SKILL.md +163 -0
  27. package/.opencode/skills/xberg-chunking/index.md +10 -0
  28. package/.opencode/skills/xberg-chunking/references/advanced-features.md +628 -0
  29. package/.opencode/skills/xberg-chunking/references/cli-reference.md +462 -0
  30. package/.opencode/skills/xberg-chunking/references/configuration.md +587 -0
  31. package/.opencode/skills/xberg-chunking/references/nodejs-api.md +485 -0
  32. package/.opencode/skills/xberg-chunking/references/other-bindings.md +345 -0
  33. package/.opencode/skills/xberg-chunking/references/python-api.md +657 -0
  34. package/.opencode/skills/xberg-chunking/references/rust-api.md +412 -0
  35. package/.opencode/skills/xberg-chunking/references/supported-formats.md +252 -0
  36. package/.opencode/skills/xberg-extracting-keywords/SKILL.md +170 -0
  37. package/.opencode/skills/xberg-extracting-keywords/index.md +10 -0
  38. package/.opencode/skills/xberg-extracting-keywords/references/advanced-features.md +628 -0
  39. package/.opencode/skills/xberg-extracting-keywords/references/cli-reference.md +462 -0
  40. package/.opencode/skills/xberg-extracting-keywords/references/configuration.md +587 -0
  41. package/.opencode/skills/xberg-extracting-keywords/references/nodejs-api.md +485 -0
  42. package/.opencode/skills/xberg-extracting-keywords/references/other-bindings.md +345 -0
  43. package/.opencode/skills/xberg-extracting-keywords/references/python-api.md +657 -0
  44. package/.opencode/skills/xberg-extracting-keywords/references/rust-api.md +412 -0
  45. package/.opencode/skills/xberg-extracting-keywords/references/supported-formats.md +252 -0
  46. package/.opencode/skills/xberg-extracting-tables/SKILL.md +155 -0
  47. package/.opencode/skills/xberg-extracting-tables/index.md +10 -0
  48. package/.opencode/skills/xberg-extracting-tables/references/advanced-features.md +628 -0
  49. package/.opencode/skills/xberg-extracting-tables/references/cli-reference.md +462 -0
  50. package/.opencode/skills/xberg-extracting-tables/references/configuration.md +587 -0
  51. package/.opencode/skills/xberg-extracting-tables/references/nodejs-api.md +485 -0
  52. package/.opencode/skills/xberg-extracting-tables/references/other-bindings.md +345 -0
  53. package/.opencode/skills/xberg-extracting-tables/references/python-api.md +657 -0
  54. package/.opencode/skills/xberg-extracting-tables/references/rust-api.md +412 -0
  55. package/.opencode/skills/xberg-extracting-tables/references/supported-formats.md +252 -0
  56. package/.opencode/skills/xberg-extracting-with-ocr/SKILL.md +129 -0
  57. package/.opencode/skills/xberg-extracting-with-ocr/index.md +10 -0
  58. package/.opencode/skills/xberg-extracting-with-ocr/references/advanced-features.md +628 -0
  59. package/.opencode/skills/xberg-extracting-with-ocr/references/cli-reference.md +462 -0
  60. package/.opencode/skills/xberg-extracting-with-ocr/references/configuration.md +587 -0
  61. package/.opencode/skills/xberg-extracting-with-ocr/references/nodejs-api.md +485 -0
  62. package/.opencode/skills/xberg-extracting-with-ocr/references/other-bindings.md +345 -0
  63. package/.opencode/skills/xberg-extracting-with-ocr/references/python-api.md +657 -0
  64. package/.opencode/skills/xberg-extracting-with-ocr/references/rust-api.md +412 -0
  65. package/.opencode/skills/xberg-extracting-with-ocr/references/supported-formats.md +252 -0
  66. package/.opencode/skills/xberg-picking-a-format/SKILL.md +104 -0
  67. package/.opencode/skills/xberg-picking-a-format/index.md +10 -0
  68. package/.opencode/skills/xberg-picking-a-format/references/advanced-features.md +628 -0
  69. package/.opencode/skills/xberg-picking-a-format/references/cli-reference.md +462 -0
  70. package/.opencode/skills/xberg-picking-a-format/references/configuration.md +587 -0
  71. package/.opencode/skills/xberg-picking-a-format/references/nodejs-api.md +485 -0
  72. package/.opencode/skills/xberg-picking-a-format/references/other-bindings.md +345 -0
  73. package/.opencode/skills/xberg-picking-a-format/references/python-api.md +657 -0
  74. package/.opencode/skills/xberg-picking-a-format/references/rust-api.md +412 -0
  75. package/.opencode/skills/xberg-picking-a-format/references/supported-formats.md +252 -0
  76. package/.pi/prompts/xberg-extract.md +14 -0
  77. package/.pi/prompts/xberg-ocr.md +14 -0
  78. package/.pi/skills/xberg/SKILL.md +422 -0
  79. package/.pi/skills/xberg/index.md +10 -0
  80. package/.pi/skills/xberg/references/advanced-features.md +628 -0
  81. package/.pi/skills/xberg/references/cli-reference.md +462 -0
  82. package/.pi/skills/xberg/references/configuration.md +587 -0
  83. package/.pi/skills/xberg/references/nodejs-api.md +485 -0
  84. package/.pi/skills/xberg/references/other-bindings.md +345 -0
  85. package/.pi/skills/xberg/references/python-api.md +657 -0
  86. package/.pi/skills/xberg/references/rust-api.md +412 -0
  87. package/.pi/skills/xberg/references/supported-formats.md +252 -0
  88. package/.pi/skills/xberg-batch-extraction/SKILL.md +170 -0
  89. package/.pi/skills/xberg-batch-extraction/index.md +10 -0
  90. package/.pi/skills/xberg-batch-extraction/references/advanced-features.md +628 -0
  91. package/.pi/skills/xberg-batch-extraction/references/cli-reference.md +462 -0
  92. package/.pi/skills/xberg-batch-extraction/references/configuration.md +587 -0
  93. package/.pi/skills/xberg-batch-extraction/references/nodejs-api.md +485 -0
  94. package/.pi/skills/xberg-batch-extraction/references/other-bindings.md +345 -0
  95. package/.pi/skills/xberg-batch-extraction/references/python-api.md +657 -0
  96. package/.pi/skills/xberg-batch-extraction/references/rust-api.md +412 -0
  97. package/.pi/skills/xberg-batch-extraction/references/supported-formats.md +252 -0
  98. package/.pi/skills/xberg-chunking/SKILL.md +163 -0
  99. package/.pi/skills/xberg-chunking/index.md +10 -0
  100. package/.pi/skills/xberg-chunking/references/advanced-features.md +628 -0
  101. package/.pi/skills/xberg-chunking/references/cli-reference.md +462 -0
  102. package/.pi/skills/xberg-chunking/references/configuration.md +587 -0
  103. package/.pi/skills/xberg-chunking/references/nodejs-api.md +485 -0
  104. package/.pi/skills/xberg-chunking/references/other-bindings.md +345 -0
  105. package/.pi/skills/xberg-chunking/references/python-api.md +657 -0
  106. package/.pi/skills/xberg-chunking/references/rust-api.md +412 -0
  107. package/.pi/skills/xberg-chunking/references/supported-formats.md +252 -0
  108. package/.pi/skills/xberg-extracting-keywords/SKILL.md +170 -0
  109. package/.pi/skills/xberg-extracting-keywords/index.md +10 -0
  110. package/.pi/skills/xberg-extracting-keywords/references/advanced-features.md +628 -0
  111. package/.pi/skills/xberg-extracting-keywords/references/cli-reference.md +462 -0
  112. package/.pi/skills/xberg-extracting-keywords/references/configuration.md +587 -0
  113. package/.pi/skills/xberg-extracting-keywords/references/nodejs-api.md +485 -0
  114. package/.pi/skills/xberg-extracting-keywords/references/other-bindings.md +345 -0
  115. package/.pi/skills/xberg-extracting-keywords/references/python-api.md +657 -0
  116. package/.pi/skills/xberg-extracting-keywords/references/rust-api.md +412 -0
  117. package/.pi/skills/xberg-extracting-keywords/references/supported-formats.md +252 -0
  118. package/.pi/skills/xberg-extracting-tables/SKILL.md +155 -0
  119. package/.pi/skills/xberg-extracting-tables/index.md +10 -0
  120. package/.pi/skills/xberg-extracting-tables/references/advanced-features.md +628 -0
  121. package/.pi/skills/xberg-extracting-tables/references/cli-reference.md +462 -0
  122. package/.pi/skills/xberg-extracting-tables/references/configuration.md +587 -0
  123. package/.pi/skills/xberg-extracting-tables/references/nodejs-api.md +485 -0
  124. package/.pi/skills/xberg-extracting-tables/references/other-bindings.md +345 -0
  125. package/.pi/skills/xberg-extracting-tables/references/python-api.md +657 -0
  126. package/.pi/skills/xberg-extracting-tables/references/rust-api.md +412 -0
  127. package/.pi/skills/xberg-extracting-tables/references/supported-formats.md +252 -0
  128. package/.pi/skills/xberg-extracting-with-ocr/SKILL.md +129 -0
  129. package/.pi/skills/xberg-extracting-with-ocr/index.md +10 -0
  130. package/.pi/skills/xberg-extracting-with-ocr/references/advanced-features.md +628 -0
  131. package/.pi/skills/xberg-extracting-with-ocr/references/cli-reference.md +462 -0
  132. package/.pi/skills/xberg-extracting-with-ocr/references/configuration.md +587 -0
  133. package/.pi/skills/xberg-extracting-with-ocr/references/nodejs-api.md +485 -0
  134. package/.pi/skills/xberg-extracting-with-ocr/references/other-bindings.md +345 -0
  135. package/.pi/skills/xberg-extracting-with-ocr/references/python-api.md +657 -0
  136. package/.pi/skills/xberg-extracting-with-ocr/references/rust-api.md +412 -0
  137. package/.pi/skills/xberg-extracting-with-ocr/references/supported-formats.md +252 -0
  138. package/.pi/skills/xberg-picking-a-format/SKILL.md +104 -0
  139. package/.pi/skills/xberg-picking-a-format/index.md +10 -0
  140. package/.pi/skills/xberg-picking-a-format/references/advanced-features.md +628 -0
  141. package/.pi/skills/xberg-picking-a-format/references/cli-reference.md +462 -0
  142. package/.pi/skills/xberg-picking-a-format/references/configuration.md +587 -0
  143. package/.pi/skills/xberg-picking-a-format/references/nodejs-api.md +485 -0
  144. package/.pi/skills/xberg-picking-a-format/references/other-bindings.md +345 -0
  145. package/.pi/skills/xberg-picking-a-format/references/python-api.md +657 -0
  146. package/.pi/skills/xberg-picking-a-format/references/rust-api.md +412 -0
  147. package/.pi/skills/xberg-picking-a-format/references/supported-formats.md +252 -0
  148. package/README.md +112 -6
  149. package/package.json +184 -16
  150. package/scripts/mcp-launch.sh +189 -0
package/README.md CHANGED
@@ -17,6 +17,44 @@ Self-host:
17
17
  /plugin install xberg@xberg
18
18
  ```
19
19
 
20
+ ### Kimi installation and compatibility
21
+
22
+ From a checkout of this repository, install with the Python Kimi CLI version used for native
23
+ plugin validation:
24
+
25
+ ```sh
26
+ uvx --from kimi-cli==1.51.0 kimi plugin install ./plugin
27
+ ```
28
+
29
+ Native plugin installation was validated with Python Kimi CLI 1.51.0. The replacement
30
+ `@moonshot-ai/kimi-code` 2.1.1 does not provide a `plugin` CLI subcommand; its interactive
31
+ plugin loading has not been verified. These results do not establish compatibility with
32
+ newer Kimi releases.
33
+
34
+ ### Pi
35
+
36
+ From a checkout of this repository, run:
37
+
38
+ ```bash
39
+ pi install ./plugin
40
+ ```
41
+
42
+ Once a plugin release includes Pi support, use the shared OpenCode/Pi npm package:
43
+
44
+ ```bash
45
+ pi install npm:@xberg-io/opencode-xberg
46
+ ```
47
+
48
+ Pi discovers skills from `.pi/skills` and prompt templates from `.pi/prompts`.
49
+ Use `/xberg-extract` and `/xberg-ocr` to start a task.
50
+ Install the CLI separately using the instructions below. The Pi package does not
51
+ register MCP servers, hooks, or executable extensions. The MCP integration
52
+ sections below apply to clients with MCP support.
53
+
54
+ Git installs use the repository root's `package.json` resource paths. GitHub
55
+ hosts the checkout resources; the existing npm plugin release publishes the same
56
+ Pi content alongside the OpenCode adapter. No separate Pi release job is needed.
57
+
20
58
  ### Binary requirement
21
59
 
22
60
  Install the `xberg` CLI:
@@ -52,12 +90,12 @@ sudo apt install tesseract-ocr-* # Debian/Ubuntu
52
90
  | Skill | Trigger |
53
91
  |-------|---------|
54
92
  | **xberg** | Extract text, tables, metadata, and images from 107 document formats (PDF, Office, images, HTML, email, archives, academic) using Xberg. Use when writing code that calls Xberg APIs in Python, Node.js/TypeScript, Rust, or CLI. Covers installation, extraction (sync/async), configuration (OCR, chunking, output format), batch processing, error handling, and plugins. |
55
- | **extracting-with-ocr** | Use when extracting text from scanned PDFs, photographed pages, or images that have no embedded text layer. Covers OCR backends, language packs, force-OCR, and performance tuning. |
56
- | **extracting-tables** | 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. |
57
- | **chunking** | Use when splitting extracted text into chunks for LLM context windows or RAG ingestion. Covers chunk size, overlap, markdown/yaml/semantic chunkers, tokenizer-based sizing, and the standalone `chunk` command. |
58
- | **extracting-keywords** | Use when extracting keywords (YAKE/RAKE), detecting document language, or generating embeddings for RAG and search. Covers the keyword config, `--detect-language`, and the standalone `embed` command. |
59
- | **batch-extraction** | Use when extracting from many files at once with shared config, bounded parallelism, per-file overrides, and error recovery. Covers the `batch` command, `--file-configs`, `--max-concurrent`, and output layout. |
60
- | **picking-a-format** | Use when choosing an output format for extracted documents — text, markdown, djot, html, or JSON. Maps consumer (LLM, parser, archive) to the right `--format` / `--content-format` pair. |
93
+ | **xberg-extracting-with-ocr** | Use when extracting text from scanned PDFs, photographed pages, or images that have no embedded text layer. Covers OCR backends, language packs, force-OCR, and performance tuning. |
94
+ | **xberg-extracting-tables** | 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. |
95
+ | **xberg-chunking** | Use when splitting extracted text into chunks for LLM context windows or RAG ingestion. Covers chunk size, overlap, markdown/yaml/semantic chunkers, tokenizer-based sizing, and the standalone `chunk` command. |
96
+ | **xberg-extracting-keywords** | Use when extracting keywords (YAKE/RAKE), detecting document language, or generating embeddings for RAG and search. Covers the keyword config, `--detect-language`, and the standalone `embed` command. |
97
+ | **xberg-batch-extraction** | Use when extracting from many files at once with shared config, bounded parallelism, per-file overrides, and error recovery. Covers the `batch` command, `--file-configs`, `--max-concurrent`, and output layout. |
98
+ | **xberg-picking-a-format** | Use when choosing an output format for extracted documents — text, markdown, djot, html, or JSON. Maps consumer (LLM, parser, archive) to the right `--format` / `--content-format` pair. |
61
99
 
62
100
  **Reference materials** (linked from the `xberg` skill):
63
101
 
@@ -118,6 +156,22 @@ xberg extract data.xlsx --format json
118
156
 
119
157
  The plugin version tracks the xberg core release (`Cargo.toml`). See [CHANGELOG.md](../CHANGELOG.md) for release notes.
120
158
 
159
+ ## Maintaining the plugin
160
+
161
+ Edit `plugin/.ai-rulez` sources, then run these commands from the repository root
162
+ with a Pi-capable ai-rulez v5 binary installed:
163
+
164
+ ```bash
165
+ task plugin:generate
166
+ task plugin:verify
167
+ task plugin:test
168
+ ```
169
+
170
+ CI builds the generator from a pinned source revision and verifies the generated
171
+ bundles, OpenCode tools, and actual npm archive before publication. The shared
172
+ npm package publishes both OpenCode and Pi resources; Hermes uses its existing
173
+ PyPI release job. GitHub hosts the remaining plugin bundles and marketplace indexes.
174
+
121
175
  ## License
122
176
 
123
177
  MIT. The skill content uses Elastic-2.0 references to the upstream [xberg](https://github.com/xberg-io/xberg) repository.
@@ -127,3 +181,55 @@ MIT. The skill content uses Elastic-2.0 references to the upstream [xberg](https
127
181
  - **Marketplace**: this repo — `/plugin marketplace add xberg-io/xberg`
128
182
  - **Upstream**: [xberg-io/xberg](https://github.com/xberg-io/xberg)
129
183
  - **Related plugins**: [crawlberg](https://github.com/xberg-io/crawlberg)
184
+
185
+ ## Generated runtime bundles
186
+
187
+ `plugin/.ai-rulez/config.toml` loads `config.plugins.toml` through the `plugins` layer;
188
+ skills, commands and runtime adapters are authored alongside it. AI-Rulez 5.3.0 generates
189
+ all eleven supported runtimes: Claude, Cursor, Codex, Gemini, Kimi, OpenCode, Factory,
190
+ Hermes, Pi, Agent Plugins and Copilot. Codex ships both manifest layouts; repository-root
191
+ Claude and Codex marketplace indexes point to the `plugin` bundle. Cursor also has a marketplace index.
192
+
193
+ Pi packages skills and prompts without MCP integration. Copilot packages skills and MCP configuration, but does not package slash commands or hooks.
194
+ Hermes includes a Python package under `.hermes/package`; OpenCode and Pi share the npm package.
195
+ The Agent Plugins manifest uses the stable 1.0 specification. Runtime capabilities differ;
196
+ install the CLI before using skills in a runtime without MCP registration.
197
+
198
+ Run `ai-rulez generate --plugin` from the repository root to regenerate and
199
+ `ai-rulez verify --plugin` to compare current source output and provenance.
200
+ The release workflow packages every runtime into a deterministic archive, checksums,
201
+ and marketplace metadata; npm and PyPI retain their existing publishing jobs.
202
+
203
+ ## Hermes runtime setup
204
+
205
+ Install the product CLI with MCP support and put it on Hermes' PATH before using the plugin.
206
+ The Hermes adapter registers every bundled skill under the product namespace and provides
207
+ `xberg_call`, which calls the selected native MCP tool with `tool_arguments` through a local
208
+ stdio session. Select `tool: "list_tools"` first to inspect the server's exact request schemas. Hermes skills are selected explicitly; they are not automatically appended to the
209
+ system prompt. Enable the plugin in Hermes configuration; project plugins also require
210
+ `HERMES_ENABLE_PROJECT_PLUGINS=true`.
211
+
212
+ The bridge uses the installed CLI directly. The auto-installing launchers used by other MCP clients
213
+ are not included in the Hermes Python wheel. Provider credentials are inherited from the environment,
214
+ and are needed for provider-backed requests. Missing CLIs, unavailable tools and model preparation
215
+ fail with an actionable request error. CLI result data remains untrusted document content.
216
+
217
+ ## Public Agent Skills
218
+
219
+ The repository-root `skills/` directory contains the same generated skills and supporting
220
+ resources as `plugin/skills/`. Install them independently of a plugin runtime:
221
+
222
+ ```sh
223
+ npx skills add xberg-io/xberg --skill xberg
224
+ ```
225
+
226
+ Edit `plugin/.ai-rulez/skills`, then run `task plugin:generate` to regenerate runtime
227
+ bundles and synchronize the public export. `task plugin:verify` checks both projections;
228
+ `task plugin:skills:test` verifies resource freshness, ownership and symlink protection.
229
+ The public ownership manifest records SHA-256 hashes of every exported file.
230
+
231
+ Download integrity: the launcher currently relies on HTTPS for direct binary downloads.
232
+ Verify release checksums separately when available before manually installing an archive.
233
+
234
+ Launcher and visual assets are authored in `plugin/.ai-rulez/scripts/` and
235
+ `plugin/.ai-rulez/assets/`; `task plugin:generate` copies them into the runtime bundle.
package/package.json CHANGED
@@ -1,31 +1,199 @@
1
1
  {
2
- "name": "@xberg-io/opencode-xberg",
3
- "version": "1.3.7",
2
+ "author": {
3
+ "email": "contact@xberg.io",
4
+ "name": "Kreuzberg, Inc.",
5
+ "url": "https://xberg.io"
6
+ },
7
+ "dependencies": {
8
+ "@opencode/plugin": "^2.0.26"
9
+ },
4
10
  "description": "Local document extraction: text, tables, metadata, images from 107 formats with optional OCR.",
11
+ "exports": {
12
+ ".": "./.opencode/plugins/xberg.js"
13
+ },
14
+ "files": [
15
+ ".opencode/ai-rulez-bundle.json",
16
+ ".opencode/ai-rulez-content.js",
17
+ ".opencode/commands/xberg-extract.md",
18
+ ".opencode/commands/xberg-ocr.md",
19
+ ".opencode/plugins/xberg.js",
20
+ ".opencode/skills/xberg-batch-extraction/SKILL.md",
21
+ ".opencode/skills/xberg-batch-extraction/index.md",
22
+ ".opencode/skills/xberg-batch-extraction/references/advanced-features.md",
23
+ ".opencode/skills/xberg-batch-extraction/references/cli-reference.md",
24
+ ".opencode/skills/xberg-batch-extraction/references/configuration.md",
25
+ ".opencode/skills/xberg-batch-extraction/references/nodejs-api.md",
26
+ ".opencode/skills/xberg-batch-extraction/references/other-bindings.md",
27
+ ".opencode/skills/xberg-batch-extraction/references/python-api.md",
28
+ ".opencode/skills/xberg-batch-extraction/references/rust-api.md",
29
+ ".opencode/skills/xberg-batch-extraction/references/supported-formats.md",
30
+ ".opencode/skills/xberg-chunking/SKILL.md",
31
+ ".opencode/skills/xberg-chunking/index.md",
32
+ ".opencode/skills/xberg-chunking/references/advanced-features.md",
33
+ ".opencode/skills/xberg-chunking/references/cli-reference.md",
34
+ ".opencode/skills/xberg-chunking/references/configuration.md",
35
+ ".opencode/skills/xberg-chunking/references/nodejs-api.md",
36
+ ".opencode/skills/xberg-chunking/references/other-bindings.md",
37
+ ".opencode/skills/xberg-chunking/references/python-api.md",
38
+ ".opencode/skills/xberg-chunking/references/rust-api.md",
39
+ ".opencode/skills/xberg-chunking/references/supported-formats.md",
40
+ ".opencode/skills/xberg-extracting-keywords/SKILL.md",
41
+ ".opencode/skills/xberg-extracting-keywords/index.md",
42
+ ".opencode/skills/xberg-extracting-keywords/references/advanced-features.md",
43
+ ".opencode/skills/xberg-extracting-keywords/references/cli-reference.md",
44
+ ".opencode/skills/xberg-extracting-keywords/references/configuration.md",
45
+ ".opencode/skills/xberg-extracting-keywords/references/nodejs-api.md",
46
+ ".opencode/skills/xberg-extracting-keywords/references/other-bindings.md",
47
+ ".opencode/skills/xberg-extracting-keywords/references/python-api.md",
48
+ ".opencode/skills/xberg-extracting-keywords/references/rust-api.md",
49
+ ".opencode/skills/xberg-extracting-keywords/references/supported-formats.md",
50
+ ".opencode/skills/xberg-extracting-tables/SKILL.md",
51
+ ".opencode/skills/xberg-extracting-tables/index.md",
52
+ ".opencode/skills/xberg-extracting-tables/references/advanced-features.md",
53
+ ".opencode/skills/xberg-extracting-tables/references/cli-reference.md",
54
+ ".opencode/skills/xberg-extracting-tables/references/configuration.md",
55
+ ".opencode/skills/xberg-extracting-tables/references/nodejs-api.md",
56
+ ".opencode/skills/xberg-extracting-tables/references/other-bindings.md",
57
+ ".opencode/skills/xberg-extracting-tables/references/python-api.md",
58
+ ".opencode/skills/xberg-extracting-tables/references/rust-api.md",
59
+ ".opencode/skills/xberg-extracting-tables/references/supported-formats.md",
60
+ ".opencode/skills/xberg-extracting-with-ocr/SKILL.md",
61
+ ".opencode/skills/xberg-extracting-with-ocr/index.md",
62
+ ".opencode/skills/xberg-extracting-with-ocr/references/advanced-features.md",
63
+ ".opencode/skills/xberg-extracting-with-ocr/references/cli-reference.md",
64
+ ".opencode/skills/xberg-extracting-with-ocr/references/configuration.md",
65
+ ".opencode/skills/xberg-extracting-with-ocr/references/nodejs-api.md",
66
+ ".opencode/skills/xberg-extracting-with-ocr/references/other-bindings.md",
67
+ ".opencode/skills/xberg-extracting-with-ocr/references/python-api.md",
68
+ ".opencode/skills/xberg-extracting-with-ocr/references/rust-api.md",
69
+ ".opencode/skills/xberg-extracting-with-ocr/references/supported-formats.md",
70
+ ".opencode/skills/xberg-picking-a-format/SKILL.md",
71
+ ".opencode/skills/xberg-picking-a-format/index.md",
72
+ ".opencode/skills/xberg-picking-a-format/references/advanced-features.md",
73
+ ".opencode/skills/xberg-picking-a-format/references/cli-reference.md",
74
+ ".opencode/skills/xberg-picking-a-format/references/configuration.md",
75
+ ".opencode/skills/xberg-picking-a-format/references/nodejs-api.md",
76
+ ".opencode/skills/xberg-picking-a-format/references/other-bindings.md",
77
+ ".opencode/skills/xberg-picking-a-format/references/python-api.md",
78
+ ".opencode/skills/xberg-picking-a-format/references/rust-api.md",
79
+ ".opencode/skills/xberg-picking-a-format/references/supported-formats.md",
80
+ ".opencode/skills/xberg/SKILL.md",
81
+ ".opencode/skills/xberg/index.md",
82
+ ".opencode/skills/xberg/references/advanced-features.md",
83
+ ".opencode/skills/xberg/references/cli-reference.md",
84
+ ".opencode/skills/xberg/references/configuration.md",
85
+ ".opencode/skills/xberg/references/nodejs-api.md",
86
+ ".opencode/skills/xberg/references/other-bindings.md",
87
+ ".opencode/skills/xberg/references/python-api.md",
88
+ ".opencode/skills/xberg/references/rust-api.md",
89
+ ".opencode/skills/xberg/references/supported-formats.md",
90
+ ".pi/prompts/xberg-extract.md",
91
+ ".pi/prompts/xberg-ocr.md",
92
+ ".pi/skills/xberg-batch-extraction/SKILL.md",
93
+ ".pi/skills/xberg-batch-extraction/index.md",
94
+ ".pi/skills/xberg-batch-extraction/references/advanced-features.md",
95
+ ".pi/skills/xberg-batch-extraction/references/cli-reference.md",
96
+ ".pi/skills/xberg-batch-extraction/references/configuration.md",
97
+ ".pi/skills/xberg-batch-extraction/references/nodejs-api.md",
98
+ ".pi/skills/xberg-batch-extraction/references/other-bindings.md",
99
+ ".pi/skills/xberg-batch-extraction/references/python-api.md",
100
+ ".pi/skills/xberg-batch-extraction/references/rust-api.md",
101
+ ".pi/skills/xberg-batch-extraction/references/supported-formats.md",
102
+ ".pi/skills/xberg-chunking/SKILL.md",
103
+ ".pi/skills/xberg-chunking/index.md",
104
+ ".pi/skills/xberg-chunking/references/advanced-features.md",
105
+ ".pi/skills/xberg-chunking/references/cli-reference.md",
106
+ ".pi/skills/xberg-chunking/references/configuration.md",
107
+ ".pi/skills/xberg-chunking/references/nodejs-api.md",
108
+ ".pi/skills/xberg-chunking/references/other-bindings.md",
109
+ ".pi/skills/xberg-chunking/references/python-api.md",
110
+ ".pi/skills/xberg-chunking/references/rust-api.md",
111
+ ".pi/skills/xberg-chunking/references/supported-formats.md",
112
+ ".pi/skills/xberg-extracting-keywords/SKILL.md",
113
+ ".pi/skills/xberg-extracting-keywords/index.md",
114
+ ".pi/skills/xberg-extracting-keywords/references/advanced-features.md",
115
+ ".pi/skills/xberg-extracting-keywords/references/cli-reference.md",
116
+ ".pi/skills/xberg-extracting-keywords/references/configuration.md",
117
+ ".pi/skills/xberg-extracting-keywords/references/nodejs-api.md",
118
+ ".pi/skills/xberg-extracting-keywords/references/other-bindings.md",
119
+ ".pi/skills/xberg-extracting-keywords/references/python-api.md",
120
+ ".pi/skills/xberg-extracting-keywords/references/rust-api.md",
121
+ ".pi/skills/xberg-extracting-keywords/references/supported-formats.md",
122
+ ".pi/skills/xberg-extracting-tables/SKILL.md",
123
+ ".pi/skills/xberg-extracting-tables/index.md",
124
+ ".pi/skills/xberg-extracting-tables/references/advanced-features.md",
125
+ ".pi/skills/xberg-extracting-tables/references/cli-reference.md",
126
+ ".pi/skills/xberg-extracting-tables/references/configuration.md",
127
+ ".pi/skills/xberg-extracting-tables/references/nodejs-api.md",
128
+ ".pi/skills/xberg-extracting-tables/references/other-bindings.md",
129
+ ".pi/skills/xberg-extracting-tables/references/python-api.md",
130
+ ".pi/skills/xberg-extracting-tables/references/rust-api.md",
131
+ ".pi/skills/xberg-extracting-tables/references/supported-formats.md",
132
+ ".pi/skills/xberg-extracting-with-ocr/SKILL.md",
133
+ ".pi/skills/xberg-extracting-with-ocr/index.md",
134
+ ".pi/skills/xberg-extracting-with-ocr/references/advanced-features.md",
135
+ ".pi/skills/xberg-extracting-with-ocr/references/cli-reference.md",
136
+ ".pi/skills/xberg-extracting-with-ocr/references/configuration.md",
137
+ ".pi/skills/xberg-extracting-with-ocr/references/nodejs-api.md",
138
+ ".pi/skills/xberg-extracting-with-ocr/references/other-bindings.md",
139
+ ".pi/skills/xberg-extracting-with-ocr/references/python-api.md",
140
+ ".pi/skills/xberg-extracting-with-ocr/references/rust-api.md",
141
+ ".pi/skills/xberg-extracting-with-ocr/references/supported-formats.md",
142
+ ".pi/skills/xberg-picking-a-format/SKILL.md",
143
+ ".pi/skills/xberg-picking-a-format/index.md",
144
+ ".pi/skills/xberg-picking-a-format/references/advanced-features.md",
145
+ ".pi/skills/xberg-picking-a-format/references/cli-reference.md",
146
+ ".pi/skills/xberg-picking-a-format/references/configuration.md",
147
+ ".pi/skills/xberg-picking-a-format/references/nodejs-api.md",
148
+ ".pi/skills/xberg-picking-a-format/references/other-bindings.md",
149
+ ".pi/skills/xberg-picking-a-format/references/python-api.md",
150
+ ".pi/skills/xberg-picking-a-format/references/rust-api.md",
151
+ ".pi/skills/xberg-picking-a-format/references/supported-formats.md",
152
+ ".pi/skills/xberg/SKILL.md",
153
+ ".pi/skills/xberg/index.md",
154
+ ".pi/skills/xberg/references/advanced-features.md",
155
+ ".pi/skills/xberg/references/cli-reference.md",
156
+ ".pi/skills/xberg/references/configuration.md",
157
+ ".pi/skills/xberg/references/nodejs-api.md",
158
+ ".pi/skills/xberg/references/other-bindings.md",
159
+ ".pi/skills/xberg/references/python-api.md",
160
+ ".pi/skills/xberg/references/rust-api.md",
161
+ ".pi/skills/xberg/references/supported-formats.md",
162
+ "README.md",
163
+ "assets/",
164
+ "scripts/"
165
+ ],
166
+ "homepage": "https://xberg.io",
5
167
  "keywords": [
6
168
  "document-intelligence",
7
169
  "extraction",
8
170
  "ocr",
9
171
  "pdf",
172
+ "pi-package",
10
173
  "tables"
11
174
  ],
12
- "homepage": "https://xberg.io",
175
+ "license": "MIT",
176
+ "main": ".opencode/plugins/xberg.js",
177
+ "name": "@xberg-io/opencode-xberg",
178
+ "pi": {
179
+ "prompts": [
180
+ "./.pi/prompts/xberg-extract.md",
181
+ "./.pi/prompts/xberg-ocr.md"
182
+ ],
183
+ "skills": [
184
+ "./.pi/skills/xberg-batch-extraction",
185
+ "./.pi/skills/xberg-chunking",
186
+ "./.pi/skills/xberg-extracting-keywords",
187
+ "./.pi/skills/xberg-extracting-tables",
188
+ "./.pi/skills/xberg-extracting-with-ocr",
189
+ "./.pi/skills/xberg-picking-a-format",
190
+ "./.pi/skills/xberg"
191
+ ]
192
+ },
13
193
  "repository": {
14
194
  "type": "git",
15
195
  "url": "https://github.com/xberg-io/xberg"
16
196
  },
17
- "license": "MIT",
18
197
  "type": "module",
19
- "main": ".opencode/plugins/xberg.js",
20
- "exports": {
21
- ".": "./.opencode/plugins/xberg.js"
22
- },
23
- "files": [
24
- ".opencode/",
25
- "assets/",
26
- "README.md"
27
- ],
28
- "dependencies": {
29
- "@opencode-ai/plugin": "^1.17.8"
30
- }
198
+ "version": "1.3.11"
31
199
  }
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ NPM_PKG="@xberg-io/xberg-cli"
5
+ PYPI_PKG="xberg-cli"
6
+
7
+ log() { printf 'xberg-launch: %s\n' "$*" >&2; }
8
+ die() {
9
+ log "error: $*"
10
+ exit 1
11
+ }
12
+
13
+ LAUNCHER="${XBERG_LAUNCHER:-auto}"
14
+ case "$LAUNCHER" in
15
+ auto | npx | uvx | brew | download) ;;
16
+ *) die "invalid XBERG_LAUNCHER='$LAUNCHER' (expected auto|npx|uvx|brew|download)" ;;
17
+ esac
18
+
19
+ want() { [ "$LAUNCHER" = "auto" ] || [ "$LAUNCHER" = "$1" ]; }
20
+
21
+ PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-}"
22
+ if [ -z "$PLUGIN_ROOT" ]; then
23
+ PLUGIN_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
24
+ fi
25
+
26
+ BINARY_NAME="xberg"
27
+ case "$(uname -s)" in
28
+ MINGW* | MSYS* | CYGWIN* | Windows_NT) BINARY_NAME="xberg.exe" ;;
29
+ esac
30
+ BIN_DIR="$PLUGIN_ROOT/bin"
31
+ BIN="$BIN_DIR/$BINARY_NAME"
32
+
33
+ have() { command -v "$1" >/dev/null 2>&1; }
34
+
35
+ runnable() { [ -x "$1" ] && "$1" --version >/dev/null 2>&1; }
36
+
37
+ if runnable "$BIN"; then
38
+ log "using cached xberg at $BIN"
39
+ exec "$BIN" "$@"
40
+ fi
41
+ if have "$BINARY_NAME"; then
42
+ PATH_BIN="$(command -v "$BINARY_NAME")"
43
+ if runnable "$PATH_BIN"; then
44
+ log "using xberg on PATH ($PATH_BIN)"
45
+ exec "$PATH_BIN" "$@"
46
+ fi
47
+ fi
48
+
49
+ if want npx && have npx; then
50
+ log "resolving npx $NPM_PKG@latest ..."
51
+ scratch="$(mktemp -d)"
52
+ # Resolve in an empty project, then execute the selected binary in the caller's cwd. ~keep
53
+ if npm_bin="$(cd "$scratch" && npx -y --package "$NPM_PKG@latest" --call "command -v ${BINARY_NAME%.exe}" 2>/dev/null)" && runnable "$npm_bin"; then
54
+ rm -rf "$scratch"
55
+ log "launching npm package binary $npm_bin"
56
+ exec "$npm_bin" "$@"
57
+ fi
58
+ rm -rf "$scratch"
59
+ log "npx $NPM_PKG not available (no CLI bin yet); falling through"
60
+ fi
61
+
62
+ if want uvx && have uvx; then
63
+ log "probing uvx --from $PYPI_PKG $BINARY_NAME ..."
64
+ if uvx --from "$PYPI_PKG" "$BINARY_NAME" --version >/dev/null 2>&1; then
65
+ log "launching via uvx --from $PYPI_PKG $BINARY_NAME"
66
+ exec uvx --from "$PYPI_PKG" "$BINARY_NAME" "$@"
67
+ fi
68
+ log "uvx $PYPI_PKG not available (no CLI entry point yet); falling through"
69
+ fi
70
+
71
+ if want brew && have brew; then
72
+ log "installing via 'brew install xberg-io/tap/xberg' ..."
73
+ if brew install xberg-io/tap/xberg >&2; then
74
+ if have "$BINARY_NAME"; then
75
+ BREW_BIN="$(command -v "$BINARY_NAME")"
76
+ runnable "$BREW_BIN" && exec "$BREW_BIN" "$@"
77
+ fi
78
+ log "brew install reported success but xberg is not on PATH; falling through"
79
+ else
80
+ log "brew install failed; falling through"
81
+ fi
82
+ fi
83
+
84
+ try_download() {
85
+ local arch triple ext base_url asset asset_url tmp ex src_dir
86
+ arch="$(uname -m)"
87
+ case "$(uname -s)" in
88
+ Darwin)
89
+ case "$arch" in
90
+ arm64 | aarch64) triple="aarch64-apple-darwin" ;;
91
+ x86_64 | amd64) triple="x86_64-apple-darwin" ;;
92
+ *)
93
+ log "no prebuilt macOS archive for $arch; falling through"
94
+ return 1
95
+ ;;
96
+ esac
97
+ ;;
98
+ Linux)
99
+ case "$arch" in
100
+ aarch64 | arm64) triple="aarch64-unknown-linux-gnu" ;;
101
+ x86_64) triple="x86_64-unknown-linux-gnu" ;;
102
+ *)
103
+ log "no prebuilt Linux archive for $arch; falling through"
104
+ return 1
105
+ ;;
106
+ esac
107
+ ;;
108
+ MINGW* | MSYS* | CYGWIN* | Windows_NT) triple="x86_64-pc-windows-msvc" ;;
109
+ *)
110
+ log "no prebuilt archive for $(uname -s)/$arch; falling through"
111
+ return 1
112
+ ;;
113
+ esac
114
+ case "$triple" in
115
+ *windows*) ext="zip" ;;
116
+ *) ext="tar.gz" ;;
117
+ esac
118
+
119
+ base_url="https://github.com/xberg-io/xberg/releases/latest/download"
120
+ asset="xberg-cli-${triple}.${ext}"
121
+ asset_url="${base_url}/${asset}"
122
+
123
+ if have curl; then
124
+ fetch() { curl -fsSL --retry 3 -o "$2" "$1"; }
125
+ elif have wget; then
126
+ fetch() { wget -q -O "$2" "$1"; }
127
+ else
128
+ log "no curl or wget available for download; falling through"
129
+ return 1
130
+ fi
131
+
132
+ tmp="$(mktemp -d)"
133
+ # shellcheck disable=SC2064 # expand $tmp now so the trap removes this exact dir
134
+ trap "rm -rf '$tmp'" RETURN
135
+
136
+ log "downloading $asset from latest release ..."
137
+ if ! fetch "$asset_url" "$tmp/$asset"; then
138
+ log "download failed or asset not found: $asset_url; falling through"
139
+ return 1
140
+ fi
141
+
142
+ log "warning: no published checksum for $asset; integrity is verified by HTTPS/TLS only, not a content hash"
143
+
144
+ ex="$tmp/extracted"
145
+ mkdir -p "$ex"
146
+ case "$ext" in
147
+ tar.gz) tar -xzf "$tmp/$asset" -C "$ex" || {
148
+ log "extraction failed; falling through"
149
+ return 1
150
+ } ;;
151
+ zip)
152
+ if have unzip; then
153
+ unzip -qo "$tmp/$asset" -d "$ex" || {
154
+ log "extraction failed; falling through"
155
+ return 1
156
+ }
157
+ else
158
+ log "need unzip to extract $asset; falling through"
159
+ return 1
160
+ fi
161
+ ;;
162
+ esac
163
+
164
+ src_dir="$ex/xberg-cli-${triple}"
165
+ [ -d "$src_dir" ] || src_dir="$ex"
166
+ if [ ! -f "$src_dir/$BINARY_NAME" ]; then
167
+ log "binary $BINARY_NAME not found inside $asset; falling through"
168
+ return 1
169
+ fi
170
+
171
+ rm -rf "$BIN_DIR"
172
+ mkdir -p "$BIN_DIR"
173
+ mv "$src_dir"/* "$BIN_DIR"/
174
+ chmod +x "$BIN"
175
+ log "installed xberg to $BIN"
176
+ return 0
177
+ }
178
+
179
+ if want download; then
180
+ if try_download; then
181
+ exec "$BIN" "$@"
182
+ fi
183
+ fi
184
+
185
+ die "could not locate or install xberg. Install it manually with one of:
186
+ brew install xberg-io/tap/xberg
187
+ cargo install xberg-cli
188
+ or download a prebuilt archive from https://github.com/xberg-io/xberg/releases/latest
189
+ then ensure 'xberg' is on PATH and retry."