project-brain 0.2.1 → 0.3.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/project-brain +26 -8
- package/package.json +7 -11
- package/scripts/postinstall.js +0 -77
package/bin/project-brain
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { execFileSync } from "child_process";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { existsSync } from "fs";
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
import { join } from "path";
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
const nativeBin = join(__dirname, "project-brain-native");
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const pkgMap = {
|
|
9
|
+
"darwin-arm64": "project-brain-darwin-arm64",
|
|
10
|
+
"linux-x64": "project-brain-linux-x64",
|
|
11
|
+
"linux-arm64": "project-brain-linux-arm64",
|
|
12
|
+
"win32-x64": "project-brain-windows-x64",
|
|
13
|
+
"win32-arm64": "project-brain-windows-arm64",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const key = `${process.platform}-${process.arch}`;
|
|
17
|
+
const pkgName = pkgMap[key];
|
|
18
|
+
|
|
19
|
+
if (!pkgName) {
|
|
20
|
+
console.error(`project-brain: unsupported platform ${key}`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let pkgDir;
|
|
25
|
+
try {
|
|
26
|
+
pkgDir = join(require.resolve(`${pkgName}/package.json`), "..");
|
|
27
|
+
} catch {
|
|
28
|
+
console.error(`project-brain: platform package "${pkgName}" not installed. Reinstall project-brain.`);
|
|
12
29
|
process.exit(1);
|
|
13
30
|
}
|
|
14
31
|
|
|
15
|
-
|
|
32
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
33
|
+
execFileSync(join(pkgDir, "bin", `project-brain-native${ext}`), process.argv.slice(2), { stdio: "inherit" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "project-brain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local-first MCP server that gives AI tools semantic memory of your codebase.",
|
|
6
6
|
"author": "jcsoftdev",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
],
|
|
21
21
|
"files": [
|
|
22
22
|
"bin",
|
|
23
|
-
"scripts",
|
|
24
23
|
"templates",
|
|
25
24
|
"README.md",
|
|
26
25
|
"LICENSE"
|
|
@@ -33,8 +32,7 @@
|
|
|
33
32
|
"test": "bun test",
|
|
34
33
|
"setup": "bun run src/cli.ts setup",
|
|
35
34
|
"init": "bun run src/cli.ts init",
|
|
36
|
-
"build": "bun build ./src/cli.ts --compile --outfile dist/project-brain"
|
|
37
|
-
"postinstall": "node scripts/postinstall.js"
|
|
35
|
+
"build": "bun build ./src/cli.ts --compile --outfile dist/project-brain"
|
|
38
36
|
},
|
|
39
37
|
"dependencies": {
|
|
40
38
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
@@ -43,13 +41,11 @@
|
|
|
43
41
|
"zod": "^4.4.3"
|
|
44
42
|
},
|
|
45
43
|
"optionalDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"@lancedb/lancedb-win32-x64-msvc": "0.30.0",
|
|
52
|
-
"@lancedb/lancedb-win32-arm64-msvc": "0.30.0"
|
|
44
|
+
"project-brain-darwin-arm64": "0.3.1",
|
|
45
|
+
"project-brain-linux-x64": "0.3.1",
|
|
46
|
+
"project-brain-linux-arm64": "0.3.1",
|
|
47
|
+
"project-brain-windows-x64": "0.3.1",
|
|
48
|
+
"project-brain-windows-arm64": "0.3.1"
|
|
53
49
|
},
|
|
54
50
|
"devDependencies": {
|
|
55
51
|
"@types/bun": "latest",
|
package/scripts/postinstall.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createWriteStream, mkdirSync, chmodSync, existsSync } from "fs";
|
|
3
|
-
import { join, dirname } from "path";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
import { get } from "https";
|
|
6
|
-
|
|
7
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
const pkg = JSON.parse(
|
|
9
|
-
await import("fs").then((fs) =>
|
|
10
|
-
fs.promises.readFile(join(__dirname, "../package.json"), "utf-8")
|
|
11
|
-
)
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
const VERSION = pkg.version;
|
|
15
|
-
const REPO = "jcsoftdev/project-brain";
|
|
16
|
-
|
|
17
|
-
const platform = process.platform; // darwin, linux, win32
|
|
18
|
-
const arch = process.arch; // arm64, x64
|
|
19
|
-
|
|
20
|
-
const targetMap = {
|
|
21
|
-
"darwin-arm64": "darwin-arm64",
|
|
22
|
-
"linux-x64": "linux-x64",
|
|
23
|
-
"linux-arm64": "linux-arm64",
|
|
24
|
-
"win32-x64": "windows-x64",
|
|
25
|
-
"win32-arm64": "windows-arm64",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const key = `${platform}-${arch}`;
|
|
29
|
-
const target = targetMap[key];
|
|
30
|
-
|
|
31
|
-
if (!target) {
|
|
32
|
-
console.error(`project-brain: unsupported platform ${key}. Skipping binary download.`);
|
|
33
|
-
process.exit(0);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const ext = platform === "win32" ? ".exe" : "";
|
|
37
|
-
const binaryName = `project-brain-${target}${ext}`;
|
|
38
|
-
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}`;
|
|
39
|
-
const destDir = join(__dirname, "../bin");
|
|
40
|
-
const destPath = join(destDir, `project-brain-native${ext}`);
|
|
41
|
-
|
|
42
|
-
if (existsSync(destPath)) {
|
|
43
|
-
process.exit(0);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
mkdirSync(destDir, { recursive: true });
|
|
47
|
-
|
|
48
|
-
console.log(`project-brain: downloading binary for ${key}...`);
|
|
49
|
-
|
|
50
|
-
function download(url, dest) {
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
const file = createWriteStream(dest);
|
|
53
|
-
const request = (u) =>
|
|
54
|
-
get(u, (res) => {
|
|
55
|
-
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
56
|
-
return request(res.headers.location);
|
|
57
|
-
}
|
|
58
|
-
if (res.statusCode !== 200) {
|
|
59
|
-
reject(new Error(`HTTP ${res.statusCode} for ${u}`));
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
res.pipe(file);
|
|
63
|
-
file.on("finish", () => file.close(resolve));
|
|
64
|
-
}).on("error", reject);
|
|
65
|
-
request(url);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
await download(url, destPath);
|
|
71
|
-
chmodSync(destPath, 0o755);
|
|
72
|
-
console.log(`project-brain: binary installed.`);
|
|
73
|
-
} catch (err) {
|
|
74
|
-
console.error(`project-brain: failed to download binary — ${err.message}`);
|
|
75
|
-
console.error(`project-brain: manual download: ${url}`);
|
|
76
|
-
process.exit(0);
|
|
77
|
-
}
|