@xberg-io/opencode-xberg 0.1.1 → 1.0.2

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.
@@ -1,17 +1,21 @@
1
- import { spawn } from "node:child_process";
2
- import { tool } from "@opencode-ai/plugin";
1
+ // AI-RULEZ :: GENERATED FILE — DO NOT EDIT
2
+ // Content-Hash: blake3:76b6477efe57f116ea00ac739c1d78d6a8571ea3061535b355d3078bd7df755c
3
+ // Source-Hash: blake3:cf2e50e4fe88772155b882eacc338a857dfdc086a8a86b7d5d4721d540e33d8c
4
+ // Schema-Version: v1
5
+
6
+ import {tool} from "@opencode-ai/plugin";
7
+ import {spawn} from "node:child_process";
3
8
 
4
9
  const schema = tool.schema;
5
10
 
6
- const wireFormat = schema
7
- .enum(["text", "json", "toon"])
8
- .default("json")
9
- .describe("CLI output format.");
11
+ const wireFormat = schema.enum([ "text", "json", "toon" ])
12
+ .default("json")
13
+ .describe("CLI output format.");
10
14
 
11
- const contentFormat = schema
12
- .enum(["plain", "markdown", "djot", "html", "json"])
13
- .optional()
14
- .describe("Document content rendering format.");
15
+ const contentFormat =
16
+ schema.enum([ "plain", "markdown", "djot", "html", "json" ])
17
+ .optional()
18
+ .describe("Document content rendering format.");
15
19
 
