@bike4mind/cli 0.2.17-feat-auto-context-customization.17673 → 0.2.17-feat-ripgrep-integration.17676
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/{artifactExtractor-6OWA6GIP.js → artifactExtractor-MNVIKVBH.js} +1 -1
- package/dist/{chunk-E4K7LPQC.js → chunk-6EEN6XHK.js} +2 -2
- package/dist/{chunk-D2RBSVLE.js → chunk-CHBAKX4C.js} +1 -14
- package/dist/{chunk-AZ7I44K7.js → chunk-NMWRXDTN.js} +2 -2
- package/dist/{chunk-GRCMDIFP.js → chunk-QDWMIP2Q.js} +1 -1
- package/dist/{chunk-KZNSOBD6.js → chunk-WULZDTLD.js} +2 -2
- package/dist/{create-WVVHEPCQ.js → create-SR7Q7HAF.js} +3 -3
- package/dist/index.js +136 -174
- package/dist/{llmMarkdownGenerator-PYQLOSEU.js → llmMarkdownGenerator-2APZC4H3.js} +1 -1
- package/dist/{markdownGenerator-LFZJI3XC.js → markdownGenerator-S7OHONSP.js} +1 -1
- package/dist/{mementoService-PUP3VFSA.js → mementoService-UMJ5BYDO.js} +3 -3
- package/dist/{src-CZKPMIOS.js → src-NBBLECSQ.js} +1 -1
- package/dist/{src-KALIUGCJ.js → src-VEJGC5KU.js} +2 -2
- package/dist/{subtractCredits-2HDKUWLJ.js → subtractCredits-N7Y27C34.js} +3 -3
- package/package.json +9 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CurationArtifactType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CHBAKX4C.js";
|
|
5
5
|
|
|
6
6
|
// ../../b4m-core/packages/services/dist/src/notebookCurationService/artifactExtractor.js
|
|
7
7
|
var ARTIFACT_TAG_REGEX = /<artifact\s+(.*?)>([\s\S]*?)<\/artifact>/gi;
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QDWMIP2Q.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CHBAKX4C.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -232,8 +232,6 @@ var b4mLLMTools = z3.enum([
|
|
|
232
232
|
"glob_files",
|
|
233
233
|
"grep_search",
|
|
234
234
|
"delete_file",
|
|
235
|
-
// Knowledge base search
|
|
236
|
-
"search_knowledge_base",
|
|
237
235
|
// Shell execution
|
|
238
236
|
"bash_execute"
|
|
239
237
|
]);
|
|
@@ -2020,7 +2018,6 @@ var SettingKeySchema = z19.enum([
|
|
|
2020
2018
|
"voyageApiKey",
|
|
2021
2019
|
"FirecrawlApiKey",
|
|
2022
2020
|
"EnableDeepResearch",
|
|
2023
|
-
"EnableKnowledgeBaseSearch",
|
|
2024
2021
|
"DefaultChunkSize",
|
|
2025
2022
|
"DefaultAPIModel",
|
|
2026
2023
|
"AutoNameNotebook",
|
|
@@ -2498,8 +2495,7 @@ var API_SERVICE_GROUPS = {
|
|
|
2498
2495
|
{ key: "EnableRapidReply", order: 7 },
|
|
2499
2496
|
{ key: "EnableResearchEngine", order: 8 },
|
|
2500
2497
|
{ key: "EnableReactViewer", order: 9 },
|
|
2501
|
-
{ key: "EnableDeepResearch", order: 10 }
|
|
2502
|
-
{ key: "EnableKnowledgeBaseSearch", order: 11 }
|
|
2498
|
+
{ key: "EnableDeepResearch", order: 10 }
|
|
2503
2499
|
]
|
|
2504
2500
|
},
|
|
2505
2501
|
NOTEBOOK: {
|
|
@@ -3401,15 +3397,6 @@ var settingsMap = {
|
|
|
3401
3397
|
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
3402
3398
|
order: 9
|
|
3403
3399
|
}),
|
|
3404
|
-
EnableKnowledgeBaseSearch: makeBooleanSetting({
|
|
3405
|
-
key: "EnableKnowledgeBaseSearch",
|
|
3406
|
-
name: "Enable Knowledge Base Search",
|
|
3407
|
-
defaultValue: false,
|
|
3408
|
-
description: "Allow AI to search user uploaded documents. When enabled, users can toggle the Knowledge Base Search tool in AI Settings.",
|
|
3409
|
-
category: "Experimental",
|
|
3410
|
-
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
3411
|
-
order: 11
|
|
3412
|
-
}),
|
|
3413
3400
|
enableVoiceSession: makeBooleanSetting({
|
|
3414
3401
|
key: "enableVoiceSession",
|
|
3415
3402
|
name: "Enable Voice Session",
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSettingsByNames,
|
|
7
7
|
obfuscateApiKey,
|
|
8
8
|
secureParameters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QDWMIP2Q.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiKeyType,
|
|
12
12
|
MementoTier,
|
|
13
13
|
isSupportedEmbeddingModel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CHBAKX4C.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QDWMIP2Q.js";
|
|
6
6
|
import {
|
|
7
7
|
CompletionApiUsageTransaction,
|
|
8
8
|
GenericCreditDeductTransaction,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
RealtimeVoiceUsageTransaction,
|
|
12
12
|
TextGenerationUsageTransaction,
|
|
13
13
|
TransferCreditTransaction
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-CHBAKX4C.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFabFile,
|
|
4
4
|
createFabFileSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-6EEN6XHK.js";
|
|
6
|
+
import "./chunk-QDWMIP2Q.js";
|
|
7
|
+
import "./chunk-CHBAKX4C.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
createFabFile,
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NMWRXDTN.js";
|
|
8
8
|
import {
|
|
9
9
|
ConfigStore
|
|
10
10
|
} from "./chunk-FFJX3FF3.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-WULZDTLD.js";
|
|
12
|
+
import "./chunk-6EEN6XHK.js";
|
|
13
13
|
import {
|
|
14
14
|
BFLImageService,
|
|
15
15
|
BaseStorage,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
OpenAIBackend,
|
|
22
22
|
OpenAIImageService,
|
|
23
23
|
XAIImageService
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-QDWMIP2Q.js";
|
|
25
25
|
import {
|
|
26
26
|
AiEvents,
|
|
27
27
|
ApiKeyEvents,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
XAI_IMAGE_MODELS,
|
|
76
76
|
b4mLLMTools,
|
|
77
77
|
getMcpProviderMetadata
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-CHBAKX4C.js";
|
|
79
79
|
import {
|
|
80
80
|
Logger
|
|
81
81
|
} from "./chunk-OCYRD7D6.js";
|
|
@@ -3022,6 +3022,39 @@ SUBAGENT DELEGATION:
|
|
|
3022
3022
|
- Subagents keep the main conversation clean and run faster with optimized models
|
|
3023
3023
|
- Delegate when you need to search extensively or analyze code structure
|
|
3024
3024
|
|
|
3025
|
+
CODE SEARCH BEST PRACTICES:
|
|
3026
|
+
When searching code, follow this hierarchy for speed and efficiency:
|
|
3027
|
+
|
|
3028
|
+
1. Start Narrow \u2192 Go Broad
|
|
3029
|
+
\u2705 Efficient: ${TOOL_GLOB_FILES}("src/**/*.test.ts") \u2192 ${TOOL_GREP_SEARCH}("test('user login'") \u2192 ${TOOL_FILE_READ}("src/auth/login.test.ts")
|
|
3030
|
+
\u274C Inefficient: ${TOOL_GREP_SEARCH}("login") \u2192 Read 50 files individually \u2192 Repeat with different term
|
|
3031
|
+
|
|
3032
|
+
2. Leverage Git Information
|
|
3033
|
+
Before searching, check recent changes:
|
|
3034
|
+
- ${TOOL_BASH_EXECUTE}("git log --name-only --oneline -20")
|
|
3035
|
+
- ${TOOL_BASH_EXECUTE}("git log --oneline -10 -- src/auth/")
|
|
3036
|
+
|
|
3037
|
+
3. File Patterns
|
|
3038
|
+
Use specific patterns instead of broad searches:
|
|
3039
|
+
\u2705 Good: ${TOOL_GLOB_FILES}("**/*.{ts,tsx}"), ${TOOL_GLOB_FILES}("src/components/**/Button*")
|
|
3040
|
+
\u274C Bad: ${TOOL_GLOB_FILES}("**/*"), ${TOOL_GREP_SEARCH}("auth")
|
|
3041
|
+
|
|
3042
|
+
4. Test Files as Documentation
|
|
3043
|
+
When learning about a feature, check tests first:
|
|
3044
|
+
${TOOL_GLOB_FILES}("**/*.test.{ts,tsx}") \u2192 ${TOOL_GREP_SEARCH}("describe('AuthProvider'") \u2192 ${TOOL_FILE_READ} test file \u2192 Read implementation
|
|
3045
|
+
|
|
3046
|
+
5. Batch Operations
|
|
3047
|
+
Prefer glob patterns over multiple calls:
|
|
3048
|
+
\u2705 ${TOOL_GLOB_FILES}("src/**/*.{ts,tsx,js,jsx}") (one call)
|
|
3049
|
+
\u274C 4 separate ${TOOL_GLOB_FILES} calls for each extension
|
|
3050
|
+
|
|
3051
|
+
6. Tool Selection Decision Tree
|
|
3052
|
+
Goal: Find where "AuthProvider" is defined
|
|
3053
|
+
\u2192 ${TOOL_GLOB_FILES}("**/*Auth*.{ts,tsx}") (narrow the search)
|
|
3054
|
+
\u2192 ${TOOL_GREP_SEARCH}("(class|interface|type) AuthProvider") (find exact location)
|
|
3055
|
+
\u2192 ${TOOL_FILE_READ}("src/auth/AuthProvider.tsx") (read only that file)
|
|
3056
|
+
Result: 3 tool calls instead of 10-15
|
|
3057
|
+
|
|
3025
3058
|
FOR GENERAL TASKS:
|
|
3026
3059
|
- Use available tools to get information (weather, web search, calculations, etc.)
|
|
3027
3060
|
- When user asks follow-up questions, use conversation context to understand what they're referring to
|
|
@@ -3986,9 +4019,7 @@ var updateSchema = z76.object({
|
|
|
3986
4019
|
name: z76.string().optional(),
|
|
3987
4020
|
description: z76.string().optional(),
|
|
3988
4021
|
billingContact: z76.string().optional(),
|
|
3989
|
-
currentCredits: z76.coerce.number().optional()
|
|
3990
|
-
systemPrompt: z76.string().max(1e4).optional()
|
|
3991
|
-
// ~2500 tokens
|
|
4022
|
+
currentCredits: z76.coerce.number().optional()
|
|
3992
4023
|
});
|
|
3993
4024
|
|
|
3994
4025
|
// ../../b4m-core/packages/services/dist/src/organizationService/delete.js
|
|
@@ -8511,40 +8542,39 @@ var globFilesTool = {
|
|
|
8511
8542
|
};
|
|
8512
8543
|
|
|
8513
8544
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/grepSearch/index.js
|
|
8514
|
-
import {
|
|
8515
|
-
import { readFile, stat as stat2 } from "fs/promises";
|
|
8545
|
+
import { stat as stat2 } from "fs/promises";
|
|
8516
8546
|
import path9 from "path";
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
"**/.next/**",
|
|
8524
|
-
"**/coverage/**",
|
|
8525
|
-
"**/*.min.js",
|
|
8526
|
-
"**/*.min.css",
|
|
8527
|
-
"**/package-lock.json",
|
|
8528
|
-
"**/pnpm-lock.yaml",
|
|
8529
|
-
"**/yarn.lock"
|
|
8530
|
-
];
|
|
8531
|
-
async function isBinaryFile2(filePath) {
|
|
8547
|
+
import { execFile } from "child_process";
|
|
8548
|
+
import { promisify } from "util";
|
|
8549
|
+
import { createRequire } from "module";
|
|
8550
|
+
var execFileAsync = promisify(execFile);
|
|
8551
|
+
var require2 = createRequire(import.meta.url);
|
|
8552
|
+
function getRipgrepPath() {
|
|
8532
8553
|
try {
|
|
8533
|
-
const
|
|
8534
|
-
const
|
|
8535
|
-
const
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
return chunk.includes(0);
|
|
8540
|
-
} catch {
|
|
8541
|
-
return true;
|
|
8554
|
+
const ripgrepPath = require2.resolve("@vscode/ripgrep");
|
|
8555
|
+
const ripgrepDir = path9.dirname(ripgrepPath);
|
|
8556
|
+
const rgBinary = path9.join(ripgrepDir, "..", "bin", "rg" + (process.platform === "win32" ? ".exe" : ""));
|
|
8557
|
+
return rgBinary;
|
|
8558
|
+
} catch (error) {
|
|
8559
|
+
throw new Error("ripgrep is not available. Please install @vscode/ripgrep: pnpm add @vscode/ripgrep --filter @bike4mind/services");
|
|
8542
8560
|
}
|
|
8543
8561
|
}
|
|
8544
8562
|
function isPathWithinWorkspace(targetPath, baseCwd) {
|
|
8545
8563
|
const resolvedTarget = path9.resolve(targetPath);
|
|
8546
8564
|
const resolvedBase = path9.resolve(baseCwd);
|
|
8547
|
-
|
|
8565
|
+
const relativePath = path9.relative(resolvedBase, resolvedTarget);
|
|
8566
|
+
return !relativePath.startsWith("..") && !path9.isAbsolute(relativePath);
|
|
8567
|
+
}
|
|
8568
|
+
function convertGlobToRipgrepGlobs(globPattern) {
|
|
8569
|
+
if (!globPattern || globPattern === "**/*") {
|
|
8570
|
+
return [];
|
|
8571
|
+
}
|
|
8572
|
+
const braceMatch = globPattern.match(/\*\.{([^}]+)}/);
|
|
8573
|
+
if (braceMatch) {
|
|
8574
|
+
const extensions = braceMatch[1].split(",");
|
|
8575
|
+
return extensions.map((ext) => `*.${ext.trim()}`);
|
|
8576
|
+
}
|
|
8577
|
+
return [globPattern];
|
|
8548
8578
|
}
|
|
8549
8579
|
async function searchFiles2(params) {
|
|
8550
8580
|
const { pattern, dir_path, include } = params;
|
|
@@ -8564,59 +8594,69 @@ async function searchFiles2(params) {
|
|
|
8564
8594
|
}
|
|
8565
8595
|
throw error;
|
|
8566
8596
|
}
|
|
8567
|
-
|
|
8597
|
+
const rgPath = getRipgrepPath();
|
|
8598
|
+
const rgArgs = [
|
|
8599
|
+
"--json",
|
|
8600
|
+
// Machine-readable output
|
|
8601
|
+
"--max-count",
|
|
8602
|
+
"500",
|
|
8603
|
+
// Limit matches per file
|
|
8604
|
+
"--ignore-case",
|
|
8605
|
+
// Case-insensitive search
|
|
8606
|
+
"--max-filesize",
|
|
8607
|
+
"10M"
|
|
8608
|
+
// Skip files larger than 10MB
|
|
8609
|
+
];
|
|
8610
|
+
const globs = convertGlobToRipgrepGlobs(include || "");
|
|
8611
|
+
if (globs.length > 0) {
|
|
8612
|
+
globs.forEach((glob2) => {
|
|
8613
|
+
rgArgs.push("--glob", glob2);
|
|
8614
|
+
});
|
|
8615
|
+
}
|
|
8616
|
+
rgArgs.push(pattern, targetDir);
|
|
8617
|
+
let stdout;
|
|
8568
8618
|
try {
|
|
8569
|
-
|
|
8619
|
+
const result2 = await execFileAsync(rgPath, rgArgs, {
|
|
8620
|
+
maxBuffer: 50 * 1024 * 1024
|
|
8621
|
+
// 50MB buffer for large results
|
|
8622
|
+
});
|
|
8623
|
+
stdout = result2.stdout;
|
|
8570
8624
|
} catch (error) {
|
|
8571
|
-
|
|
8625
|
+
const execError = error;
|
|
8626
|
+
if (execError.code === 1 && execError.stdout) {
|
|
8627
|
+
stdout = execError.stdout;
|
|
8628
|
+
} else if (execError.code === 2) {
|
|
8629
|
+
const errorMsg = execError.stderr || "Unknown ripgrep error";
|
|
8630
|
+
throw new Error(`Ripgrep error: ${errorMsg}`);
|
|
8631
|
+
} else {
|
|
8632
|
+
throw error;
|
|
8633
|
+
}
|
|
8572
8634
|
}
|
|
8573
|
-
const
|
|
8574
|
-
const filesStream = globStream(globPattern, {
|
|
8575
|
-
cwd: targetDir,
|
|
8576
|
-
dot: false,
|
|
8577
|
-
// Skip hidden files
|
|
8578
|
-
ignore: DEFAULT_IGNORE_PATTERNS3,
|
|
8579
|
-
absolute: true,
|
|
8580
|
-
nodir: true
|
|
8581
|
-
// Only match files, not directories
|
|
8582
|
-
});
|
|
8635
|
+
const lines = stdout.split("\n").filter(Boolean);
|
|
8583
8636
|
const allMatches = [];
|
|
8584
8637
|
let filesSearched = 0;
|
|
8585
|
-
const
|
|
8586
|
-
for await (const filePath of filesStream) {
|
|
8587
|
-
if (allMatches.length >= maxMatches) {
|
|
8588
|
-
break;
|
|
8589
|
-
}
|
|
8590
|
-
const fileAbsPath = filePath;
|
|
8638
|
+
for (const line of lines) {
|
|
8591
8639
|
try {
|
|
8592
|
-
const
|
|
8593
|
-
if (
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
allMatches.push({
|
|
8605
|
-
filePath: path9.relative(targetDir, fileAbsPath) || path9.basename(fileAbsPath),
|
|
8606
|
-
lineNumber: index + 1,
|
|
8607
|
-
line
|
|
8608
|
-
});
|
|
8609
|
-
}
|
|
8610
|
-
});
|
|
8611
|
-
} catch (readError) {
|
|
8612
|
-
const errCode = readError.code;
|
|
8613
|
-
if (errCode !== "ENOENT" && errCode !== "EACCES") {
|
|
8614
|
-
console.debug(`Could not read ${fileAbsPath}: ${readError.message}`);
|
|
8640
|
+
const item = JSON.parse(line);
|
|
8641
|
+
if (item.type === "match") {
|
|
8642
|
+
const match = item;
|
|
8643
|
+
allMatches.push({
|
|
8644
|
+
filePath: path9.relative(targetDir, match.data.path.text) || path9.basename(match.data.path.text),
|
|
8645
|
+
lineNumber: match.data.line_number,
|
|
8646
|
+
line: match.data.lines.text.trimEnd()
|
|
8647
|
+
// Remove trailing newline
|
|
8648
|
+
});
|
|
8649
|
+
} else if (item.type === "summary") {
|
|
8650
|
+
const stats = item;
|
|
8651
|
+
filesSearched = stats.data.stats.searches || 0;
|
|
8615
8652
|
}
|
|
8653
|
+
} catch {
|
|
8654
|
+
continue;
|
|
8616
8655
|
}
|
|
8617
8656
|
}
|
|
8618
8657
|
const searchDirDisplay = dir_path || ".";
|
|
8619
8658
|
const filterInfo = include ? ` (filter: "${include}")` : "";
|
|
8659
|
+
const maxMatches = 500;
|
|
8620
8660
|
if (allMatches.length === 0) {
|
|
8621
8661
|
return `No matches found for pattern "${pattern}" in "${searchDirDisplay}"${filterInfo}.
|
|
8622
8662
|
Searched ${filesSearched} file(s).`;
|
|
@@ -8626,7 +8666,6 @@ Searched ${filesSearched} file(s).`;
|
|
|
8626
8666
|
acc[match.filePath] = [];
|
|
8627
8667
|
}
|
|
8628
8668
|
acc[match.filePath].push(match);
|
|
8629
|
-
acc[match.filePath].sort((a, b) => a.lineNumber - b.lineNumber);
|
|
8630
8669
|
return acc;
|
|
8631
8670
|
}, {});
|
|
8632
8671
|
const matchCount = allMatches.length;
|
|
@@ -8765,92 +8804,6 @@ var deleteFileTool = {
|
|
|
8765
8804
|
})
|
|
8766
8805
|
};
|
|
8767
8806
|
|
|
8768
|
-
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/knowledgeBaseSearch/index.js
|
|
8769
|
-
function formatSearchResults(files) {
|
|
8770
|
-
if (files.length === 0) {
|
|
8771
|
-
return "No documents found matching your search query in your knowledge base.";
|
|
8772
|
-
}
|
|
8773
|
-
const formattedFiles = files.map((file, index) => {
|
|
8774
|
-
const tags = file.tags?.map((t) => t.name).join(", ") || "none";
|
|
8775
|
-
const notes = file.notes ? `
|
|
8776
|
-
Notes: ${file.notes}` : "";
|
|
8777
|
-
const fileType = file.type || "FILE";
|
|
8778
|
-
return `${index + 1}. **${file.fileName}**
|
|
8779
|
-
Type: ${fileType} | MIME: ${file.mimeType}
|
|
8780
|
-
Tags: ${tags}${notes}`;
|
|
8781
|
-
});
|
|
8782
|
-
return `Found ${files.length} document(s) in your knowledge base:
|
|
8783
|
-
|
|
8784
|
-
` + formattedFiles.join("\n\n") + "\n\n*To use these documents in your conversation, you can ask me to reference specific files by name.*";
|
|
8785
|
-
}
|
|
8786
|
-
var knowledgeBaseSearchTool = {
|
|
8787
|
-
name: "search_knowledge_base",
|
|
8788
|
-
implementation: (context) => ({
|
|
8789
|
-
toolFn: async (value) => {
|
|
8790
|
-
const params = value;
|
|
8791
|
-
const { query, tags, file_type, max_results = 5 } = params;
|
|
8792
|
-
console.log("\u{1F4DA} Knowledge Base Search: Starting search for query:", query);
|
|
8793
|
-
if (!context.db.fabfiles) {
|
|
8794
|
-
console.error("\u274C Knowledge Base Search: fabfiles repository not available");
|
|
8795
|
-
return "Knowledge base search is not available at this time.";
|
|
8796
|
-
}
|
|
8797
|
-
try {
|
|
8798
|
-
const searchResults = await context.db.fabfiles.search(context.userId, query, {
|
|
8799
|
-
tags: tags || [],
|
|
8800
|
-
type: file_type,
|
|
8801
|
-
shared: false
|
|
8802
|
-
// Search all accessible files, not just shared
|
|
8803
|
-
}, {
|
|
8804
|
-
page: 1,
|
|
8805
|
-
limit: Math.min(max_results, 10)
|
|
8806
|
-
// Cap at 10 results
|
|
8807
|
-
}, {
|
|
8808
|
-
by: "fileName",
|
|
8809
|
-
direction: "asc"
|
|
8810
|
-
}, {
|
|
8811
|
-
includeShared: true
|
|
8812
|
-
// Include organization and explicitly shared files
|
|
8813
|
-
});
|
|
8814
|
-
console.log("\u{1F4DA} Knowledge Base Search: Found", searchResults.data.length, "results");
|
|
8815
|
-
return formatSearchResults(searchResults.data);
|
|
8816
|
-
} catch (error) {
|
|
8817
|
-
console.error("\u274C Knowledge Base Search: Error during search:", error);
|
|
8818
|
-
return "An error occurred while searching your knowledge base. Please try again.";
|
|
8819
|
-
}
|
|
8820
|
-
},
|
|
8821
|
-
toolSchema: {
|
|
8822
|
-
name: "search_knowledge_base",
|
|
8823
|
-
description: "Search the user's uploaded knowledge base (fab files). Returns relevant documents from the user's own files, organization-shared files, and files explicitly shared with them. Use this tool when the user asks about their own documents, uploaded files, or organization knowledge.",
|
|
8824
|
-
parameters: {
|
|
8825
|
-
type: "object",
|
|
8826
|
-
properties: {
|
|
8827
|
-
query: {
|
|
8828
|
-
type: "string",
|
|
8829
|
-
description: "The search query to find relevant documents by filename or content"
|
|
8830
|
-
},
|
|
8831
|
-
tags: {
|
|
8832
|
-
type: "array",
|
|
8833
|
-
items: { type: "string" },
|
|
8834
|
-
description: "Optional: filter results to only include files with these tags"
|
|
8835
|
-
},
|
|
8836
|
-
file_type: {
|
|
8837
|
-
type: "string",
|
|
8838
|
-
enum: ["pdf", "text", "image", "excel", "word", "json", "csv", "markdown", "code", "url"],
|
|
8839
|
-
description: "Optional: filter results by file type"
|
|
8840
|
-
},
|
|
8841
|
-
max_results: {
|
|
8842
|
-
type: "number",
|
|
8843
|
-
description: "Maximum number of results to return (default: 5, max: 10)",
|
|
8844
|
-
minimum: 1,
|
|
8845
|
-
maximum: 10
|
|
8846
|
-
}
|
|
8847
|
-
},
|
|
8848
|
-
required: ["query"]
|
|
8849
|
-
}
|
|
8850
|
-
}
|
|
8851
|
-
})
|
|
8852
|
-
};
|
|
8853
|
-
|
|
8854
8807
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/bashExecute/index.js
|
|
8855
8808
|
import { spawn } from "child_process";
|
|
8856
8809
|
import path11 from "path";
|
|
@@ -9353,8 +9306,6 @@ var tools = {
|
|
|
9353
9306
|
glob_files: globFilesTool,
|
|
9354
9307
|
grep_search: grepSearchTool,
|
|
9355
9308
|
delete_file: deleteFileTool,
|
|
9356
|
-
// Knowledge base search
|
|
9357
|
-
search_knowledge_base: knowledgeBaseSearchTool,
|
|
9358
9309
|
// Shell execution
|
|
9359
9310
|
bash_execute: bashExecuteTool
|
|
9360
9311
|
};
|
|
@@ -9594,7 +9545,7 @@ var ToolErrorType;
|
|
|
9594
9545
|
|
|
9595
9546
|
// src/utils/diffPreview.ts
|
|
9596
9547
|
import * as Diff from "diff";
|
|
9597
|
-
import { readFile
|
|
9548
|
+
import { readFile } from "fs/promises";
|
|
9598
9549
|
import { existsSync as existsSync7 } from "fs";
|
|
9599
9550
|
async function generateFileDiffPreview(args) {
|
|
9600
9551
|
try {
|
|
@@ -9609,7 +9560,7 @@ ${preview}${hasMore ? `
|
|
|
9609
9560
|
|
|
9610
9561
|
... (${lines2.length - 20} more lines)` : ""}`;
|
|
9611
9562
|
}
|
|
9612
|
-
const currentContent = await
|
|
9563
|
+
const currentContent = await readFile(args.path, "utf-8");
|
|
9613
9564
|
const patch = Diff.createPatch(
|
|
9614
9565
|
args.path,
|
|
9615
9566
|
currentContent,
|
|
@@ -11520,7 +11471,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
11520
11471
|
// package.json
|
|
11521
11472
|
var package_default = {
|
|
11522
11473
|
name: "@bike4mind/cli",
|
|
11523
|
-
version: "0.2.17-feat-
|
|
11474
|
+
version: "0.2.17-feat-ripgrep-integration.17676+0f83d84db",
|
|
11524
11475
|
type: "module",
|
|
11525
11476
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
11526
11477
|
license: "UNLICENSED",
|
|
@@ -11627,10 +11578,10 @@ var package_default = {
|
|
|
11627
11578
|
},
|
|
11628
11579
|
devDependencies: {
|
|
11629
11580
|
"@bike4mind/agents": "0.1.0",
|
|
11630
|
-
"@bike4mind/common": "2.43.1-feat-
|
|
11631
|
-
"@bike4mind/mcp": "1.22.3-feat-
|
|
11632
|
-
"@bike4mind/services": "2.40.1-feat-
|
|
11633
|
-
"@bike4mind/utils": "2.2.1-feat-
|
|
11581
|
+
"@bike4mind/common": "2.43.1-feat-ripgrep-integration.17676+0f83d84db",
|
|
11582
|
+
"@bike4mind/mcp": "1.22.3-feat-ripgrep-integration.17676+0f83d84db",
|
|
11583
|
+
"@bike4mind/services": "2.40.1-feat-ripgrep-integration.17676+0f83d84db",
|
|
11584
|
+
"@bike4mind/utils": "2.2.1-feat-ripgrep-integration.17676+0f83d84db",
|
|
11634
11585
|
"@types/better-sqlite3": "^7.6.13",
|
|
11635
11586
|
"@types/diff": "^5.0.9",
|
|
11636
11587
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -11644,7 +11595,10 @@ var package_default = {
|
|
|
11644
11595
|
typescript: "^5.9.3",
|
|
11645
11596
|
vitest: "^3.2.4"
|
|
11646
11597
|
},
|
|
11647
|
-
|
|
11598
|
+
optionalDependencies: {
|
|
11599
|
+
"@vscode/ripgrep": "^1.17.0"
|
|
11600
|
+
},
|
|
11601
|
+
gitHead: "0f83d84dbabacf4d4a783634589cac64d45df2a2"
|
|
11648
11602
|
};
|
|
11649
11603
|
|
|
11650
11604
|
// src/config/constants.ts
|
|
@@ -11844,6 +11798,14 @@ Focus on:
|
|
|
11844
11798
|
|
|
11845
11799
|
You have read-only access. Use file_read, grep_search, and glob_files to explore.
|
|
11846
11800
|
|
|
11801
|
+
CODE SEARCH EFFICIENCY:
|
|
11802
|
+
1. Start narrow with glob_files using specific patterns (e.g., "**/*Auth*.ts")
|
|
11803
|
+
2. Then use grep_search with precise regex on narrowed results
|
|
11804
|
+
3. Finally use file_read only on relevant files
|
|
11805
|
+
4. Leverage git log to find recent changes
|
|
11806
|
+
5. Check test files first to understand feature usage
|
|
11807
|
+
6. Batch glob operations instead of multiple separate calls
|
|
11808
|
+
|
|
11847
11809
|
When you find what you're looking for, provide a clear summary including:
|
|
11848
11810
|
1. What you found (files, functions, patterns)
|
|
11849
11811
|
2. Key insights or observations
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
findMostSimilarMemento,
|
|
4
4
|
getRelevantMementos
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-NMWRXDTN.js";
|
|
6
|
+
import "./chunk-QDWMIP2Q.js";
|
|
7
|
+
import "./chunk-CHBAKX4C.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
findMostSimilarMemento,
|
|
@@ -129,8 +129,8 @@ import {
|
|
|
129
129
|
validateMermaidSyntax,
|
|
130
130
|
warmUpSettingsCache,
|
|
131
131
|
withRetry
|
|
132
|
-
} from "./chunk-
|
|
133
|
-
import "./chunk-
|
|
132
|
+
} from "./chunk-QDWMIP2Q.js";
|
|
133
|
+
import "./chunk-CHBAKX4C.js";
|
|
134
134
|
import {
|
|
135
135
|
Logger,
|
|
136
136
|
NotificationDeduplicator,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SubtractCreditsSchema,
|
|
4
4
|
subtractCredits
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-WULZDTLD.js";
|
|
6
|
+
import "./chunk-QDWMIP2Q.js";
|
|
7
|
+
import "./chunk-CHBAKX4C.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
SubtractCreditsSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.17-feat-
|
|
3
|
+
"version": "0.2.17-feat-ripgrep-integration.17676+0f83d84db",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@bike4mind/agents": "0.1.0",
|
|
110
|
-
"@bike4mind/common": "2.43.1-feat-
|
|
111
|
-
"@bike4mind/mcp": "1.22.3-feat-
|
|
112
|
-
"@bike4mind/services": "2.40.1-feat-
|
|
113
|
-
"@bike4mind/utils": "2.2.1-feat-
|
|
110
|
+
"@bike4mind/common": "2.43.1-feat-ripgrep-integration.17676+0f83d84db",
|
|
111
|
+
"@bike4mind/mcp": "1.22.3-feat-ripgrep-integration.17676+0f83d84db",
|
|
112
|
+
"@bike4mind/services": "2.40.1-feat-ripgrep-integration.17676+0f83d84db",
|
|
113
|
+
"@bike4mind/utils": "2.2.1-feat-ripgrep-integration.17676+0f83d84db",
|
|
114
114
|
"@types/better-sqlite3": "^7.6.13",
|
|
115
115
|
"@types/diff": "^5.0.9",
|
|
116
116
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -124,5 +124,8 @@
|
|
|
124
124
|
"typescript": "^5.9.3",
|
|
125
125
|
"vitest": "^3.2.4"
|
|
126
126
|
},
|
|
127
|
-
"
|
|
127
|
+
"optionalDependencies": {
|
|
128
|
+
"@vscode/ripgrep": "^1.17.0"
|
|
129
|
+
},
|
|
130
|
+
"gitHead": "0f83d84dbabacf4d4a783634589cac64d45df2a2"
|
|
128
131
|
}
|