@bike4mind/cli 0.2.25-recent-changes-tool.18533 → 0.2.25-sessions-command-bug-fix.18527

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 CHANGED
@@ -183,7 +183,6 @@ export SERPER_API_KEY="your-key-here"
183
183
  - ✅ `current_datetime` - No API key needed
184
184
  - ✅ `prompt_enhancement` - No API key needed
185
185
  - ✅ `bash_execute` - No API key needed
186
- - ✅ `recent_changes` - No API key needed (git-based file search by modification time)
187
186
  - 🔑 `weather_info` - Requires `toolApiKeys.openweather`
188
187
  - 🔑 `web_search` - Requires `toolApiKeys.serper`
189
188
  - 🔑 `deep_research` - Requires `toolApiKeys.serper`
@@ -265,36 +264,6 @@ You can also run any MCP server via npx or custom executables:
265
264
 
266
265
  **Note:** Internal MCP servers must be built and available in the `b4m-core/packages/mcp/dist/src/` directory. The CLI will automatically find them if you're running from the monorepo. For Docker-based servers, ensure Docker is installed and the image is accessible.
267
266
 
268
- ## Git-Aware Code Search
269
-
270
- The CLI includes a `recent_changes` tool that uses git history to find recently modified files. This significantly speeds up debugging by narrowing the search space to recently changed code.
271
-
272
- ### Use Cases
273
-
274
- - **Recent bug debugging:** "I just broke something, can you help fix it?"
275
- - **Understanding feature development:** "What did we change for the new dashboard?"
276
- - **Finding active development areas:** "What are we actively working on?"
277
- - **Code review prep:** "What changed since last release?"
278
-
279
- ### Parameters
280
-
281
- - `since` - Time range to search (default: "7 days ago")
282
- - Examples: "2 hours ago", "3 days ago", "2025-01-01"
283
- - `path` - Filter to specific directory (default: entire repo)
284
- - Examples: "src/components", "apps/client", "**/*.test.ts"
285
- - `limit` - Maximum files to return (default: 50)
286
- - `include_stats` - Show lines added/removed (default: false)
287
-
288
- ### How It Works
289
-
290
- The tool uses `git log` to track file modifications and returns:
291
- - Files sorted by activity (most commits first)
292
- - Commit messages for context
293
- - Optional statistics showing lines changed
294
- - Filtered results based on time and path
295
-
296
- **Performance benefit:** Instead of searching 50+ files (5-10 minutes), find the 3 relevant files in ~30 seconds.
297
-
298
267
  ## Context Files
299
268
 
300
269
  The CLI supports loading project-specific instructions from context files, similar to CLAUDE.md in Claude Code. These files provide persistent instructions that are automatically included in the agent's system prompt.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-CRG4F6FD.js";
4
+ } from "./chunk-7L7YVDTP.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;
@@ -15,7 +15,7 @@ import {
15
15
  dayjsConfig_default,
16
16
  extractSnippetMeta,
17
17
  settingsMap
18
- } from "./chunk-CRG4F6FD.js";
18
+ } from "./chunk-7L7YVDTP.js";
19
19
  import {
20
20
  Logger
21
21
  } from "./chunk-OCYRD7D6.js";
@@ -303,8 +303,17 @@ var b4mLLMTools = z5.enum([
303
303
  "sunrise_sunset",
304
304
  "iss_tracker",
305
305
  "planet_visibility",
306
+ // File operation tools
307
+ "file_read",
308
+ "create_file",
309
+ "edit_local_file",
310
+ "glob_files",
311
+ "grep_search",
312
+ "delete_file",
306
313
  // Knowledge base search
307
- "search_knowledge_base"
314
+ "search_knowledge_base",
315
+ // Shell execution
316
+ "bash_execute"
308
317
  ]);
309
318
  var B4MLLMToolsList = b4mLLMTools.options.map((tool) => tool);
310
319
  var RechartsChartTypeSchema = z5.enum([
@@ -6,12 +6,12 @@ import {
6
6
  getSettingsByNames,
7
7
  obfuscateApiKey,
8
8
  secureParameters
9
- } from "./chunk-KGERFIL4.js";
9
+ } from "./chunk-6ZSQC2VF.js";
10
10
  import {
11
11
  ApiKeyType,
12
12
  MementoTier,
13
13
  isSupportedEmbeddingModel
14
- } from "./chunk-CRG4F6FD.js";
14
+ } from "./chunk-7L7YVDTP.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-KGERFIL4.js";
5
+ } from "./chunk-6ZSQC2VF.js";
6
6
  import {
7
7
  CompletionApiUsageTransaction,
8
8
  GenericCreditDeductTransaction,
@@ -12,7 +12,7 @@ import {
12
12
  TextGenerationUsageTransaction,
13
13
  TransferCreditTransaction,
14
14
  VideoGenerationUsageTransaction
15
- } from "./chunk-CRG4F6FD.js";
15
+ } from "./chunk-7L7YVDTP.js";
16
16
 
