basemind 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/README.md +55 -0
- package/index.js +8 -0
- package/install.js +143 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# basemind
|
|
2
|
+
|
|
3
|
+
**Give your AI coding agent a brain for your repo.**
|
|
4
|
+
|
|
5
|
+
basemind is a code-map MCP server: it indexes your codebase into a queryable map
|
|
6
|
+
so AI coding agents — Claude Code, Cursor, Continue, anything that speaks
|
|
7
|
+
[MCP](https://modelcontextprotocol.io) — get instant semantic answers about your
|
|
8
|
+
code. Where is this defined? Who calls it? When did it change? What's churning?
|
|
9
|
+
|
|
10
|
+
Sub-millisecond queries. 300+ languages out of the box. Local-only. Built in Rust.
|
|
11
|
+
|
|
12
|
+
[](https://github.com/Goldziher/basemind/blob/main/LICENSE)
|
|
13
|
+
[](https://www.npmjs.com/package/basemind)
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g basemind
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The installer downloads the appropriate pre-compiled Rust binary for your
|
|
22
|
+
platform (macOS, Linux, Windows; x86_64 + arm64) from
|
|
23
|
+
[GitHub Releases](https://github.com/Goldziher/basemind/releases) on first
|
|
24
|
+
install.
|
|
25
|
+
|
|
26
|
+
## Quickstart
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cd /path/to/your/repo
|
|
30
|
+
basemind scan # index the working tree
|
|
31
|
+
basemind serve # run the MCP stdio server
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Wire `basemind serve` into Claude Code (`~/.claude.json`) or any MCP client:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"basemind": {
|
|
40
|
+
"command": "basemind",
|
|
41
|
+
"args": ["serve"],
|
|
42
|
+
"cwd": "/abs/path/to/your/repo"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
49
|
+
|
|
50
|
+
Full docs, architecture, and the complete MCP tool table at
|
|
51
|
+
[github.com/Goldziher/basemind](https://github.com/Goldziher/basemind).
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
[MIT](https://github.com/Goldziher/basemind/blob/main/LICENSE).
|
package/index.js
ADDED
package/install.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
const fs = require("node:fs");
|
|
2
|
+
const os = require("node:os");
|
|
3
|
+
const path = require("node:path");
|
|
4
|
+
const https = require("node:https");
|
|
5
|
+
const http = require("node:http");
|
|
6
|
+
const tar = require("tar");
|
|
7
|
+
const AdmZip = require("adm-zip");
|
|
8
|
+
|
|
9
|
+
const { version } = require("./package.json");
|
|
10
|
+
|
|
11
|
+
function getPlatformTriple() {
|
|
12
|
+
const type = os.type();
|
|
13
|
+
const arch = os.arch();
|
|
14
|
+
|
|
15
|
+
if (type === "Windows_NT") {
|
|
16
|
+
if (arch === "x64") return "x86_64-pc-windows-gnu";
|
|
17
|
+
if (arch === "ia32") throw new Error("32-bit Windows is not supported");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (type === "Linux") {
|
|
21
|
+
if (arch === "x64") return "x86_64-unknown-linux-gnu";
|
|
22
|
+
if (arch === "arm64") return "aarch64-unknown-linux-gnu";
|
|
23
|
+
return "x86_64-unknown-linux-gnu";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (type === "Darwin") {
|
|
27
|
+
if (arch === "x64") return "x86_64-apple-darwin";
|
|
28
|
+
if (arch === "arm64") return "aarch64-apple-darwin";
|
|
29
|
+
return "x86_64-apple-darwin";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
throw new Error(`Unsupported platform: ${type} ${arch}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getBinaryUrl() {
|
|
36
|
+
const platform = getPlatformTriple();
|
|
37
|
+
const baseUrl = `https://github.com/Goldziher/basemind/releases/download/v${version}`;
|
|
38
|
+
const ext = platform.includes("windows") ? "zip" : "tar.gz";
|
|
39
|
+
return `${baseUrl}/basemind-${platform}.${ext}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function downloadWithRedirects(url, dest, maxRedirects = 5) {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
if (maxRedirects <= 0) {
|
|
45
|
+
return reject(new Error("Too many redirects"));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const urlObj = new URL(url);
|
|
49
|
+
const client = urlObj.protocol === "https:" ? https : http;
|
|
50
|
+
|
|
51
|
+
const req = client.get(
|
|
52
|
+
url,
|
|
53
|
+
{
|
|
54
|
+
headers: {
|
|
55
|
+
"User-Agent": "basemind-npm-wrapper",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
(res) => {
|
|
59
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
60
|
+
return downloadWithRedirects(res.headers.location, dest, maxRedirects - 1)
|
|
61
|
+
.then(resolve)
|
|
62
|
+
.catch(reject);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (res.statusCode !== 200) {
|
|
66
|
+
return reject(new Error(`HTTP ${res.statusCode}: ${res.statusMessage}`));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const file = fs.createWriteStream(dest);
|
|
70
|
+
res.pipe(file);
|
|
71
|
+
|
|
72
|
+
file.on("finish", () => {
|
|
73
|
+
file.close();
|
|
74
|
+
resolve();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
file.on("error", (err) => {
|
|
78
|
+
fs.unlink(dest, () => {});
|
|
79
|
+
reject(err);
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
req.on("error", reject);
|
|
85
|
+
req.setTimeout(30000, () => {
|
|
86
|
+
req.destroy();
|
|
87
|
+
reject(new Error("Download timeout"));
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function installBinary() {
|
|
93
|
+
try {
|
|
94
|
+
const url = getBinaryUrl();
|
|
95
|
+
const isZip = url.endsWith(".zip");
|
|
96
|
+
const binDir = path.join(__dirname, "bin");
|
|
97
|
+
const archivePath = path.join(binDir, isZip ? "basemind.zip" : "basemind.tar.gz");
|
|
98
|
+
const binaryName = os.type() === "Windows_NT" ? "basemind.exe" : "basemind";
|
|
99
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
100
|
+
|
|
101
|
+
if (!fs.existsSync(binDir)) {
|
|
102
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (fs.existsSync(binaryPath)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
console.log(`Downloading basemind binary from ${url}...`);
|
|
110
|
+
|
|
111
|
+
await downloadWithRedirects(url, archivePath);
|
|
112
|
+
|
|
113
|
+
console.log("Extracting binary...");
|
|
114
|
+
|
|
115
|
+
if (isZip) {
|
|
116
|
+
const zip = new AdmZip(archivePath);
|
|
117
|
+
const entry = zip.getEntries().find((e) => e.entryName.endsWith(binaryName));
|
|
118
|
+
if (!entry) {
|
|
119
|
+
throw new Error("Binary not found in downloaded archive");
|
|
120
|
+
}
|
|
121
|
+
zip.extractEntryTo(entry, binDir, false, true);
|
|
122
|
+
} else {
|
|
123
|
+
await tar.extract({
|
|
124
|
+
file: archivePath,
|
|
125
|
+
cwd: binDir,
|
|
126
|
+
filter: (entryPath) => entryPath.endsWith(binaryName),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
fs.unlinkSync(archivePath);
|
|
131
|
+
|
|
132
|
+
if (os.type() !== "Windows_NT") {
|
|
133
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
console.log("basemind binary installed successfully!");
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error("Error installing basemind binary:", error.message);
|
|
139
|
+
process.exit(1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
installBinary();
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "basemind",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Code-map MCP server + scanner — content-addressed, Fjall-backed inverted index over tree-sitter outlines",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"basemind": "bin/basemind"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node install.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"mcp",
|
|
14
|
+
"tree-sitter",
|
|
15
|
+
"code-map",
|
|
16
|
+
"scanner",
|
|
17
|
+
"indexer",
|
|
18
|
+
"basemind"
|
|
19
|
+
],
|
|
20
|
+
"author": "Na'aman Hirschfeld",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/Goldziher/basemind.git"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/Goldziher/basemind#readme",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/Goldziher/basemind/issues"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"adm-zip": "^0.5.12",
|
|
32
|
+
"tar": "^6.0.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"index.js",
|
|
36
|
+
"install.js",
|
|
37
|
+
"bin/"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=14"
|
|
41
|
+
}
|
|
42
|
+
}
|