@nrl-ai/chub 0.1.3

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 (2) hide show
  1. package/bin/chub.js +59 -0
  2. package/package.json +23 -0
package/bin/chub.js ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Thin JS wrapper that detects the current platform and executes
5
+ * the native chub-turbo binary from the appropriate optional dependency.
6
+ *
7
+ * Pattern used by SWC, Biome, Oxlint, etc.
8
+ */
9
+
10
+ const { execFileSync } = require("child_process");
11
+ const { join } = require("path");
12
+
13
+ const PLATFORMS = {
14
+ "linux-x64": "@nrl-ai/chub-linux-x64",
15
+ "linux-arm64": "@nrl-ai/chub-linux-arm64",
16
+ "darwin-x64": "@nrl-ai/chub-darwin-x64",
17
+ "darwin-arm64": "@nrl-ai/chub-darwin-arm64",
18
+ "win32-x64": "@nrl-ai/chub-win32-x64",
19
+ };
20
+
21
+ function getBinaryPath() {
22
+ const platformKey = `${process.platform}-${process.arch}`;
23
+ const pkg = PLATFORMS[platformKey];
24
+
25
+ if (!pkg) {
26
+ console.error(
27
+ `Unsupported platform: ${platformKey}\n` +
28
+ `chub-turbo supports: ${Object.keys(PLATFORMS).join(", ")}`,
29
+ );
30
+ process.exit(1);
31
+ }
32
+
33
+ try {
34
+ const binDir = require.resolve(`${pkg}/package.json`);
35
+ const ext = process.platform === "win32" ? ".exe" : "";
36
+ return join(binDir, "..", `chub${ext}`);
37
+ } catch {
38
+ console.error(
39
+ `Could not find the chub binary for ${platformKey}.\n` +
40
+ `Expected package: ${pkg}\n` +
41
+ `Try reinstalling: npm install @nrl-ai/chub`,
42
+ );
43
+ process.exit(1);
44
+ }
45
+ }
46
+
47
+ const binary = getBinaryPath();
48
+
49
+ try {
50
+ execFileSync(binary, process.argv.slice(2), {
51
+ stdio: "inherit",
52
+ env: process.env,
53
+ });
54
+ } catch (err) {
55
+ if (err.status !== undefined) {
56
+ process.exit(err.status);
57
+ }
58
+ throw err;
59
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@nrl-ai/chub",
3
+ "version": "0.1.3",
4
+ "description": "Chub — high-performance curated docs for AI coding agents with team sharing",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/vietanhdev/chub"
9
+ },
10
+ "bin": {
11
+ "chub": "bin/chub.js"
12
+ },
13
+ "optionalDependencies": {
14
+ "@nrl-ai/chub-linux-x64": "0.1.3",
15
+ "@nrl-ai/chub-linux-arm64": "0.1.3",
16
+ "@nrl-ai/chub-darwin-x64": "0.1.3",
17
+ "@nrl-ai/chub-darwin-arm64": "0.1.3",
18
+ "@nrl-ai/chub-win32-x64": "0.1.3"
19
+ },
20
+ "engines": {
21
+ "node": ">=16"
22
+ }
23
+ }