17
17
  // ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
18
18
  import { z } from "zod";
@@ -7,11 +7,11 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-KGERFIL4.js";
10
+ } from "./chunk-6ZSQC2VF.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
14
- } from "./chunk-CRG4F6FD.js";
14
+ } from "./chunk-7L7YVDTP.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/fabFileService/create.js
17
17
  import { z } from "zod";
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  createFabFile,
4
4
  createFabFileSchema
5
- } from "./chunk-QDD3PG2I.js";
6
- import "./chunk-KGERFIL4.js";
7
- import "./chunk-CRG4F6FD.js";
5
+ } from "./chunk-U4GFPBS7.js";
6
+ import "./chunk-6ZSQC2VF.js";
7
+ import "./chunk-7L7YVDTP.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
10
10
  createFabFile,
package/dist/index.js CHANGED
@@ -5,15 +5,15 @@ import {
5
5
  getEffectiveApiKey,
6
6
  getOpenWeatherKey,
7
7
  getSerperKey
8
- } from "./chunk-ETQCFCFT.js";
8
+ } from "./chunk-AHVXP2NS.js";
9
9
  import {
10
10
  ConfigStore
11
11
  } from "./chunk-23T2XGSZ.js";
12
12
  import {
13
13
  useCliStore
14
14
  } from "./chunk-EIDW3VBS.js";
15
- import "./chunk-TNLRJZRH.js";
16
- import "./chunk-QDD3PG2I.js";
15
+ import "./chunk-LPM3TSSU.js";
16
+ import "./chunk-U4GFPBS7.js";
17
17
  import {
18
18
  BFLImageService,
19
19
  BaseStorage,
@@ -25,7 +25,7 @@ import {
25
25
  OpenAIBackend,
26
26
  OpenAIImageService,
27
27
  XAIImageService
28
- } from "./chunk-KGERFIL4.js";
28
+ } from "./chunk-6ZSQC2VF.js";
29
29
  import {
30
30
  AiEvents,
31
31
  ApiKeyEvents,
@@ -81,7 +81,7 @@ import {
81
81
  XAI_IMAGE_MODELS,
82
82
  b4mLLMTools,
83
83
  getMcpProviderMetadata
84
- } from "./chunk-CRG4F6FD.js";
84
+ } from "./chunk-7L7YVDTP.js";
85
85
  import {
86
86
  Logger
87
87
  } from "./chunk-OCYRD7D6.js";
@@ -10177,343 +10177,8 @@ var editLocalFileTool = {
10177
10177
  })
10178
10178
  };
10179
10179
 
