@bike4mind/cli 0.1.3 → 0.1.5-feat-automate-cli-publishing.16903

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
@@ -9,6 +9,7 @@ Interactive command-line interface for Bike4Mind with ReAct agents.
9
9
  - 💾 Session persistence
10
10
  - 🛠️ B4M tools + MCP integration
11
11
  - 🎨 Rich terminal UI with Ink
12
+ - 🐛 Debug logging with `--verbose` flag
12
13
 
13
14
  ## Installation
14
15
 
@@ -44,6 +45,29 @@ b4m
44
45
 
45
46
  The CLI will prompt you to authenticate with your Bike4Mind account on first run.
46
47
 
48
+ ### CLI Flags
49
+
50
+ ```bash
51
+ b4m [options]
52
+ ```
53
+
54
+ **Available flags:**
55
+ - `--verbose`, `-v` - Show debug logs in console (useful for troubleshooting)
56
+ - `--help`, `-h` - Show help information
57
+ - `--version`, `-V` - Show CLI version
58
+
59
+ **Examples:**
60
+ ```bash
61
+ # Run with debug logs visible
62
+ b4m --verbose
63
+
64
+ # Check version
65
+ b4m --version
66
+
67
+ # Show help
68
+ b4m --help
69
+ ```
70
+
47
71
  ## Commands
48
72
 
49
73
  While in interactive mode:
@@ -181,6 +205,38 @@ Each session includes:
181
205
  - Agent reasoning steps
182
206
  - Metadata
183
207
 
208
+ ## Debug Logs
209
+
210
+ Debug logs are automatically written to `~/.bike4mind/debug/[session-id].txt` for every session, regardless of the `--verbose` flag.
211
+
212
+ **What's logged:**
213
+ - Session configuration (API endpoint, environment, model)
214
+ - HTTP requests and responses (with size and preview)
215
+ - SSE streaming events from LLM
216
+ - Tool execution details with parameters
217
+ - Error details including CloudFront/WAF errors
218
+ - Authentication flow events
219
+
220
+ **Accessing logs:**
221
+ ```bash
222
+ # List all debug logs
223
+ ls -lh ~/.bike4mind/debug/
224
+
225
+ # View latest session log
226
+ cat ~/.bike4mind/debug/[session-id].txt
227
+
228
+ # View logs in real-time (during session)
229
+ tail -f ~/.bike4mind/debug/[session-id].txt
230
+ ```
231
+
232
+ **Log retention:**
233
+ - Debug logs older than 30 days are automatically cleaned up on CLI startup
234
+ - Each log file is named by session ID for easy correlation
235
+
236
+ **Verbose mode:**
237
+ - Without `--verbose`: Debug logs only written to file (clean console output)
238
+ - With `--verbose`: Debug logs shown in console AND written to file
239
+
184
240
  ## Development
185
241
 
186
242
  ```bash
@@ -221,7 +277,7 @@ apps/cli/
221
277
  - `@bike4mind/mcp` - MCP integration
222
278
  - `@bike4mind/utils` - LLM backends
223
279
  - `ink` - React for CLIs
224
- - `commander` - CLI argument parsing
280
+ - `yargs` - CLI argument parsing
225
281
  - `lowdb` - Local storage
226
282
 
227
283
  ## Development Status
@@ -235,6 +291,7 @@ Current implementation includes:
235
291
  ✅ Interactive UI with Ink
236
292
  ✅ B4M tools integration
237
293
  ✅ MCP tools support
294
+ ✅ Debug logging with --verbose flag
238
295
 
239
296
  Coming soon:
240
297
 
@@ -21,11 +21,32 @@ import { createRequire } from 'module';
21
21
  import { fileURLToPath } from 'url';
22
22
  import { dirname, join } from 'path';
23
23
  import { existsSync } from 'fs';
24
+ import yargs from 'yargs';
25
+ import { hideBin } from 'yargs/helpers';
24
26
 
25
27
  const __filename = fileURLToPath(import.meta.url);
26
28
  const __dirname = dirname(__filename);
27
29
  const require = createRequire(import.meta.url);
28
30
 
31
+ // Parse CLI arguments
32
+ const argv = yargs(hideBin(process.argv))
33
+ .option('verbose', {
34
+ alias: 'v',
35
+ type: 'boolean',
36
+ description: 'Show debug logs in console',
37
+ default: false,
38
+ })
39
+ .help()
40
+ .alias('help', 'h')
41
+ .version()
42
+ .alias('version', 'V')
43
+ .parse();
44
+
45
+ // Set environment variable for verbose mode
46
+ if (argv.verbose) {
47
+ process.env.B4M_VERBOSE = '1';
48
+ }
49
+
29
50
  // Auto-detect environment: prefer production mode when dist exists
30
51
  const distPath = join(__dirname, '../dist/index.js');
31
52
  const srcPath = join(__dirname, '../src/index.tsx');
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-MKO2KCCS.js";
4
+ } from "./chunk-PG4BD2XZ.js";
5
5
  import "./chunk-PDX44BCA.js";
6
6
 
7
7
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/artifactExtractor.js