@bike4mind/cli 0.2.14-feat-auto-context-customization.17477 → 0.2.14-feat-cli-mcp-management.17478

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.
@@ -29,7 +29,7 @@ const __dirname = dirname(__filename);
29
29
  const require = createRequire(import.meta.url);
30
30
 
31
31
  // Parse CLI arguments
32
- const argv = yargs(hideBin(process.argv))
32
+ const argv = await yargs(hideBin(process.argv))
33
33
  .option('verbose', {
34
34
  alias: 'v',
35
35
  type: 'boolean',
@@ -41,6 +41,48 @@ const argv = yargs(hideBin(process.argv))
41
41
  description: 'Disable loading project-specific configuration (.bike4mind/)',
42
42
  default: false,
43
43
  })
44
+ .command('mcp', 'Manage MCP (Model Context Protocol) servers', (yargs) => {
45
+ return yargs
46
+ .command('list', 'List configured MCP servers', {}, async () => {
47
+ // Handled by external command handler
48
+ })
49
+ .command('add <name>', 'Add a new MCP server', (yargs) => {
50
+ return yargs
51
+ .positional('name', {
52
+ type: 'string',
53
+ describe: 'Server name',
54
+ })
55
+ .example('b4m mcp add context7 -- npx -y @upstash/context7-mcp', 'Add context7 MCP server')
56
+ .example('b4m mcp add github -- docker run -i ghcr.io/modelcontextprotocol/servers/github', 'Add GitHub MCP server');
57
+ }, async () => {
58
+ // Handled by external command handler
59
+ })
60
+ .command('remove <name>', 'Remove an MCP server', (yargs) => {
61
+ return yargs.positional('name', {
62
+ type: 'string',
63
+ describe: 'Server name',
64
+ });
65
+ }, async () => {
66
+ // Handled by external command handler
67
+ })
68
+ .command('enable <name>', 'Enable an MCP server', (yargs) => {
69
+ return yargs.positional('name', {
70
+ type: 'string',
71
+ describe: 'Server name',
72
+ });
73
+ }, async () => {
74
+ // Handled by external command handler
75
+ })
76
+ .command('disable <name>', 'Disable an MCP server', (yargs) => {
77
+ return yargs.positional('name', {
78
+ type: 'string',
79
+ describe: 'Server name',
80
+ });
81
+ }, async () => {
82
+ // Handled by external command handler
83
+ })
84
+ .demandCommand(1, 'You must provide a subcommand (list, add, remove, enable, disable)');
85
+ })
44
86
  .help()
45
87
  .alias('help', 'h')
46
88
  .version()
@@ -50,6 +92,7 @@ const argv = yargs(hideBin(process.argv))
50
92
  // Set environment variables from CLI flags
51
93
  if (argv.verbose) {
52
94
  process.env.B4M_VERBOSE = '1';
95
+ process.env.LOG_LEVEL = 'debug'; // Enable debug logs in core packages
53
96
  }
54
97
  if (argv['no-project-config']) {
55
98
  process.env.B4M_NO_PROJECT_CONFIG = '1';
@@ -68,6 +111,34 @@ const hasDist = existsSync(distPath);
68
111
  const isDev = process.env.NODE_ENV === 'development' ||
69
112
  (!hasDist && hasSource);
70
113
 
114
+ // Handle MCP subcommands (external commands)
115
+ // Must be done after mode detection to use correct import path
116
+ if (argv._[0] === 'mcp') {
117
+ const mcpSubcommand = argv._[1];
118
+
119
+ try {
120
+ let handleMcpCommand;
121
+
122
+ if (isDev) {
123
+ // Development: use tsx to import TypeScript
124
+ const { register } = require('tsx/esm/api');
125
+ register();
126
+ const module = await import('../src/commands/mcpCommand.ts');
127
+ handleMcpCommand = module.handleMcpCommand;
128
+ } else {
129
+ // Production: import compiled JavaScript
130
+ const module = await import('../dist/commands/mcpCommand.js');
131
+ handleMcpCommand = module.handleMcpCommand;
132
+ }
133
+
134
+ await handleMcpCommand(mcpSubcommand, argv);
135
+ process.exit(0);
136
+ } catch (error) {
137
+ console.error('Error:', error.message);
138
+ process.exit(1);
139
+ }
140
+ }
141
+
71
142
  if (isDev) {
72
143
  // Show dev mode indicator for developers
73
144
  console.log('🔧 Running in development mode (using TypeScript source)\n');
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-PGQJWOFR.js";
4
+ } from "./chunk-A7POWM75.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;
@@ -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
  ]);
@@ -7,11 +7,11 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-TJAFO6U3.js";
10
+ } from "./chunk-GFL7CMSL.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
14
- } from "./chunk-PGQJWOFR.js";
14
+ } from "./chunk-A7POWM75.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/fabFileService/create.js
17
17
  import { z } from "zod";