@rag-forge/shared 0.1.0 → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Femi Adedayo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # @rag-forge/shared
2
+
3
+ > Internal shared utilities for the RAG-Forge monorepo.
4
+
5
+ This package contains low-level utilities shared between [`@rag-forge/cli`](https://www.npmjs.com/package/@rag-forge/cli) and [`@rag-forge/mcp`](https://www.npmjs.com/package/@rag-forge/mcp) — primarily the Python subprocess bridge that lets the TypeScript packages invoke the Python evaluator and pipeline.
6
+
7
+ ## Are you looking for the CLI?
8
+
9
+ You probably want one of these instead:
10
+
11
+ - **[@rag-forge/cli](https://www.npmjs.com/package/@rag-forge/cli)** — the `rag-forge` command-line interface (this is what you install if you want to use RAG-Forge)
12
+ - **[@rag-forge/mcp](https://www.npmjs.com/package/@rag-forge/mcp)** — the MCP server for Claude Desktop and other agent clients
13
+
14
+ ## What's in this package
15
+
16
+ `@rag-forge/shared` exposes a single primitive:
17
+
18
+ ```typescript
19
+ import { runPythonModule, checkPythonAvailable } from "@rag-forge/shared";
20
+
21
+ const result = await runPythonModule({
22
+ module: "rag_forge_evaluator.cli",
23
+ args: ["audit", "--golden-set", "eval/golden_set.json"],
24
+ });
25
+
26
+ console.log(result.stdout);
27
+ ```
28
+
29
+ It spawns `uv run python -u -m <module> ...` via `execa`, captures stdout/stderr, and returns a structured result. The `-u` flag is critical — it disables Python's stdout block-buffering so long-running subprocesses (audits, indexing) stream output in real time on Windows non-TTY shells.
30
+
31
+ ## Why this is its own package
32
+
33
+ The TypeScript build for `@rag-forge/cli` and `@rag-forge/mcp` would otherwise duplicate this code. Keeping it as an internal published package (rather than a workspace-only library) means the bridge stays versioned, testable in isolation, and easy to upgrade across consumers.
34
+
35
+ External consumers can use it too if they're building their own RAG-Forge integrations in Node.js, but the surface area is intentionally minimal and the API may change between minor versions.
36
+
37
+ ## Documentation
38
+
39
+ - **Repository:** [github.com/hallengray/rag-forge](https://github.com/hallengray/rag-forge)
40
+ - **Issues:** [github.com/hallengray/rag-forge/issues](https://github.com/hallengray/rag-forge/issues)
41
+
42
+ ## License
43
+
44
+ MIT — Femi Adedayo
@@ -3,7 +3,7 @@ import { execa } from "execa";
3
3
  async function runPythonModule(options) {
4
4
  const { module, args = [], cwd } = options;
5
5
  try {
6
- const result = await execa("uv", ["run", "python", "-m", module, ...args], {
6
+ const result = await execa("uv", ["run", "python", "-u", "-m", module, ...args], {
7
7
  cwd,
8
8
  reject: false,
9
9
  timeout: 3e5
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/python-bridge.ts"],"sourcesContent":["import { execa } from \"execa\";\n\nexport interface PythonBridgeOptions {\n module: string;\n args?: string[];\n cwd?: string;\n}\n\nexport interface PythonBridgeResult {\n stdout: string;\n stderr: string;\n exitCode: number;\n}\n\nexport async function runPythonModule(options: PythonBridgeOptions): Promise<PythonBridgeResult> {\n const { module, args = [], cwd } = options;\n\n try {\n const result = await execa(\"uv\", [\"run\", \"python\", \"-m\", module, ...args], {\n cwd,\n reject: false,\n timeout: 300_000, // 5 minute timeout\n });\n\n return {\n stdout: result.stdout,\n stderr: result.stderr,\n exitCode: result.exitCode ?? (result.signal ? 1 : 0),\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Unknown error\";\n return {\n stdout: \"\",\n stderr: message,\n exitCode: 1,\n };\n }\n}\n\nexport async function checkPythonAvailable(): Promise<boolean> {\n try {\n const result = await execa(\"uv\", [\"run\", \"python\", \"--version\"], { reject: false });\n return result.exitCode === 0;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA,SAAS,aAAa;AActB,eAAsB,gBAAgB,SAA2D;AAC/F,QAAM,EAAE,QAAQ,OAAO,CAAC,GAAG,IAAI,IAAI;AAEnC,MAAI;AACF,UAAM,SAAS,MAAM,MAAM,MAAM,CAAC,OAAO,UAAU,MAAM,QAAQ,GAAG,IAAI,GAAG;AAAA,MACzE;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA;AAAA,IACX,CAAC;AAED,WAAO;AAAA,MACL,QAAQ,OAAO;AAAA,MACf,QAAQ,OAAO;AAAA,MACf,UAAU,OAAO,aAAa,OAAO,SAAS,IAAI;AAAA,IACpD;AAAA,EACF,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAEA,eAAsB,uBAAyC;AAC7D,MAAI;AACF,UAAM,SAAS,MAAM,MAAM,MAAM,CAAC,OAAO,UAAU,WAAW,GAAG,EAAE,QAAQ,MAAM,CAAC;AAClF,WAAO,OAAO,aAAa;AAAA,EAC7B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/python-bridge.ts"],"sourcesContent":["import { execa } from \"execa\";\n\nexport interface PythonBridgeOptions {\n module: string;\n args?: string[];\n cwd?: string;\n}\n\nexport interface PythonBridgeResult {\n stdout: string;\n stderr: string;\n exitCode: number;\n}\n\nexport async function runPythonModule(options: PythonBridgeOptions): Promise<PythonBridgeResult> {\n const { module, args = [], cwd } = options;\n\n try {\n const result = await execa(\"uv\", [\"run\", \"python\", \"-u\", \"-m\", module, ...args], {\n cwd,\n reject: false,\n timeout: 300_000, // 5 minute timeout\n });\n\n return {\n stdout: result.stdout,\n stderr: result.stderr,\n exitCode: result.exitCode ?? (result.signal ? 1 : 0),\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Unknown error\";\n return {\n stdout: \"\",\n stderr: message,\n exitCode: 1,\n };\n }\n}\n\nexport async function checkPythonAvailable(): Promise<boolean> {\n try {\n const result = await execa(\"uv\", [\"run\", \"python\", \"--version\"], { reject: false });\n return result.exitCode === 0;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA,SAAS,aAAa;AActB,eAAsB,gBAAgB,SAA2D;AAC/F,QAAM,EAAE,QAAQ,OAAO,CAAC,GAAG,IAAI,IAAI;AAEnC,MAAI;AACF,UAAM,SAAS,MAAM,MAAM,MAAM,CAAC,OAAO,UAAU,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG;AAAA,MAC/E;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA;AAAA,IACX,CAAC;AAED,WAAO;AAAA,MACL,QAAQ,OAAO;AAAA,MACf,QAAQ,OAAO;AAAA,MACf,UAAU,OAAO,aAAa,OAAO,SAAS,IAAI;AAAA,IACpD;AAAA,EACF,SAAS,OAAO;AACd,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AACzD,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,UAAU;AAAA,IACZ;AAAA,EACF;AACF;AAEA,eAAsB,uBAAyC;AAC7D,MAAI;AACF,UAAM,SAAS,MAAM,MAAM,MAAM,CAAC,OAAO,UAAU,WAAW,GAAG,EAAE,QAAQ,MAAM,CAAC;AAClF,WAAO,OAAO,aAAa;AAAA,EAC7B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rag-forge/shared",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Internal shared utilities for RAG-Forge packages",
5
5
  "author": "Femi Adedayo",
6
6
  "repository": {
@@ -12,7 +12,11 @@
12
12
  "bugs": {
13
13
  "url": "https://github.com/hallengray/rag-forge/issues"
14
14
  },
15
- "keywords": ["rag", "rag-forge", "internal"],
15
+ "keywords": [
16
+ "rag",
17
+ "rag-forge",
18
+ "internal"
19
+ ],
16
20
  "type": "module",
17
21
  "exports": {
18
22
  ".": {
@@ -20,11 +24,10 @@
20
24
  "types": "./dist/python-bridge.d.ts"
21
25
  }
22
26
  },
23
- "files": ["dist"],
24
- "scripts": {
25
- "build": "tsup",
26
- "typecheck": "tsc --noEmit"
27
- },
27
+ "files": [
28
+ "dist",
29
+ "README.md"
30
+ ],
28
31
  "dependencies": {
29
32
  "execa": "^9.0.0"
30
33
  },
@@ -36,5 +39,9 @@
36
39
  "engines": {
37
40
  "node": ">=20.0.0"
38
41
  },
39
- "license": "MIT"
40
- }
42
+ "license": "MIT",
43
+ "scripts": {
44
+ "build": "tsup",
45
+ "typecheck": "tsc --noEmit"
46
+ }
47
+ }