16
20
  function hasValue(value) {
17
21
  return value !== undefined && value !== null && value !== "";
@@ -40,10 +44,10 @@ function runCli(args, context) {
40
44
 
41
45
  return new Promise((resolve, reject) => {
42
46
  const child = spawn("xberg", args, {
43
- cwd: directory,
44
- env: process.env,
45
- signal: context?.abort,
46
- stdio: ["ignore", "pipe", "pipe"],
47
+ cwd : directory,
48
+ env : process.env,
49
+ signal : context?.abort,
50
+ stdio : [ "ignore", "pipe", "pipe" ],
47
51
  });
48
52
 
49
53
  const stdout = [];
@@ -54,10 +58,10 @@ function runCli(args, context) {
54
58
  child.on("error", (error) => {
55
59
  if (error.code === "ENOENT") {
56
60
  resolve({
57
- title: "xberg CLI not found",
58
- output:
59
- "Install the xberg CLI with `brew install xberg-io/tap/xberg`, or run it via `npx xberg` / `uvx --from xberg xberg`.",
60
- metadata: { exitCode: 127, command: "xberg", subcommand: args[0] },
61
+ title : "xberg CLI not found",
62
+ output :
63
+ "Install the xberg CLI with `brew install xberg-io/tap/xberg`, or run it via `npx xberg` / `uvx --from xberg xberg`.",
64
+ metadata : {exitCode : 127, command : "xberg", subcommand : args[0]},
61
65
  });
62
66
  return;
63
67
  }
@@ -66,18 +70,18 @@ function runCli(args, context) {
66
70
  child.on("close", (exitCode, signal) => {
67
71
  const stdoutText = Buffer.concat(stdout).toString("utf8").trim();
68
72
  const stderrText = Buffer.concat(stderr).toString("utf8").trim();
69
- const output = [stdoutText, stderrText && `stderr:\n${stderrText}`]
70
- .filter(Boolean)
71
- .join("\n\n");
73
+ const output = [
74
+ stdoutText, stderrText && `stderr:\n${stderrText}`
75
+ ].filter(Boolean).join("\n\n");
72
76
 
73
77
  resolve({
74
- title: exitCode === 0 ? `xberg ${args[0]}` : `xberg ${args[0]} failed`,
75
- output: output || "(no output)",
76
- metadata: {
78
+ title : exitCode === 0 ? `xberg ${args[0]}` : `xberg ${args[0]} failed`,
79
+ output : output || "(no output)",
80
+ metadata : {
77
81
  exitCode,
78
82
  signal,
79
- command: "xberg",
80
- subcommand: args[0],
83
+ command : "xberg",
84
+ subcommand : args[0],
81
85
  },
82
86
  });
83
87
  });
@@ -85,21 +89,23 @@ function runCli(args, context) {
85
89
  }
86
90
 
87
91
  export const XbergPlugin = async () => ({
88
- tool: {
89
- xberg_extract: tool({
90
- description:
91
- "Extract text, tables, metadata, and images from a local document with the xberg CLI.",
92
- args: {
93
- path: schema.string().min(1).describe("Path to the local document."),
94
- format: wireFormat,
95
- content_format: contentFormat,
96
- mime_type: schema.string().min(1).optional().describe("Optional MIME type hint."),
97
- config_json: schema.string().min(2).optional().describe("Optional ExtractionConfig JSON."),
92
+ tool : {
93
+ xberg_extract : tool({
94
+ description :
95
+ "Extract text, tables, metadata, and images from a local document with the xberg CLI.",
96
+ args : {
97
+ path : schema.string().min(1).describe("Path to the local document."),
98
+ format : wireFormat,
99
+ content_format : contentFormat,
100
+ mime_type : schema.string().min(1).optional().describe(
101
+ "Optional MIME type hint."),
102
+ config_json : schema.string().min(2).optional().describe(
103
+ "Optional ExtractionConfig JSON."),
98
104
  },
99
105
  async execute(args, context) {
100
106
  validateJson(args.config_json, "config_json");
101
107
 
102
- const cliArgs = ["extract", args.path, "--format", args.format];
108
+ const cliArgs = [ "extract", args.path, "--format", args.format ];
103
109
  pushOption(cliArgs, "--content-format", args.content_format);
104
110
  pushOption(cliArgs, "--mime-type", args.mime_type);
105
111
  pushOption(cliArgs, "--config-json", args.config_json);
@@ -107,23 +113,24 @@ export const XbergPlugin = async () => ({
107
113
  return runCli(cliArgs, context);
108
114
  },
109
115
  }),
110
- xberg_detect: tool({
111
- description: "Detect the MIME type for a local file with the xberg CLI.",
112
- args: {
113
- path: schema.string().min(1).describe("Path to the local file."),
114
- format: wireFormat,
116
+ xberg_detect : tool({
117
+ description : "Detect the MIME type for a local file with the xberg CLI.",
118
+ args : {
119
+ path : schema.string().min(1).describe("Path to the local file."),
120
+ format : wireFormat,
115
121
  },
116
122
  async execute(args, context) {
117
- return runCli(["detect", args.path, "--format", args.format], context);
123
+ return runCli([ "detect", args.path, "--format", args.format ],
124
+ context);
118
125
  },
119
126
  }),
120
- xberg_formats: tool({
121
- description: "List document formats supported by the xberg CLI.",
122
- args: {
123
- format: wireFormat,
127
+ xberg_formats : tool({
128
+ description : "List document formats supported by the xberg CLI.",
129
+ args : {
130
+ format : wireFormat,
124
131
  },
125
132
  async execute(args, context) {
126
- return runCli(["formats", "--format", args.format], context);
133
+ return runCli([ "formats", "--format", args.format ], context);
127
134
  },
128
135
  }),
129
136
  },
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # xberg
2
2
 
3
- Extract text, tables, metadata, and images from 91+ document formats — PDF, Office, images with OCR, HTML, email, archives, academic — using the local `xberg` CLI in your agent.
3
+ Extract text, tables, metadata, and images from 98+ document formats — PDF, Office, images with OCR, HTML, email, archives, academic — using the local `xberg` CLI in your agent.
4
4
 
5
- <!-- TODO: screenshot -->
5
+ <!-- ~keep TODO: add screenshot -->
6
6
 
7
7
  ## Install
8
8
 
@@ -13,7 +13,7 @@ Pending review for official Claude marketplace.
13
13
  Self-host:
14
14
 
15
15
  ```text
16
- /plugin marketplace add xberg-io/plugins
16
+ /plugin marketplace add xberg-io/xberg
17
17
  /plugin install xberg@xberg
18
18
  ```
19
19
 
@@ -116,7 +116,7 @@ xberg extract data.xlsx --format json
116
116
 
117
117
  ## Versioning
118
118
 
119
- The plugin version tracks the marketplace `VERSION` file. See [CHANGELOG.md](../../CHANGELOG.md) for release notes.
119
+ The plugin version tracks the xberg core release (`Cargo.toml`). See [CHANGELOG.md](../CHANGELOG.md) for release notes.
120
120
 
121
121
  ## License
122
122
 
@@ -124,6 +124,6 @@ MIT. The skill content uses Elastic-2.0 references to the upstream [xberg](https
124
124
 
125
125
  ## See also
126
126
 
127
- - **Marketplace**: [xberg-io/plugins](https://github.com/xberg-io/plugins)
127
+ - **Marketplace**: this repo — `/plugin marketplace add xberg-io/xberg`
128
128
  - **Upstream**: [xberg-io/xberg](https://github.com/xberg-io/xberg)
129
- - **Sibling plugins**: [crawlberg](../crawlberg/README.md)
129
+ - **Related plugins**: [crawlberg](https://github.com/xberg-io/crawlberg)
package/assets/icon.svg CHANGED
@@ -1,8 +1,11 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
2
- <rect width="256" height="256" rx="48" fill="#1F6FEB"/>
3
- <path d="M64 64 L152 64 L192 104 L192 200 C192 204.4 188.4 208 184 208 L64 208 C59.6 208 56 204.4 56 200 L56 72 C56 67.6 59.6 64 64 64 Z" fill="white"/>
4
- <path d="M152 64 L152 96 C152 100.4 155.6 104 160 104 L192 104 Z" fill="#1F6FEB"/>
5
- <rect x="80" y="128" width="88" height="12" rx="6" fill="#1F6FEB"/>
6
- <rect x="80" y="152" width="96" height="12" rx="6" fill="#1F6FEB"/>
7
- <rect x="80" y="176" width="64" height="12" rx="6" fill="#1F6FEB"/>
2
+ <rect width="256" height="256" rx="48" fill="#1F6FEB" />
3
+ <path
4
+ d="M64 64 L152 64 L192 104 L192 200 C192 204.4 188.4 208 184 208 L64 208 C59.6 208 56 204.4 56 200 L56 72 C56 67.6 59.6 64 64 64 Z"
5
+ fill="white"
6
+ />
7
+ <path d="M152 64 L152 96 C152 100.4 155.6 104 160 104 L192 104 Z" fill="#1F6FEB" />
8
+ <rect x="80" y="128" width="88" height="12" rx="6" fill="#1F6FEB" />
9
+ <rect x="80" y="152" width="96" height="12" rx="6" fill="#1F6FEB" />
10
+ <rect x="80" y="176" width="64" height="12" rx="6" fill="#1F6FEB" />
8
11
  </svg>
package/package.json CHANGED
@@ -1,42 +1,31 @@
1
1
  {
2
2
  "name": "@xberg-io/opencode-xberg",
3
- "version": "0.1.1",
4
- "description": "OpenCode tools for local document extraction with the xberg CLI.",
3
+ "version": "1.0.2",
4
+ "description": "Local document extraction: text, tables, metadata, images from 98+ formats with optional OCR.",
5
5
  "keywords": [
6
6
  "document-intelligence",
7
7
  "extraction",
8
8
  "ocr",
9
- "opencode",
10
- "pdf"
9
+ "pdf",
10
+ "tables"
11
11
  ],
12
- "homepage": "https://github.com/xberg-io/plugins/tree/main/plugins/xberg",
13
- "bugs": {
14
- "url": "https://github.com/xberg-io/plugins/issues"
15
- },
16
- "license": "MIT",
12
+ "homepage": "https://xberg.io",
17
13
  "repository": {
18
14
  "type": "git",
19
- "url": "git+https://github.com/xberg-io/plugins.git",
20
- "directory": "plugins/xberg"
15
+ "url": "https://github.com/xberg-io/xberg"
21
16
  },
22
- "files": [
23
- ".opencode/",
24
- "assets/",
25
- "README.md"
26
- ],
17
+ "license": "MIT",
27
18
  "type": "module",
28
19
  "main": ".opencode/plugins/xberg.js",
29
20
  "exports": {
30
21
  ".": "./.opencode/plugins/xberg.js"
31
22
  },
32
- "publishConfig": {
33
- "access": "public",
34
- "provenance": true
35
- },
23
+ "files": [
24
+ ".opencode/",
25
+ "assets/",
26
+ "README.md"
27
+ ],
36
28
  "dependencies": {
37
29
  "@opencode-ai/plugin": "^1.17.8"
38
- },
39
- "engines": {
40
- "node": ">=22.14.0"
41
30
  }
42
31
  }