brain-cache 0.3.3 → 0.3.4
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/dist/claude-md-section-YPMDPAPW.js +34 -0
- package/dist/cli.js +4 -4
- package/dist/{init-ILR3VJNO.js → init-L4CMLYVY.js} +1 -7
- package/dist/mcp.js +1 -1
- package/package.json +1 -1
- package/dist/{askCodebase-OAAG35G5.js → askCodebase-WOFIJMSU.js} +3 -3
- package/dist/{workflows-SYWKVVOK.js → workflows-ZC24RRNX.js} +3 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/lib/claude-md-section.ts
|
|
4
|
+
var CLAUDE_MD_SECTION = `
|
|
5
|
+
## Brain-Cache MCP Tools
|
|
6
|
+
|
|
7
|
+
**IMPORTANT: Use brain-cache tools as your FIRST action before reading files or using Grep/Glob.**
|
|
8
|
+
|
|
9
|
+
### build_context (use for understanding)
|
|
10
|
+
|
|
11
|
+
Call \`mcp__brain-cache__build_context\` with the user's question BEFORE reading individual files. This retrieves semantically relevant code from across the entire repo, deduplicates it, and returns a token-budgeted context block.
|
|
12
|
+
|
|
13
|
+
**Always use for questions like:**
|
|
14
|
+
- "How does X work?" / "Explain X end to end"
|
|
15
|
+
- "Walk me through the flow of X"
|
|
16
|
+
- "What does this page/feature/component do?"
|
|
17
|
+
- "Explain the architecture" / "How is the project structured?"
|
|
18
|
+
- "What happens when Y is called?"
|
|
19
|
+
- Any question that requires understanding code across multiple files
|
|
20
|
+
- Debugging unfamiliar code paths or understanding error flows
|
|
21
|
+
|
|
22
|
+
**Do NOT skip this tool and jump to reading files.** build_context returns better results with fewer tokens than manually reading files.
|
|
23
|
+
|
|
24
|
+
### search_codebase (use for locating)
|
|
25
|
+
|
|
26
|
+
Call \`mcp__brain-cache__search_codebase\` instead of Grep or Glob when locating functions, symbols, types, definitions, or implementations. It uses semantic search \u2014 finds code by meaning, not just keyword match.
|
|
27
|
+
|
|
28
|
+
### doctor (use for diagnosing)
|
|
29
|
+
|
|
30
|
+
Call \`mcp__brain-cache__doctor\` first when any brain-cache tool fails or returns unexpected results.
|
|
31
|
+
`;
|
|
32
|
+
export {
|
|
33
|
+
CLAUDE_MD_SECTION
|
|
34
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
|
|
6
6
|
// src/cli/index.ts
|
|
7
7
|
import { Command } from "commander";
|
|
8
|
-
var version = "0.3.
|
|
8
|
+
var version = "0.3.4";
|
|
9
9
|
var program = new Command();
|
|
10
10
|
program.name("brain-cache").description("Local AI runtime \u2014 GPU cache layer for Claude").version(version);
|
|
11
11
|
program.command("init").description("Detect hardware, pull embedding model, create config directory").action(async () => {
|
|
12
|
-
const { runInit } = await import("./init-
|
|
12
|
+
const { runInit } = await import("./init-L4CMLYVY.js");
|
|
13
13
|
await runInit();
|
|
14
14
|
});
|
|
15
15
|
program.command("doctor").description("Report system health: GPU, VRAM tier, Ollama status").action(async () => {
|
|
@@ -17,7 +17,7 @@ program.command("doctor").description("Report system health: GPU, VRAM tier, Oll
|
|
|
17
17
|
await runDoctor();
|
|
18
18
|
});
|
|
19
19
|
program.command("index").description("Index a codebase: parse, chunk, embed, and store in LanceDB").argument("[path]", "Directory to index (defaults to current directory)").option("-f, --force", "Force full reindex, ignoring cached file hashes").action(async (path, opts) => {
|
|
20
|
-
const { runIndex } = await import("./workflows-
|
|
20
|
+
const { runIndex } = await import("./workflows-ZC24RRNX.js");
|
|
21
21
|
await runIndex(path, { force: opts.force });
|
|
22
22
|
});
|
|
23
23
|
program.command("search").description("Search indexed codebase with a natural language query").argument("<query>", "Natural language query string").option("-n, --limit <n>", "Maximum number of results", "10").option("-p, --path <path>", "Project root directory").action(async (query, opts) => {
|
|
@@ -61,7 +61,7 @@ ${formatTokenSavings({ tokensSent: result.metadata.tokensSent, estimatedWithout,
|
|
|
61
61
|
program.command("ask").description(
|
|
62
62
|
"Ask a natural language question about the codebase \u2014 retrieves context locally, reasons via Claude"
|
|
63
63
|
).argument("<question>", "Natural language question about the codebase").option("-b, --budget <tokens>", "Token budget for context retrieval", "4096").option("-p, --path <path>", "Project root directory").action(async (question, opts) => {
|
|
64
|
-
const { runAskCodebase } = await import("./askCodebase-
|
|
64
|
+
const { runAskCodebase } = await import("./askCodebase-WOFIJMSU.js");
|
|
65
65
|
const result = await runAskCodebase(question, {
|
|
66
66
|
path: opts.path,
|
|
67
67
|
maxContextTokens: parseInt(opts.budget, 10)
|
|
@@ -86,13 +86,7 @@ async function runInit() {
|
|
|
86
86
|
process.stderr.write("brain-cache: created .mcp.json with brain-cache MCP server.\n");
|
|
87
87
|
}
|
|
88
88
|
const claudeMdPath = "CLAUDE.md";
|
|
89
|
-
const brainCacheSection =
|
|
90
|
-
## Brain-Cache MCP Tools
|
|
91
|
-
|
|
92
|
-
When answering "how does X work", "explain the architecture", or any question requiring multi-file reasoning, call \`mcp__brain-cache__build_context\` with the question BEFORE reading individual files. It returns pre-built, relevant context with token savings.
|
|
93
|
-
|
|
94
|
-
When locating functions, symbols, types, or definitions, call \`mcp__brain-cache__search_codebase\` instead of using Grep or file-find tools. It searches the local vector index and returns ranked results.
|
|
95
|
-
`;
|
|
89
|
+
const { CLAUDE_MD_SECTION: brainCacheSection } = await import("./claude-md-section-YPMDPAPW.js");
|
|
96
90
|
if (existsSync(claudeMdPath)) {
|
|
97
91
|
const content = readFileSync(claudeMdPath, "utf-8");
|
|
98
92
|
if (content.includes("## Brain-Cache MCP Tools")) {
|
package/dist/mcp.js
CHANGED
|
@@ -1144,7 +1144,7 @@ async function runBuildContext(query, opts) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
|
|
1146
1146
|
// src/mcp/index.ts
|
|
1147
|
-
var version = "0.3.
|
|
1147
|
+
var version = "0.3.4";
|
|
1148
1148
|
var log9 = childLogger("mcp");
|
|
1149
1149
|
var server = new McpServer({ name: "brain-cache", version });
|
|
1150
1150
|
server.registerTool(
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
formatTokenSavings
|
|
4
|
-
} from "./chunk-GGOUKACO.js";
|
|
5
2
|
import {
|
|
6
3
|
runBuildContext
|
|
7
4
|
} from "./chunk-QNPB2UD2.js";
|
|
8
5
|
import "./chunk-5FXXZBZV.js";
|
|
6
|
+
import {
|
|
7
|
+
formatTokenSavings
|
|
8
|
+
} from "./chunk-GGOUKACO.js";
|
|
9
9
|
import "./chunk-BF5UDEIF.js";
|
|
10
10
|
import "./chunk-GR6QXZ4J.js";
|
|
11
11
|
import "./chunk-V4ARVFRG.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
formatTokenSavings
|
|
4
|
-
} from "./chunk-GGOUKACO.js";
|
|
5
2
|
import {
|
|
6
3
|
countChunkTokens
|
|
7
4
|
} from "./chunk-5FXXZBZV.js";
|
|
5
|
+
import {
|
|
6
|
+
formatTokenSavings
|
|
7
|
+
} from "./chunk-GGOUKACO.js";
|
|
8
8
|
import {
|
|
9
9
|
embedBatchWithRetry
|
|
10
10
|
} from "./chunk-GR6QXZ4J.js";
|