10180
- // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/recentChanges/index.js
10181
- import { spawn as spawn2 } from "child_process";
10182
- var DEFAULT_SINCE = "7 days ago";
10183
- var DEFAULT_LIMIT = 50;
10184
- var DEFAULT_INCLUDE_STATS = false;
10185
- function parseStatusLine(line) {
10186
- const results = [];
10187
- if (line.length < 4)
10188
- return results;
10189
- const indexStatus = line[0];
10190
- const workTreeStatus = line[1];
10191
- const filePath = line.slice(3);
10192
- const typeMap = {
10193
- M: "modified",
10194
- A: "added",
10195
- D: "deleted",
10196
- R: "renamed",
10197
- C: "copied"
10198
- };
10199
- if (indexStatus !== " " && indexStatus !== "?") {
10200
- results.push({
10201
- path: filePath,
10202
- status: "staged",
10203
- type: typeMap[indexStatus] || "modified"
10204
- });
10205
- }
10206
- if (workTreeStatus !== " " && workTreeStatus !== "?") {
10207
- results.push({
10208
- path: filePath,
10209
- status: "unstaged",
10210
- type: typeMap[workTreeStatus] || "modified"
10211
- });
10212
- }
10213
- if (indexStatus === "?" && workTreeStatus === "?") {
10214
- results.push({
10215
- path: filePath,
10216
- status: "untracked",
10217
- type: "added"
10218
- });
10219
- }
10220
- return results;
10221
- }
10222
- async function getWorkingTreeChanges(filterPath) {
10223
- const args = ["status", "--porcelain"];
10224
- if (filterPath) {
10225
- args.push("--", filterPath);
10226
- }
10227
- return new Promise((resolve3) => {
10228
- const proc = spawn2("git", args, {
10229
- cwd: process.cwd(),
10230
- stdio: ["ignore", "pipe", "pipe"]
10231
- });
10232
- let stdout = "";
10233
- proc.stdout.on("data", (data) => {
10234
- stdout += data.toString();
10235
- });
10236
- proc.on("close", (exitCode) => {
10237
- if (exitCode !== 0) {
10238
- resolve3([]);
10239
- return;
10240
- }
10241
- const files = stdout.split("\n").filter((line) => line.length > 0).flatMap(parseStatusLine);
10242
- resolve3(files);
10243
- });
10244
- proc.on("error", () => {
10245
- resolve3([]);
10246
- });
10247
- });
10248
- }
10249
- async function getRecentChanges(params) {
10250
- const { since = DEFAULT_SINCE, path: filterPath, limit = DEFAULT_LIMIT, include_stats = DEFAULT_INCLUDE_STATS } = params;
10251
- const args = ["log", `--since=${since}`, "--name-only", "--pretty=format:"];
10252
- if (filterPath) {
10253
- args.push("--", filterPath);
10254
- }
10255
- return new Promise((resolve3) => {
10256
- const proc = spawn2("git", args, {
10257
- cwd: process.cwd(),
10258
- stdio: ["ignore", "pipe", "pipe"]
10259
- });
10260
- let stdout = "";
10261
- let stderr = "";
10262
- proc.stdout.on("data", (data) => {
10263
- stdout += data.toString();
10264
- });
10265
- proc.stderr.on("data", (data) => {
10266
- stderr += data.toString();
10267
- });
10268
- proc.on("close", async (exitCode) => {
10269
- const workingTree = await getWorkingTreeChanges(filterPath);
10270
- if (exitCode !== 0) {
10271
- resolve3({
10272
- files: [],
10273
- workingTree,
10274
- timeRange: since,
10275
- totalFiles: 0,
10276
- error: stderr || "Git command failed"
10277
- });
10278
- return;
10279
- }
10280
- const files = stdout.split("\n").filter((line) => line.trim().length > 0).reduce((acc, filePath) => {
10281
- const existing = acc.find((f) => f.path === filePath);
10282
- if (existing) {
10283
- existing.changes++;
10284
- } else {
10285
- acc.push({ path: filePath, changes: 1 });
10286
- }
10287
- return acc;
10288
- }, []);
10289
- files.sort((a, b) => b.changes - a.changes);
10290
- const limitedFiles = files.slice(0, limit);
10291
- if (include_stats && limitedFiles.length > 0) {
10292
- const filesWithStats = await getFileStats(limitedFiles, since, filterPath);
10293
- resolve3({
10294
- files: filesWithStats,
10295
- workingTree,
10296
- timeRange: since,
10297
- totalFiles: files.length
10298
- });
10299
- } else {
10300
- resolve3({
10301
- files: limitedFiles,
10302
- workingTree,
10303
- timeRange: since,
10304
- totalFiles: files.length
10305
- });
10306
- }
10307
- });
10308
- proc.on("error", async (error) => {
10309
- const workingTree = await getWorkingTreeChanges(filterPath);
10310
- resolve3({
10311
- files: [],
10312
- workingTree,
10313
- timeRange: since,
10314
- totalFiles: 0,
10315
- error: `Failed to execute git command: ${error.message}`
10316
- });
10317
- });
10318
- });
10319
- }
10320
- async function getFileStats(files, since, filterPath) {
10321
- const args = ["log", `--since=${since}`, "--numstat", "--pretty=format:"];
10322
- if (filterPath) {
10323
- args.push("--", filterPath);
10324
- }
10325
- return new Promise((resolve3) => {
10326
- const proc = spawn2("git", args, {
10327
- cwd: process.cwd(),
10328
- stdio: ["ignore", "pipe", "pipe"]
10329
- });
10330
- let stdout = "";
10331
- proc.stdout.on("data", (data) => {
10332
- stdout += data.toString();
10333
- });
10334
- proc.on("close", () => {
10335
- const stats = /* @__PURE__ */ new Map();
10336
- stdout.split("\n").forEach((line) => {
10337
- const match = line.match(/^(\d+)\s+(\d+)\s+(.+)$/);
10338
- if (match) {
10339
- const [, additions, deletions, filePath] = match;
10340
- const existing = stats.get(filePath);
10341
- if (existing) {
10342
- existing.additions += parseInt(additions, 10);
10343
- existing.deletions += parseInt(deletions, 10);
10344
- } else {
10345
- stats.set(filePath, {
10346
- additions: parseInt(additions, 10),
10347
- deletions: parseInt(deletions, 10)
10348
- });
10349
- }
10350
- }
10351
- });
10352
- const result = files.map((file) => {
10353
- const stat3 = stats.get(file.path);
10354
- if (stat3) {
10355
- return { ...file, ...stat3 };
10356
- }
10357
- return file;
10358
- });
10359
- resolve3(result);
10360
- });
10361
- proc.on("error", () => {
10362
- resolve3(files);
10363
- });
10364
- });
10365
- }
10366
- function formatResult2(result) {
10367
- const parts = [];
10368
- if (result.error) {
10369
- parts.push(`Error: ${result.error}`);
10370
- parts.push("");
10371
- parts.push("Make sure you are running this command in a git repository.");
10372
- if (result.workingTree.length > 0) {
10373
- parts.push("");
10374
- parts.push(formatWorkingTree(result.workingTree));
10375
- }
10376
- return parts.join("\n");
10377
- }
10378
- if (result.workingTree.length > 0) {
10379
- parts.push(formatWorkingTree(result.workingTree));
10380
- parts.push("");
10381
- }
10382
- parts.push(`Recently committed files (${result.timeRange}):`);
10383
- parts.push("");
10384
- if (result.files.length === 0) {
10385
- parts.push("No files changed in this time period.");
10386
- } else {
10387
- result.files.forEach((file, index) => {
10388
- const stats = file.additions !== void 0 && file.deletions !== void 0 ? ` (+${file.additions}/-${file.deletions})` : "";
10389
- parts.push(`${index + 1}. ${file.path} (${file.changes} commits)${stats}`);
10390
- });
10391
- if (result.totalFiles > result.files.length) {
10392
- parts.push("");
10393
- parts.push(`Showing ${result.files.length} of ${result.totalFiles} changed files.`);
10394
- parts.push(`Use the 'limit' parameter to see more files.`);
10395
- }
10396
- }
10397
- return parts.join("\n");
10398
- }
10399
- function formatWorkingTree(workingTree) {
10400
- const parts = [];
10401
- const staged = workingTree.filter((f) => f.status === "staged");
10402
- const unstaged = workingTree.filter((f) => f.status === "unstaged");
10403
- const untracked = workingTree.filter((f) => f.status === "untracked");
10404
- parts.push("Working tree changes:");
10405
- if (staged.length > 0) {
10406
- parts.push("");
10407
- parts.push(` Staged (${staged.length}):`);
10408
- staged.forEach((f) => parts.push(` ${f.type}: ${f.path}`));
10409
- }
10410
- if (unstaged.length > 0) {
10411
- parts.push("");
10412
- parts.push(` Unstaged (${unstaged.length}):`);
10413
- unstaged.forEach((f) => parts.push(` ${f.type}: ${f.path}`));
10414
- }
10415
- if (untracked.length > 0) {
10416
- parts.push("");
10417
- parts.push(` Untracked (${untracked.length}):`);
10418
- untracked.forEach((f) => parts.push(` ${f.path}`));
10419
- }
10420
- return parts.join("\n");
10421
- }
10422
- var recentChangesTool = {
10423
- name: "recent_changes",
10424
- implementation: (context) => ({
10425
- toolFn: async (value) => {
10426
- const params = value;
10427
- context.logger.info("RecentChanges: Getting recently changed files", {
10428
- since: params.since || DEFAULT_SINCE,
10429
- path: params.path || "all",
10430
- limit: params.limit || DEFAULT_LIMIT,
10431
- include_stats: params.include_stats || DEFAULT_INCLUDE_STATS
10432
- });
10433
- if (context.onStart) {
10434
- await context.onStart("recent_changes", {
10435
- since: params.since,
10436
- path: params.path
10437
- });
10438
- }
10439
- try {
10440
- const result = await getRecentChanges(params);
10441
- const formattedResult = formatResult2(result);
10442
- context.logger.info("RecentChanges: Retrieved file changes", {
10443
- totalFiles: result.totalFiles,
10444
- displayedFiles: result.files.length,
10445
- error: result.error
10446
- });
10447
- if (context.onFinish) {
10448
- await context.onFinish("recent_changes", {
10449
- totalFiles: result.totalFiles,
10450
- displayedFiles: result.files.length
10451
- });
10452
- }
10453
- return formattedResult;
10454
- } catch (error) {
10455
- context.logger.error("RecentChanges: Failed to get changes", error);
10456
- if (context.onFinish) {
10457
- await context.onFinish("recent_changes", {
10458
- error: error instanceof Error ? error.message : "Unknown error"
10459
- });
10460
- }
10461
- throw error;
10462
- }
10463
- },
10464
- toolSchema: {
10465
- name: "recent_changes",
10466
- description: `Get a list of recently changed files in the git repository, including uncommitted working tree changes (staged, unstaged, and untracked files) plus committed changes sorted by activity. This tool is extremely useful for:
10467
-
10468
- - **Debugging recent issues**: "Something broke after my last commit" \u2192 See exactly what changed
10469
- - **Understanding active development**: "What are we working on?" \u2192 See most active files and current work-in-progress
10470
- - **Code review preparation**: "What changed since last release?" \u2192 Get comprehensive file list
10471
- - **Feature context**: "What files are part of the new dashboard?" \u2192 Filter by path
10472
- - **Current work-in-progress**: See staged, unstaged, and untracked files alongside commit history
10473
-
10474
- The tool combines git status (working tree) with git log (commit history) to give a complete picture of recent activity. Working tree changes are shown first, followed by committed files ranked by number of commits (most active first).
10475
-
10476
- **Time Range Examples:**
10477
- - "7 days ago" (default)
10478
- - "2 hours ago"
10479
- - "3 weeks ago"
10480
- - "2025-01-01"
10481
- - "yesterday"
10482
-
10483
- **Path Filter Examples:**
10484
- - "src/components" - Only files in components directory
10485
- - "apps/client" - Only client app files
10486
- - "**/*.test.ts" - Only test files (use glob patterns)
10487
-
10488
- **Performance:** Very fast (< 1 second) since it only queries git metadata, not file contents.`,
10489
- parameters: {
10490
- type: "object",
10491
- properties: {
10492
- since: {
10493
- type: "string",
10494
- description: 'Time range for changes (default: "7 days ago"). Examples: "2 hours ago", "3 weeks ago", "2025-01-01", "yesterday".'
10495
- },
10496
- path: {
10497
- type: "string",
10498
- description: 'Optional path filter to limit results to specific directory or pattern. Examples: "src/components", "apps/client", "**/*.test.ts".'
10499
- },
10500
- limit: {
10501
- type: "number",
10502
- description: "Maximum number of files to return (default: 50). Files are sorted by activity (most commits first)."
10503
- },
10504
- include_stats: {
10505
- type: "boolean",
10506
- description: "Include lines added/removed statistics for each file (default: false). Note: This makes the command slightly slower."
10507
- }
10508
- },
10509
- required: []
10510
- }
10511
- }
10512
- })
10513
- };
10514
-
10515
10180
  // ../../b4m-core/packages/services/dist/src/llm/tools/index.js
