@bike4mind/cli 0.2.17-ja-feat-slack-entity-extraction.17685 → 0.2.17

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.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.js CHANGED
@@ -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
@@ -8509,40 +8542,39 @@ var globFilesTool = {
8509
8542
  };
8510
8543
 
8511
8544
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/grepSearch/index.js
8512
- import { globStream } from "glob";
8513
- import { readFile, stat as stat2 } from "fs/promises";
8545
+ import { stat as stat2 } from "fs/promises";
8514
8546
  import path9 from "path";
8515
- var MAX_FILE_SIZE3 = 10 * 1024 * 1024;
8516
- var DEFAULT_IGNORE_PATTERNS3 = [
8517
- "**/node_modules/**",
8518
- "**/.git/**",
8519
- "**/dist/**",
8520
- "**/build/**",
8521
- "**/.next/**",
8522
- "**/coverage/**",
8523
- "**/*.min.js",
8524
- "**/*.min.css",
8525
- "**/package-lock.json",
8526
- "**/pnpm-lock.yaml",
8527
- "**/yarn.lock"
8528
- ];
8529
- 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() {
8530
8553
  try {
8531
- const { openSync, readSync, closeSync } = await import("fs");
8532
- const buffer = Buffer.alloc(8192);
8533
- const fd = openSync(filePath, "r");
8534
- const bytesRead = readSync(fd, buffer, 0, 8192, 0);
8535
- closeSync(fd);
8536
- const chunk = buffer.slice(0, bytesRead);
8537
- return chunk.includes(0);
8538
- } catch {
8539
- 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");
8540
8560
  }
8541
8561
  }
8542
8562
  function isPathWithinWorkspace(targetPath, baseCwd) {
8543
8563
  const resolvedTarget = path9.resolve(targetPath);
8544
8564
  const resolvedBase = path9.resolve(baseCwd);
8545
- return resolvedTarget.startsWith(resolvedBase);
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];
8546
8578
  }
8547
8579
  async function searchFiles2(params) {
8548
8580
  const { pattern, dir_path, include } = params;
@@ -8562,59 +8594,69 @@ async function searchFiles2(params) {
8562
8594
  }
8563
8595
  throw error;
8564
8596
  }
8565
- let searchRegex;
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;
8566
8618
  try {
8567
- searchRegex = new RegExp(pattern, "i");
8619
+ const result2 = await execFileAsync(rgPath, rgArgs, {
8620
+ maxBuffer: 50 * 1024 * 1024
8621
+ // 50MB buffer for large results
8622
+ });
8623
+ stdout = result2.stdout;
8568
8624
  } catch (error) {
8569
- throw new Error(`Invalid regex pattern: ${pattern}`);
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
+ }
8570
8634
  }
8571
- const globPattern = include || "**/*";
8572
- const filesStream = globStream(globPattern, {
8573
- cwd: targetDir,
8574
- dot: false,
8575
- // Skip hidden files
8576
- ignore: DEFAULT_IGNORE_PATTERNS3,
8577
- absolute: true,
8578
- nodir: true
8579
- // Only match files, not directories
8580
- });
8635
+ const lines = stdout.split("\n").filter(Boolean);
8581
8636
  const allMatches = [];
8582
8637
  let filesSearched = 0;
