tree-worm 0.0.1
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/bin/tree-worm +64 -0
- package/package.json +28 -0
package/bin/tree-worm
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { platform, arch, env } = process;
|
|
4
|
+
const { execSync } = require("child_process");
|
|
5
|
+
|
|
6
|
+
function isMusl() {
|
|
7
|
+
if (platform !== "linux") return false;
|
|
8
|
+
try {
|
|
9
|
+
const out = execSync("ldd --version", {
|
|
10
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
11
|
+
});
|
|
12
|
+
return out.toString().includes("musl");
|
|
13
|
+
} catch (e) {
|
|
14
|
+
return ((e.stderr || "").toString()).includes("musl");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const PLATFORMS = {
|
|
19
|
+
win32: {
|
|
20
|
+
x64: "tree-worm-win32-x64/tree-worm.exe",
|
|
21
|
+
},
|
|
22
|
+
darwin: {
|
|
23
|
+
x64: "tree-worm-darwin-x64/tree-worm",
|
|
24
|
+
arm64: "tree-worm-darwin-arm64/tree-worm",
|
|
25
|
+
},
|
|
26
|
+
linux: {
|
|
27
|
+
x64: "tree-worm-linux-x64/tree-worm",
|
|
28
|
+
arm64: "tree-worm-linux-arm64/tree-worm",
|
|
29
|
+
},
|
|
30
|
+
"linux-musl": {
|
|
31
|
+
x64: "tree-worm-linux-x64-musl/tree-worm",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const key = platform === "linux" && isMusl() ? "linux-musl" : platform;
|
|
36
|
+
const binPath = env.TREE_WORM_BINARY || PLATFORMS?.[key]?.[arch];
|
|
37
|
+
|
|
38
|
+
if (!binPath) {
|
|
39
|
+
console.error(
|
|
40
|
+
`tree-worm: unsupported platform ${platform}-${arch}. ` +
|
|
41
|
+
`Open an issue at https://github.com/AdrianMedworTreeworm/tree-worm/issues`
|
|
42
|
+
);
|
|
43
|
+
process.exitCode = 1;
|
|
44
|
+
} else {
|
|
45
|
+
let resolvedPath;
|
|
46
|
+
try {
|
|
47
|
+
resolvedPath = env.TREE_WORM_BINARY || require.resolve(binPath);
|
|
48
|
+
} catch {
|
|
49
|
+
console.error(
|
|
50
|
+
`tree-worm: could not find the native binary for ${platform}-${arch}.\n` +
|
|
51
|
+
`Make sure the platform package is installed: npm install tree-worm-${key === "linux-musl" ? "linux-x64-musl" : key + "-" + arch}\n` +
|
|
52
|
+
`Or set TREE_WORM_BINARY to the path of the tree-worm binary.`
|
|
53
|
+
);
|
|
54
|
+
process.exitCode = 1;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const result = require("child_process").spawnSync(
|
|
58
|
+
resolvedPath,
|
|
59
|
+
process.argv.slice(2),
|
|
60
|
+
{ shell: false, stdio: "inherit" }
|
|
61
|
+
);
|
|
62
|
+
if (result.error) throw result.error;
|
|
63
|
+
process.exitCode = result.status;
|
|
64
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tree-worm",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A local code intelligence MCP server using Tree-sitter, SQLite FTS5, and Call Graphs",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/andmev/tree-worm.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"tree-worm": "bin/tree-worm"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/tree-worm",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"optionalDependencies": {
|
|
21
|
+
"tree-worm-darwin-arm64": "0.0.1",
|
|
22
|
+
"tree-worm-darwin-x64": "0.0.1",
|
|
23
|
+
"tree-worm-linux-x64": "0.0.1",
|
|
24
|
+
"tree-worm-linux-arm64": "0.0.1",
|
|
25
|
+
"tree-worm-linux-x64-musl": "0.0.1",
|
|
26
|
+
"tree-worm-win32-x64": "0.0.1"
|
|
27
|
+
}
|
|
28
|
+
}
|