lean-ctx-bin 2.9.6 → 2.9.8

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/package.json +1 -1
  2. package/postinstall.js +24 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lean-ctx-bin",
3
- "version": "2.9.6",
3
+ "version": "2.9.8",
4
4
  "description": "lean-ctx — the token-efficient context tool for LLM coding agents. Installs a pre-built binary, no Rust required.",
5
5
  "keywords": ["lean-ctx", "mcp", "llm", "context", "claude", "cursor", "ai", "token-optimization"],
6
6
  "homepage": "https://leanctx.com",
package/postinstall.js CHANGED
@@ -13,14 +13,36 @@ const IS_WIN = process.platform === "win32";
13
13
  const BINARY_NAME = IS_WIN ? "lean-ctx.exe" : "lean-ctx";
14
14
  const BINARY_PATH = path.join(BIN_DIR, BINARY_NAME);
15
15
 
16
+ function getGlibcVersion() {
17
+ try {
18
+ const out = execSync("ldd --version 2>&1 || true", { encoding: "utf8" });
19
+ const match = out.match(/(\d+)\.(\d+)\s*$/m);
20
+ if (match) return { major: parseInt(match[1]), minor: parseInt(match[2]) };
21
+ } catch {}
22
+ return null;
23
+ }
24
+
16
25
  function getTarget() {
17
26
  const platform = process.platform;
18
27
  const arch = process.arch;
19
28
 
29
+ if (platform === "linux") {
30
+ let libc = "musl";
31
+ const glibc = getGlibcVersion();
32
+ if (glibc && (glibc.major > 2 || (glibc.major === 2 && glibc.minor >= 35))) {
33
+ libc = "gnu";
34
+ }
35
+ const archMap = { x64: "x86_64", arm64: "aarch64" };
36
+ const rustArch = archMap[arch];
37
+ if (!rustArch) {
38
+ console.error(`Unsupported architecture: ${arch}`);
39
+ process.exit(1);
40
+ }
41
+ return `${rustArch}-unknown-linux-${libc}`;
42
+ }
43
+
20
44
  const key = `${platform}-${arch}`;
21
45
  const targets = {
22
- "linux-x64": "x86_64-unknown-linux-gnu",
23
- "linux-arm64": "aarch64-unknown-linux-gnu",
24
46
  "darwin-x64": "x86_64-apple-darwin",
25
47
  "darwin-arm64": "aarch64-apple-darwin",
26
48
  "win32-x64": "x86_64-pc-windows-msvc",