cachebro 0.1.0 → 0.2.0
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 +7 -11
- package/dist/cli.mjs +67 -15
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -48,20 +48,12 @@ The cache persists in a local [Turso](https://turso.tech) (SQLite-compatible) da
|
|
|
48
48
|
## Installation
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
npx cachebro
|
|
51
|
+
npx cachebro init # auto-configures Claude Code, Cursor, OpenCode
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
That's it. Restart your editor and cachebro is active. Agents discover it automatically.
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
npm install -g cachebro
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Usage
|
|
61
|
-
|
|
62
|
-
### As an MCP server (recommended)
|
|
63
|
-
|
|
64
|
-
Add to your `.claude/settings.json`, `.cursor/mcp.json`, or any MCP-compatible agent config:
|
|
56
|
+
Or configure manually — add to your MCP config (`.claude.json`, `.cursor/mcp.json`, etc.):
|
|
65
57
|
|
|
66
58
|
```json
|
|
67
59
|
{
|
|
@@ -74,6 +66,10 @@ Add to your `.claude/settings.json`, `.cursor/mcp.json`, or any MCP-compatible a
|
|
|
74
66
|
}
|
|
75
67
|
```
|
|
76
68
|
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
### As an MCP server (recommended)
|
|
72
|
+
|
|
77
73
|
The MCP server exposes 4 tools:
|
|
78
74
|
|
|
79
75
|
| Tool | Description |
|
package/dist/cli.mjs
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @bun
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
-
var __create = Object.create;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __defProp = Object.defineProperty;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
10
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
11
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
12
|
-
for (let key of __getOwnPropNames(mod))
|
|
13
|
-
if (!__hasOwnProp.call(to, key))
|
|
14
|
-
__defProp(to, key, {
|
|
15
|
-
get: () => mod[key],
|
|
16
|
-
enumerable: true
|
|
17
|
-
});
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
5
|
var __export = (target, all) => {
|
|
21
6
|
for (var name in all)
|
|
22
7
|
__defProp(target, name, {
|
|
@@ -629,10 +614,77 @@ if (!command || command === "serve") {
|
|
|
629
614
|
console.log(` Files tracked: ${stats.filesTracked}`);
|
|
630
615
|
console.log(` Tokens saved (total): ~${stats.tokensSaved.toLocaleString()}`);
|
|
631
616
|
await cache.close();
|
|
617
|
+
} else if (command === "init") {
|
|
618
|
+
const { existsSync: existsSync2, readFileSync, writeFileSync, mkdirSync: mkdirSync2 } = await import("fs");
|
|
619
|
+
const { join } = await import("path");
|
|
620
|
+
const { homedir } = await import("os");
|
|
621
|
+
const home = homedir();
|
|
622
|
+
const mcpServersEntry = {
|
|
623
|
+
command: "npx",
|
|
624
|
+
args: ["cachebro", "serve"]
|
|
625
|
+
};
|
|
626
|
+
const opencodeMcpEntry = {
|
|
627
|
+
type: "local",
|
|
628
|
+
command: ["npx", "cachebro", "serve"]
|
|
629
|
+
};
|
|
630
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join(home, ".config");
|
|
631
|
+
const targets = [
|
|
632
|
+
{
|
|
633
|
+
name: "Claude Code",
|
|
634
|
+
path: join(home, ".claude.json"),
|
|
635
|
+
key: "mcpServers",
|
|
636
|
+
entry: mcpServersEntry
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
name: "Cursor",
|
|
640
|
+
path: join(home, ".cursor", "mcp.json"),
|
|
641
|
+
key: "mcpServers",
|
|
642
|
+
entry: mcpServersEntry
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
name: "OpenCode",
|
|
646
|
+
path: join(xdgConfig, "opencode", "opencode.json"),
|
|
647
|
+
key: "mcp",
|
|
648
|
+
entry: opencodeMcpEntry
|
|
649
|
+
}
|
|
650
|
+
];
|
|
651
|
+
let configured = 0;
|
|
652
|
+
for (const target of targets) {
|
|
653
|
+
const dir = join(target.path, "..");
|
|
654
|
+
if (!existsSync2(dir))
|
|
655
|
+
continue;
|
|
656
|
+
let config = {};
|
|
657
|
+
if (existsSync2(target.path)) {
|
|
658
|
+
try {
|
|
659
|
+
config = JSON.parse(readFileSync(target.path, "utf-8"));
|
|
660
|
+
} catch {
|
|
661
|
+
config = {};
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
if (config[target.key]?.cachebro) {
|
|
665
|
+
console.log(` ${target.name}: already configured`);
|
|
666
|
+
configured++;
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
669
|
+
config[target.key] = config[target.key] ?? {};
|
|
670
|
+
config[target.key].cachebro = target.entry;
|
|
671
|
+
writeFileSync(target.path, JSON.stringify(config, null, 2) + `
|
|
672
|
+
`);
|
|
673
|
+
console.log(` ${target.name}: configured (${target.path})`);
|
|
674
|
+
configured++;
|
|
675
|
+
}
|
|
676
|
+
if (configured === 0) {
|
|
677
|
+
console.log("No supported tools detected. You can manually add cachebro to your MCP config:");
|
|
678
|
+
console.log(JSON.stringify({ mcpServers: { cachebro: mcpServersEntry } }, null, 2));
|
|
679
|
+
} else {
|
|
680
|
+
console.log(`
|
|
681
|
+
Done! Restart your editor to pick up cachebro.`);
|
|
682
|
+
}
|
|
632
683
|
} else if (command === "help" || command === "--help") {
|
|
633
684
|
console.log(`cachebro - Agent file cache with diff tracking
|
|
634
685
|
|
|
635
686
|
Usage:
|
|
687
|
+
cachebro init Auto-configure cachebro for your editor
|
|
636
688
|
cachebro serve Start the MCP server (default)
|
|
637
689
|
cachebro status Show cache statistics
|
|
638
690
|
cachebro help Show this help message
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cachebro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "File cache with diff tracking for AI coding agents. Drop-in replacement for file reads that saves ~26% tokens.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/
|
|
45
|
+
"url": "https://github.com/glommer/cachebro"
|
|
46
46
|
},
|
|
47
|
-
"homepage": "https://github.com/
|
|
47
|
+
"homepage": "https://github.com/glommer/cachebro"
|
|
48
48
|
}
|