8583
- const maxMatches = 500;
8584
- for await (const filePath of filesStream) {
8585
- if (allMatches.length >= maxMatches) {
8586
- break;
8587
- }
8588
- const fileAbsPath = filePath;
8638
+ for (const line of lines) {
8589
8639
  try {
8590
- const stats = await stat2(fileAbsPath);
8591
- if (stats.size > MAX_FILE_SIZE3) {
8592
- continue;
8593
- }
8594
- if (await isBinaryFile2(fileAbsPath)) {
8595
- continue;
8596
- }
8597
- filesSearched++;
8598
- const content = await readFile(fileAbsPath, "utf8");
8599
- const lines = content.split(/\r?\n/);
8600
- lines.forEach((line, index) => {
8601
- if (allMatches.length < maxMatches && searchRegex.test(line)) {
8602
- allMatches.push({
8603
- filePath: path9.relative(targetDir, fileAbsPath) || path9.basename(fileAbsPath),
8604
- lineNumber: index + 1,
8605
- line
8606
- });
8607
- }
8608
- });
8609
- } catch (readError) {
8610
- const errCode = readError.code;
8611
- if (errCode !== "ENOENT" && errCode !== "EACCES") {
8612
- 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;
8613
8652
  }
8653
+ } catch {
8654
+ continue;
8614
8655
  }
8615
8656
  }
8616
8657
  const searchDirDisplay = dir_path || ".";
8617
8658
  const filterInfo = include ? ` (filter: "${include}")` : "";
8659
+ const maxMatches = 500;
8618
8660
  if (allMatches.length === 0) {
8619
8661
  return `No matches found for pattern "${pattern}" in "${searchDirDisplay}"${filterInfo}.
8620
8662
  Searched ${filesSearched} file(s).`;
@@ -8624,7 +8666,6 @@ Searched ${filesSearched} file(s).`;
8624
8666
  acc[match.filePath] = [];
8625
8667
  }
8626
8668
  acc[match.filePath].push(match);
8627
- acc[match.filePath].sort((a, b) => a.lineNumber - b.lineNumber);
8628
8669
  return acc;
8629
8670
  }, {});
8630
8671
  const matchCount = allMatches.length;
@@ -9504,7 +9545,7 @@ var ToolErrorType;
9504
9545
 
9505
9546
  // src/utils/diffPreview.ts
9506
9547
  import * as Diff from "diff";
9507
- import { readFile as readFile2 } from "fs/promises";
9548
+ import { readFile } from "fs/promises";
9508
9549
  import { existsSync as existsSync7 } from "fs";
9509
9550
  async function generateFileDiffPreview(args) {
9510
9551
  try {
@@ -9519,7 +9560,7 @@ ${preview}${hasMore ? `
9519
9560
 
9520
9561
  ... (${lines2.length - 20} more lines)` : ""}`;
9521
9562
  }
9522
- const currentContent = await readFile2(args.path, "utf-8");
9563
+ const currentContent = await readFile(args.path, "utf-8");
9523
9564
  const patch = Diff.createPatch(
9524
9565
  args.path,
9525
9566
  currentContent,
@@ -11430,7 +11471,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
11430
11471
  // package.json
11431
11472
  var package_default = {
11432
11473
  name: "@bike4mind/cli",
11433
- version: "0.2.17-ja-feat-slack-entity-extraction.17685+63c62fb5c",
11474
+ version: "0.2.17",
11434
11475
  type: "module",
11435
11476
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
11436
11477
  license: "UNLICENSED",
@@ -11536,11 +11577,11 @@ var package_default = {
11536
11577
  zustand: "^4.5.4"
11537
11578
  },
11538
11579
  devDependencies: {
11539
- "@bike4mind/agents": "0.1.0",
11540
- "@bike4mind/common": "2.43.1-ja-feat-slack-entity-extraction.17685+63c62fb5c",
11541
- "@bike4mind/mcp": "1.22.3-ja-feat-slack-entity-extraction.17685+63c62fb5c",
11542
- "@bike4mind/services": "2.40.1-ja-feat-slack-entity-extraction.17685+63c62fb5c",
11543
- "@bike4mind/utils": "2.2.1-ja-feat-slack-entity-extraction.17685+63c62fb5c",
11580
+ "@bike4mind/agents": "workspace:*",
11581
+ "@bike4mind/common": "workspace:*",
11582
+ "@bike4mind/mcp": "workspace:*",
11583
+ "@bike4mind/services": "workspace:*",
11584
+ "@bike4mind/utils": "workspace:*",
11544
11585
  "@types/better-sqlite3": "^7.6.13",
11545
11586
  "@types/diff": "^5.0.9",
11546
11587
  "@types/jsonwebtoken": "^9.0.4",
@@ -11554,7 +11595,9 @@ var package_default = {
11554
11595
  typescript: "^5.9.3",
11555
11596
  vitest: "^3.2.4"
11556
11597
  },
11557
- gitHead: "63c62fb5c81c2b1ff06c988e0edc9ae6d4445566"
11598
+ optionalDependencies: {
11599
+ "@vscode/ripgrep": "^1.17.0"
11600
+ }
11558
11601
  };
11559
11602
 
11560
11603
  // src/config/constants.ts
@@ -11754,6 +11797,14 @@ Focus on:
11754
11797
 
11755
11798
  You have read-only access. Use file_read, grep_search, and glob_files to explore.
11756
11799
 
11800
+ CODE SEARCH EFFICIENCY:
11801
+ 1. Start narrow with glob_files using specific patterns (e.g., "**/*Auth*.ts")
11802
+ 2. Then use grep_search with precise regex on narrowed results
11803
+ 3. Finally use file_read only on relevant files
11804
+ 4. Leverage git log to find recent changes
11805
+ 5. Check test files first to understand feature usage
11806
+ 6. Batch glob operations instead of multiple separate calls
11807
+
11757
11808
  When you find what you're looking for, provide a clear summary including:
11758
11809
  1. What you found (files, functions, patterns)
11759
11810
  2. Key insights or observations
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.17-ja-feat-slack-entity-extraction.17685+63c62fb5c",
3
+ "version": "0.2.17",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -30,16 +30,6 @@
30
30
  "dist",
31
31
  "bin"
32
32
  ],
33
- "scripts": {
34
- "dev": "tsx src/index.tsx",
35
- "build": "tsup",
36
- "typecheck": "tsc --noEmit",
37
- "test": "vitest run",
38
- "test:watch": "vitest",
39
- "start": "node dist/index.js",
40
- "prepublishOnly": "pnpm build",
41
- "postinstall": "node -e \"try { require('better-sqlite3') } catch(e) { if(e.message.includes('bindings')) { console.log('\\n⚠️ Rebuilding better-sqlite3 native bindings...'); require('child_process').execSync('pnpm rebuild better-sqlite3', {stdio:'inherit'}) } }\""
42
- },
43
33
  "dependencies": {
44
34
  "@anthropic-ai/sdk": "^0.22.0",
45
35
  "@aws-sdk/client-apigatewaymanagementapi": "3.654.0",
@@ -106,11 +96,6 @@
106
96
  "zustand": "^4.5.4"
107
97
  },
108
98
  "devDependencies": {
109
- "@bike4mind/agents": "0.1.0",
110
- "@bike4mind/common": "2.43.1-ja-feat-slack-entity-extraction.17685+63c62fb5c",
111
- "@bike4mind/mcp": "1.22.3-ja-feat-slack-entity-extraction.17685+63c62fb5c",
112
- "@bike4mind/services": "2.40.1-ja-feat-slack-entity-extraction.17685+63c62fb5c",
113
- "@bike4mind/utils": "2.2.1-ja-feat-slack-entity-extraction.17685+63c62fb5c",
114
99
  "@types/better-sqlite3": "^7.6.13",
115
100
  "@types/diff": "^5.0.9",
116
101
  "@types/jsonwebtoken": "^9.0.4",
@@ -122,7 +107,23 @@
122
107
  "tsup": "^8.5.1",
123
108
  "tsx": "^4.21.0",
124
109
  "typescript": "^5.9.3",
125
- "vitest": "^3.2.4"
110
+ "vitest": "^3.2.4",
111
+ "@bike4mind/agents": "0.1.0",
112
+ "@bike4mind/common": "2.43.0",
113
+ "@bike4mind/mcp": "1.22.3",
114
+ "@bike4mind/services": "2.41.0",
115
+ "@bike4mind/utils": "2.2.0"
116
+ },
117
+ "optionalDependencies": {
118
+ "@vscode/ripgrep": "^1.17.0"
126
119
  },
127
- "gitHead": "63c62fb5c81c2b1ff06c988e0edc9ae6d4445566"
128
- }
120
+ "scripts": {
121
+ "dev": "tsx src/index.tsx",
122
+ "build": "tsup",
123
+ "typecheck": "tsc --noEmit",
124
+ "test": "vitest run",
125
+ "test:watch": "vitest",
126
+ "start": "node dist/index.js",
127
+ "postinstall": "node -e \"try { require('better-sqlite3') } catch(e) { if(e.message.includes('bindings')) { console.log('\\n⚠️ Rebuilding better-sqlite3 native bindings...'); require('child_process').execSync('pnpm rebuild better-sqlite3', {stdio:'inherit'}) } }\""
128
+ }
129
+ }