10516
- var b4mTools = {
10181
+ var tools = {
10517
10182
  dice_roll: diceRollTool,
10518
10183
  weather_info: weatherTool,
10519
10184
  image_generation: imageGenerationTool,
@@ -10536,23 +10201,18 @@ var b4mTools = {
10536
10201
  sunrise_sunset: sunriseSunsetTool,
10537
10202
  iss_tracker: issTrackerTool,
10538
10203
  planet_visibility: planetVisibilityTool,
10539
- // Knowledge base search
10540
- search_knowledge_base: knowledgeBaseSearchTool
10541
- };
10542
- var cliOnlyTools = {
10543
- // File operation tools
10544
10204
  file_read: fileReadTool,
10545
10205
  create_file: createFileTool,
10546
10206
  edit_local_file: editLocalFileTool,
10547
10207
  glob_files: globFilesTool,
10548
10208
  grep_search: grepSearchTool,
10549
10209
  delete_file: deleteFileTool,
10210
+ // Knowledge base search
10211
+ search_knowledge_base: knowledgeBaseSearchTool,
10550
10212
  // Shell execution
10551
- bash_execute: bashExecuteTool,
10552
- // Git operations
10553
- recent_changes: recentChangesTool
10213
+ bash_execute: bashExecuteTool
10554
10214
  };
10555
- var generateTools = (userId, user, logger2, { db }, storage, imageGenerateStorage, statusUpdate, onStart, onFinish, llm, config, model, tools = b4mTools) => {
10215
+ var generateTools = (userId, user, logger2, { db }, storage, imageGenerateStorage, statusUpdate, onStart, onFinish, llm, config, model) => {
10556
10216
  const context = {
10557
10217
  userId,
10558
10218
  user,
@@ -10573,9 +10233,9 @@ var generateTools = (userId, user, logger2, { db }, storage, imageGenerateStorag
10573
10233
  };
10574
10234
  var ATLASSIAN_RECONNECT_MESSAGE = "\u26A0\uFE0F Your Atlassian connection has expired.\n\nPlease reconnect your Atlassian account in Settings > Connected Apps to continue using Confluence and Jira tools.";
10575
10235
  var generateMcpTools = async (mcpData) => {
10576
- let tools;
10236
+ let tools2;
10577
10237
  try {
10578
- tools = await mcpData.getTools();
10238
+ tools2 = await mcpData.getTools();
10579
10239
  } catch (error) {
10580
10240
  const errorName = error instanceof Error ? error.name : "";
10581
10241
  if (errorName === "AtlassianReconnectRequiredError") {
@@ -10584,12 +10244,12 @@ var generateMcpTools = async (mcpData) => {
10584
10244
  }
10585
10245
  throw error;
10586
10246
  }
10587
- const toolList = Array.isArray(tools) ? tools : tools?.tools || [];
10588
- if (!Array.isArray(tools)) {
10589
- console.warn(`MCP server ${mcpData.serverName} returned unexpected tools payload:`, JSON.stringify(tools));
10247
+ const toolList = Array.isArray(tools2) ? tools2 : tools2?.tools || [];
10248
+ if (!Array.isArray(tools2)) {
10249
+ console.warn(`MCP server ${mcpData.serverName} returned unexpected tools payload:`, JSON.stringify(tools2));
10590
10250
  }
10591
10251
  if (!Array.isArray(toolList)) {
10592
- throw new Error(`Expected getTools() to return an array, but got ${typeof tools}`);
10252
+ throw new Error(`Expected getTools() to return an array, but got ${typeof tools2}`);
10593
10253
  }
10594
10254
  const result = toolList.map((item) => {
10595
10255
  const { name: originalToolName, ...rest } = item;
@@ -10928,8 +10588,7 @@ var LOCAL_TOOLS = [
10928
10588
  "dice_roll",
10929
10589
  "math_evaluate",
10930
10590
  "current_datetime",
10931
- "bash_execute",
10932
- "recent_changes"
10591
+ "bash_execute"
10933
10592
  ];
10934
10593
  function isServerTool(toolName) {
10935
10594
  return SERVER_TOOLS.includes(toolName);
@@ -10955,11 +10614,11 @@ async function executeTool(toolName, input, apiClient, localToolFn) {
10955
10614
  }
10956
10615
 
10957
10616
  // src/utils/shellRunner.ts
10958
- import { spawn as spawn3 } from "child_process";
10617
+ import { spawn as spawn2 } from "child_process";
10959
10618
  async function runShellCommand(options) {
10960
10619
  const { command, cwd, timeoutMs, env, stdin } = options;
10961
10620
  return new Promise((resolve3) => {
10962
- const child = spawn3("bash", ["-c", command], {
10621
+ const child = spawn2("bash", ["-c", command], {
10963
10622
  cwd,
10964
10623
  env,
10965
10624
  stdio: ["pipe", "pipe", "pipe"]
@@ -11388,21 +11047,37 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
11388
11047
  adminSettings: mockAdminSettings
11389
11048
  }
11390
11049
  };
11391
- const enabledB4mToolNames = [
11050
+ const toolConfig = {
11392
11051
  // Local-only tools (no external API keys needed)
11393
- "dice_roll",
11394
- "math_evaluate",
11395
- "current_datetime",
11396
- "prompt_enhancement",
11052
+ dice_roll: {},
11053
+ math_evaluate: {},
11054
+ current_datetime: {},
11055
+ prompt_enhancement: {},
11056
+ // File operation tools (CLI-specific, local execution)
11057
+ file_read: {},
11058
+ create_file: {},
11059
+ edit_local_file: {},
11060
+ glob_files: {},
11061
+ grep_search: {},
11062
+ delete_file: {},
11063
+ // Shell execution (always requires permission)
11064
+ bash_execute: {},
11397
11065
  // Server-side tools (executed via /api/ai/v1/tools Lambda)
11398
- "weather_info",
11399
- "web_search",
11400
- "web_fetch"
11401
- ];
11402
- const filteredB4mTools = Object.fromEntries(
11403
- enabledB4mToolNames.filter((name) => name in b4mTools).map((name) => [name, b4mTools[name]])
11404
- );
11405
- const tools_to_generate = { ...filteredB4mTools, ...cliOnlyTools };
11066
+ // Routed by ToolRouter to use B4M company API keys
11067
+ weather_info: {},
11068
+ web_search: {},
11069
+ web_fetch: {}
11070
+ // Disable web-only tools
11071
+ // blog_publish: undefined,
11072
+ // blog_edit: undefined,
11073
+ // blog_draft: undefined,
11074
+ // image_generation: undefined,
11075
+ // edit_image: undefined,
11076
+ // mermaid_chart: undefined,
11077
+ // recharts: undefined,
11078
+ // edit_file: undefined,
11079
+ // deep_research: undefined,
11080
+ };
11406
11081
  const toolsMap = generateTools(
11407
11082
  userId,
11408
11083
  user,
@@ -11415,18 +11090,17 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
11415
11090
  onStart,
11416
11091
  onFinish,
11417
11092
  llm,
11418
- {},
11419
- model,
11420
- tools_to_generate
11093
+ toolConfig,
11094
+ model
11421
11095
  );
11422
- let tools = Object.entries(toolsMap).map(
11096
+ let tools2 = Object.entries(toolsMap).filter(([key]) => toolConfig[key] !== void 0).map(
11423
11097
  ([_, tool]) => wrapToolWithPermission(tool, permissionManager, showPermissionPrompt, agentContext, configStore, apiClient)
11424
11098
  );
11425
11099
  if (toolFilter) {
11426
11100
  const { allowedTools, deniedTools } = toolFilter;
11427
11101
  const normalizedAllowed = allowedTools?.map(normalizeToolName);
11428
11102
  const normalizedDenied = deniedTools?.map(normalizeToolName);
11429
- tools = tools.filter((tool) => {
11103
+ tools2 = tools2.filter((tool) => {
11430
11104
  const toolName = tool.toolSchema.name;
11431
11105
  if (normalizedDenied && normalizedDenied.includes(toolName)) {
11432
11106
  return false;
@@ -11437,7 +11111,7 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
11437
11111
  return true;
11438
11112
  });
11439
11113
  }
11440
- return { tools, agentContext };
11114
+ return { tools: tools2, agentContext };
11441
11115
  }
11442
11116
 
11443
11117
  // src/utils/PermissionManager.ts
@@ -11815,9 +11489,9 @@ var TokenCounter = class {
11815
11489
  * Count tokens in tool schemas.
11816
11490
  * Tool schemas are sent as part of the API call and consume context.
11817
11491
  */
11818
- countToolSchemaTokens(tools) {
11819
- if (tools.length === 0) return 0;
11820
- const schemaText = tools.map(
11492
+ countToolSchemaTokens(tools2) {
11493
+ if (tools2.length === 0) return 0;
11494
+ const schemaText = tools2.map(
11821
11495
  ({ toolSchema }) => `Tool: ${toolSchema.name}
11822
11496
  Description: ${toolSchema.description}
11823
11497
  Parameters: ${JSON.stringify(toolSchema.parameters)}`
@@ -12119,14 +11793,14 @@ var McpManager = class {
12119
11793
  getTools: async () => client.tools,
12120
11794
  callTool: async (name, args) => client.callTool(name, args)
12121
11795
  };
12122
- const tools = await generateMcpTools(mcpData);
11796
+ const tools2 = await generateMcpTools(mcpData);
12123
11797
  this.servers.set(serverConfig.name, {
12124
11798
  name: serverConfig.name,
12125
11799
  client,
12126
- tools
11800
+ tools: tools2
12127
11801
  });
12128
11802
  this.connectionStates.set(serverConfig.name, "connected");
12129
- logger.debug(`\u2705 Connected to ${serverConfig.name} (${tools.length} tools)`);
11803
+ logger.debug(`\u2705 Connected to ${serverConfig.name} (${tools2.length} tools)`);
12130
11804
  } catch (error) {
12131
11805
  this.connectionStates.set(serverConfig.name, "failed");
12132
11806
  logger.debug(`\u274C Failed to connect to ${serverConfig.name}: ${error}`);
@@ -13011,7 +12685,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
13011
12685
  // package.json
13012
12686
  var package_default = {
13013
12687
  name: "@bike4mind/cli",
13014
- version: "0.2.25-recent-changes-tool.18533+5b2e7f35e",
12688
+ version: "0.2.25-sessions-command-bug-fix.18527+f53af35fb",
13015
12689
  type: "module",
13016
12690
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
13017
12691
  license: "UNLICENSED",
@@ -13119,10 +12793,10 @@ var package_default = {
13119
12793
  },
13120
12794
  devDependencies: {
13121
12795
  "@bike4mind/agents": "0.1.0",
13122
- "@bike4mind/common": "2.47.2-recent-changes-tool.18533+5b2e7f35e",
13123
- "@bike4mind/mcp": "1.28.1-recent-changes-tool.18533+5b2e7f35e",
13124
- "@bike4mind/services": "2.45.2-recent-changes-tool.18533+5b2e7f35e",
13125
- "@bike4mind/utils": "2.3.4-recent-changes-tool.18533+5b2e7f35e",
12796
+ "@bike4mind/common": "2.47.2-sessions-command-bug-fix.18527+f53af35fb",
12797
+ "@bike4mind/mcp": "1.28.1-sessions-command-bug-fix.18527+f53af35fb",
12798
+ "@bike4mind/services": "2.45.2-sessions-command-bug-fix.18527+f53af35fb",
12799
+ "@bike4mind/utils": "2.3.4-sessions-command-bug-fix.18527+f53af35fb",
13126
12800
  "@types/better-sqlite3": "^7.6.13",
13127
12801
  "@types/diff": "^5.0.9",
13128
12802
  "@types/jsonwebtoken": "^9.0.4",
@@ -13139,7 +12813,7 @@ var package_default = {
13139
12813
  optionalDependencies: {
13140
12814
  "@vscode/ripgrep": "^1.17.0"
13141
12815
  },
13142
- gitHead: "5b2e7f35edd2523761a9aba67656a9a6df9c04f1"
12816
+ gitHead: "f53af35fbf7fb0359e33bf88e90b6189c260ff8a"
13143
12817
  };
13144
12818
 
13145
12819
  // src/config/constants.ts
@@ -14424,7 +14098,7 @@ function CliApp() {
14424
14098
  currentAgent: null,
14425
14099
  observationQueue: []
14426
14100
  };
14427
- const { tools: b4mTools2 } = generateCliTools(
14101
+ const { tools: b4mTools } = generateCliTools(
14428
14102
  config.userId,
14429
14103
  llm,
14430
14104
  modelInfo.id,
@@ -14434,7 +14108,7 @@ function CliApp() {
14434
14108
  state.configStore,
14435
14109
  apiClient
14436
14110
  );
14437
- console.log(`\u{1F6E0}\uFE0F Loaded ${b4mTools2.length} B4M tool(s)`);
14111
+ console.log(`\u{1F6E0}\uFE0F Loaded ${b4mTools.length} B4M tool(s)`);
14438
14112
  const mcpManager = new McpManager(config);
14439
14113
  await mcpManager.initialize();
14440
14114
  const mcpTools = mcpManager.getTools();
@@ -14476,7 +14150,7 @@ function CliApp() {
14476
14150
  if (skillTool) {
14477
14151
  cliTools.push(skillTool);
14478
14152
  }
14479
- const allTools = [...b4mTools2, ...mcpTools, ...cliTools];
14153
+ const allTools = [...b4mTools, ...mcpTools, ...cliTools];
14480
14154
  console.log(`\u{1F4C2} Working directory: ${process.cwd()}`);
14481
14155
  console.log(`\u{1F916} Subagent delegation enabled (explore, plan, review)`);
14482
14156
  if (skillTool) {
@@ -14486,7 +14160,7 @@ function CliApp() {
14486
14160
  }
14487
14161
  }
14488
14162
  logger.debug(
14489
- `Total tools available to agent: ${allTools.length} (${b4mTools2.length} B4M + ${mcpTools.length} MCP + ${cliTools.length} CLI)`
14163
+ `Total tools available to agent: ${allTools.length} (${b4mTools.length} B4M + ${mcpTools.length} MCP + ${cliTools.length} CLI)`
14490
14164
  );
14491
14165
  const projectDir = state.configStore.getProjectConfigDir();
14492
14166
  const contextResult = await loadContextFiles(projectDir);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-CRG4F6FD.js";
4
+ } from "./chunk-7L7YVDTP.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/llmMarkdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-CRG4F6FD.js";
4
+ } from "./chunk-7L7YVDTP.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/markdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-ETQCFCFT.js";
6
- import "./chunk-KGERFIL4.js";
7
- import "./chunk-CRG4F6FD.js";
5
+ } from "./chunk-AHVXP2NS.js";
6
+ import "./chunk-6ZSQC2VF.js";
7
+ import "./chunk-7L7YVDTP.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
10
10
  findMostSimilarMemento,
@@ -333,7 +333,7 @@ import {
333
333
  validateReactArtifactV2,
334
334
  validateSvgArtifactV2,
335
335
  wikiMarkupToAdf
336
- } from "./chunk-CRG4F6FD.js";
336
+ } from "./chunk-7L7YVDTP.js";
337
337
  export {
338
338
  ALL_IMAGE_MODELS,
339
339
  ALL_IMAGE_SIZES,
@@ -132,8 +132,8 @@ import {
132
132
  validateMermaidSyntax,
133
133
  warmUpSettingsCache,
134
134
  withRetry
135
- } from "./chunk-KGERFIL4.js";
136
- import "./chunk-CRG4F6FD.js";
135
+ } from "./chunk-6ZSQC2VF.js";
136
+ import "./chunk-7L7YVDTP.js";
137
137
  import {
138
138
  Logger,
139
139
  NotificationDeduplicator,
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-TNLRJZRH.js";
6
- import "./chunk-KGERFIL4.js";
7
- import "./chunk-CRG4F6FD.js";
5
+ } from "./chunk-LPM3TSSU.js";
6
+ import "./chunk-6ZSQC2VF.js";
7
+ import "./chunk-7L7YVDTP.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.25-recent-changes-tool.18533+5b2e7f35e",
3
+ "version": "0.2.25-sessions-command-bug-fix.18527+f53af35fb",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -108,10 +108,10 @@
108
108
  },
109
109
  "devDependencies": {
110
110
  "@bike4mind/agents": "0.1.0",
111
- "@bike4mind/common": "2.47.2-recent-changes-tool.18533+5b2e7f35e",
112
- "@bike4mind/mcp": "1.28.1-recent-changes-tool.18533+5b2e7f35e",
113
- "@bike4mind/services": "2.45.2-recent-changes-tool.18533+5b2e7f35e",
114
- "@bike4mind/utils": "2.3.4-recent-changes-tool.18533+5b2e7f35e",
111
+ "@bike4mind/common": "2.47.2-sessions-command-bug-fix.18527+f53af35fb",
112
+ "@bike4mind/mcp": "1.28.1-sessions-command-bug-fix.18527+f53af35fb",
113
+ "@bike4mind/services": "2.45.2-sessions-command-bug-fix.18527+f53af35fb",
114
+ "@bike4mind/utils": "2.3.4-sessions-command-bug-fix.18527+f53af35fb",
115
115
  "@types/better-sqlite3": "^7.6.13",
116
116
  "@types/diff": "^5.0.9",
117
117
  "@types/jsonwebtoken": "^9.0.4",
@@ -128,5 +128,5 @@
128
128
  "optionalDependencies": {
129
129
  "@vscode/ripgrep": "^1.17.0"
130
130
  },
131
- "gitHead": "5b2e7f35edd2523761a9aba67656a9a6df9c04f1"
131
+ "gitHead": "f53af35fbf7fb0359e33bf88e90b6189c260ff8a"
132
132
  }