@betterdb/memory 0.1.0 → 0.1.2
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 +5 -6
- package/package.json +1 -1
- package/src/index.ts +20 -23
package/README.md
CHANGED
|
@@ -16,8 +16,7 @@ relevant history at the start of each new session.
|
|
|
16
16
|
### Install
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
|
|
20
|
-
npx @betterdb/memory install
|
|
19
|
+
bunx @betterdb/memory install
|
|
21
20
|
```
|
|
22
21
|
|
|
23
22
|
This will:
|
|
@@ -46,10 +45,10 @@ Claude can use these mid-conversation:
|
|
|
46
45
|
### CLI Commands
|
|
47
46
|
|
|
48
47
|
```bash
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
bunx @betterdb/memory install # Set up hooks + MCP server
|
|
49
|
+
bunx @betterdb/memory status # Check health
|
|
50
|
+
bunx @betterdb/memory uninstall # Remove everything
|
|
51
|
+
bunx @betterdb/memory maintain # Run aging/compression manually
|
|
53
52
|
```
|
|
54
53
|
|
|
55
54
|
### Configuration
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -21,6 +21,14 @@ const CONFIG_PATH = join(BETTERDB_DIR, "memory.json");
|
|
|
21
21
|
const MANIFEST_PATH = join(BETTERDB_DIR, "install-manifest.json");
|
|
22
22
|
const PKG_ROOT = resolve(import.meta.dir, "..");
|
|
23
23
|
|
|
24
|
+
const BINARIES = [
|
|
25
|
+
{ src: "src/hooks/session-start.ts", out: "session-start" },
|
|
26
|
+
{ src: "src/hooks/session-end.ts", out: "session-end" },
|
|
27
|
+
{ src: "src/hooks/pre-tool.ts", out: "pre-tool" },
|
|
28
|
+
{ src: "src/hooks/post-tool.ts", out: "post-tool" },
|
|
29
|
+
{ src: "src/mcp/server.ts", out: "mcp-server" },
|
|
30
|
+
] as const;
|
|
31
|
+
|
|
24
32
|
const USAGE = `
|
|
25
33
|
BetterDB Memory for Claude Code v${VERSION}
|
|
26
34
|
|
|
@@ -76,14 +84,6 @@ switch (command) {
|
|
|
76
84
|
// install
|
|
77
85
|
// ---------------------------------------------------------------------------
|
|
78
86
|
|
|
79
|
-
const BINARIES = [
|
|
80
|
-
{ src: "src/hooks/session-start.ts", out: "session-start" },
|
|
81
|
-
{ src: "src/hooks/session-end.ts", out: "session-end" },
|
|
82
|
-
{ src: "src/hooks/pre-tool.ts", out: "pre-tool" },
|
|
83
|
-
{ src: "src/hooks/post-tool.ts", out: "post-tool" },
|
|
84
|
-
{ src: "src/mcp/server.ts", out: "mcp-server" },
|
|
85
|
-
] as const;
|
|
86
|
-
|
|
87
87
|
async function runInstall() {
|
|
88
88
|
console.log("BetterDB Memory for Claude Code — Install\n");
|
|
89
89
|
|
|
@@ -185,21 +185,17 @@ async function runInstall() {
|
|
|
185
185
|
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
186
186
|
console.log(" Registered 4 hooks in ~/.claude/settings.json");
|
|
187
187
|
|
|
188
|
-
// Register MCP server
|
|
189
|
-
const
|
|
190
|
-
|
|
188
|
+
// Register MCP server globally (-s user) so it's available in all projects
|
|
189
|
+
const mcpBin = join(BIN_DIR, "mcp-server");
|
|
190
|
+
Bun.spawnSync(["claude", "mcp", "remove", "-s", "user", "betterdb-memory"]);
|
|
191
|
+
const mcpResult = Bun.spawnSync([
|
|
192
|
+
"claude", "mcp", "add", "-s", "user", "betterdb-memory", "--", mcpBin,
|
|
193
|
+
]);
|
|
191
194
|
if (mcpResult.exitCode === 0) {
|
|
192
|
-
console.log(" Registered MCP server: betterdb-memory");
|
|
195
|
+
console.log(" Registered MCP server: betterdb-memory (global)");
|
|
193
196
|
} else {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const retry = Bun.spawnSync(["claude", "mcp", "add-json", "betterdb-memory", mcpConfig]);
|
|
197
|
-
if (retry.exitCode === 0) {
|
|
198
|
-
console.log(" Registered MCP server: betterdb-memory (replaced existing)");
|
|
199
|
-
} else {
|
|
200
|
-
console.log(" WARNING: MCP registration failed — register manually:");
|
|
201
|
-
console.log(` claude mcp add-json betterdb-memory '${mcpConfig}'`);
|
|
202
|
-
}
|
|
197
|
+
console.log(" WARNING: MCP registration failed — register manually:");
|
|
198
|
+
console.log(` claude mcp add -s user betterdb-memory -- ${mcpBin}`);
|
|
203
199
|
}
|
|
204
200
|
|
|
205
201
|
// 5. SETUP VALKEY INDEX
|
|
@@ -285,8 +281,9 @@ async function runUninstall() {
|
|
|
285
281
|
}
|
|
286
282
|
}
|
|
287
283
|
|
|
288
|
-
// Remove MCP server
|
|
289
|
-
|
|
284
|
+
// Remove MCP server (try both user and local scope)
|
|
285
|
+
Bun.spawnSync(["claude", "mcp", "remove", "-s", "local", "betterdb-memory"]);
|
|
286
|
+
const mcpResult = Bun.spawnSync(["claude", "mcp", "remove", "-s", "user", "betterdb-memory"]);
|
|
290
287
|
if (mcpResult.exitCode === 0) {
|
|
291
288
|
console.log(" Removed MCP server: betterdb-memory");
|
|
292
289
|
} else {
|