claude-flow 2.7.42 → 2.7.43

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/bin/claude-flow CHANGED
@@ -2,7 +2,7 @@
2
2
  # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
3
3
  # Enhanced with NPX cache error handling and retry logic
4
4
 
5
- VERSION="2.7.42"
5
+ VERSION="2.7.43"
6
6
 
7
7
  # Determine the correct path based on how the script is invoked
8
8
  if [ -L "$0" ]; then
@@ -120,128 +120,4 @@ export function createConfigCommand() {
120
120
  return config;
121
121
  }
122
122
 
123
- //# sourceMappingURL=config.js.map printError('Configuration file not found');
124
- console.log('Run "claude-flow config init" to create configuration');
125
- }
126
- }
127
- async function setConfigValue(subArgs, flags) {
128
- const key = subArgs[1];
129
- const value = subArgs[2];
130
- const configFile = 'claude-flow.config.json';
131
- if (!key || value === undefined) {
132
- printError('Usage: config set <key> <value>');
133
- console.log('Examples:');
134
- console.log(' claude-flow config set terminal.poolSize 15');
135
- console.log(' claude-flow config set orchestrator.taskTimeout 600000');
136
- return;
137
- }
138
- try {
139
- let config = await readJsonFile(configFile, {});
140
- let parsedValue = value;
141
- if (value === 'true') parsedValue = true;
142
- else if (value === 'false') parsedValue = false;
143
- else if (!isNaN(value) && value.trim() !== '') parsedValue = Number(value);
144
- setNestedValue(config, key, parsedValue);
145
- await writeJsonFile(configFile, config);
146
- printSuccess(`Set ${key} = ${JSON.stringify(parsedValue)}`);
147
- } catch (err) {
148
- printError(`Failed to set configuration: ${err.message}`);
149
- }
150
- }
151
- async function validateConfig(subArgs, flags) {
152
- const configFile = 'claude-flow.config.json';
153
- try {
154
- const config = await readJsonFile(configFile);
155
- printSuccess('Validating configuration...');
156
- const errors = [];
157
- const warnings = [];
158
- const requiredSections = [
159
- 'terminal',
160
- 'orchestrator',
161
- 'memory'
162
- ];
163
- for (const section of requiredSections){
164
- if (!config[section]) {
165
- errors.push(`Missing required section: ${section}`);
166
- }
167
- }
168
- if (config.terminal?.poolSize && (config.terminal.poolSize < 1 || config.terminal.poolSize > 100)) {
169
- warnings.push('Terminal pool size should be between 1 and 100');
170
- }
171
- if (config.orchestrator?.maxConcurrentTasks && config.orchestrator.maxConcurrentTasks < 1) {
172
- errors.push('Max concurrent tasks must be at least 1');
173
- }
174
- if (config.agents?.maxAgents && config.agents.maxAgents < 1) {
175
- errors.push('Max agents must be at least 1');
176
- }
177
- if (errors.length === 0 && warnings.length === 0) {
178
- printSuccess('✅ Configuration is valid');
179
- } else {
180
- if (errors.length > 0) {
181
- printError(`Found ${errors.length} error(s):`);
182
- errors.forEach((error)=>console.log(` ❌ ${error}`));
183
- }
184
- if (warnings.length > 0) {
185
- printWarning(`Found ${warnings.length} warning(s):`);
186
- warnings.forEach((warning)=>console.log(` ⚠️ ${warning}`));
187
- }
188
- }
189
- } catch (err) {
190
- printError('Configuration file not found or invalid');
191
- console.log('Run "claude-flow config init" to create valid configuration');
192
- }
193
- }
194
- async function resetConfig(subArgs, flags) {
195
- const force = subArgs.includes('--force') || subArgs.includes('-f');
196
- if (!force) {
197
- printWarning('This will reset configuration to defaults');
198
- console.log('Use --force to confirm reset');
199
- return;
200
- }
201
- await initConfig([
202
- '--force'
203
- ], flags);
204
- printSuccess('Configuration reset to defaults');
205
- }
206
- function getNestedValue(obj, path) {
207
- return path.split('.').reduce((current, key)=>current?.[key], obj);
208
- }
209
- function setNestedValue(obj, path, value) {
210
- const keys = path.split('.');
211
- const last = keys.pop();
212
- const target = keys.reduce((current, key)=>{
213
- if (!current[key]) current[key] = {};
214
- return current[key];
215
- }, obj);
216
- target[last] = value;
217
- }
218
- function getFlag(args, flagName) {
219
- const index = args.indexOf(flagName);
220
- return index !== -1 && index + 1 < args.length ? args[index + 1] : null;
221
- }
222
- function showConfigHelp() {
223
- console.log('Configuration commands:');
224
- console.log(' init [--force] Create default configuration');
225
- console.log(' show [--format json] Display current configuration');
226
- console.log(' get <key> Get configuration value');
227
- console.log(' set <key> <value> Set configuration value');
228
- console.log(' validate Validate configuration');
229
- console.log(' reset --force Reset to defaults');
230
- console.log();
231
- console.log('Configuration Keys:');
232
- console.log(' terminal.poolSize Terminal pool size');
233
- console.log(' terminal.recycleAfter Commands before recycle');
234
- console.log(' orchestrator.maxConcurrentTasks Max parallel tasks');
235
- console.log(' orchestrator.taskTimeout Task timeout in ms');
236
- console.log(' memory.backend Memory storage backend');
237
- console.log(' memory.path Memory database path');
238
- console.log(' agents.maxAgents Maximum number of agents');
239
- console.log();
240
- console.log('Examples:');
241
- console.log(' claude-flow config init');
242
- console.log(' claude-flow config set terminal.poolSize 15');
243
- console.log(' claude-flow config get orchestrator.maxConcurrentTasks');
244
- console.log(' claude-flow config validate');
245
- }
246
-
247
123
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/cli/simple-commands/config.ts"],"sourcesContent":["/**\n * Config CLI Commands - Manage provider configuration\n */\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport inquirer from 'inquirer';\nimport { ProviderManager } from '../../execution/provider-manager.js';\n\nexport function createConfigCommand(): Command {\n const config = new Command('config')\n .description('Manage provider configuration');\n\n // config set-provider command\n config\n .command('set-provider')\n .description('Set default provider')\n .argument('<provider>', 'Provider name (anthropic, openrouter, onnx, gemini)')\n .option('-m, --model <model>', 'Default model for provider')\n .action(async (provider, options) => {\n try {\n const manager = new ProviderManager();\n\n await manager.setDefaultProvider(provider);\n\n if (options.model) {\n await manager.configureProvider(provider, {\n model: options.model,\n enabled: true,\n } as any);\n }\n\n console.log(chalk.green(`✓ Default provider set to: ${provider}`));\n if (options.model) {\n console.log(chalk.green(`✓ Default model set to: ${options.model}`));\n }\n } catch (error: any) {\n console.error(chalk.red('✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\n // config list-providers command\n config\n .command('list-providers')\n .alias('list')\n .description('List configured providers')\n .option('-f, --format <format>', 'Output format (text, json)', 'text')\n .action(async (options) => {\n try {\n const manager = new ProviderManager();\n const providers = manager.listProviders();\n const defaultProvider = manager.getDefaultProvider();\n\n if (options.format === 'json') {\n console.log(JSON.stringify({ defaultProvider, providers }, null, 2));\n } else {\n console.log(chalk.cyan('\\n📋 Configured Providers:\\n'));\n console.log(chalk.white(`Default: ${chalk.bold(defaultProvider)}\\n`));\n\n providers.forEach(provider => {\n const isDefault = provider.name === defaultProvider;\n const prefix = isDefault ? chalk.green('●') : chalk.gray('○');\n const status = provider.enabled ? chalk.green('enabled') : chalk.gray('disabled');\n\n console.log(`${prefix} ${chalk.bold(provider.name)}`);\n console.log(` Model: ${provider.model || 'default'}`);\n console.log(` Priority: ${provider.priority || 'balanced'}`);\n console.log(` Status: ${status}`);\n console.log('');\n });\n }\n } catch (error: any) {\n console.error(chalk.red('✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\n // config wizard command\n config\n .command('wizard')\n .description('Interactive provider configuration wizard')\n .action(async () => {\n try {\n const manager = new ProviderManager();\n\n console.log(chalk.cyan('\\n🧙 Provider Configuration Wizard\\n'));\n\n const answers = await inquirer.prompt([\n {\n type: 'list',\n name: 'defaultProvider',\n message: 'Select default provider:',\n choices: [\n { name: 'Anthropic (Highest quality)', value: 'anthropic' },\n { name: 'OpenRouter (99% cost savings)', value: 'openrouter' },\n { name: 'ONNX (Free local inference)', value: 'onnx' },\n { name: 'Gemini (Free tier)', value: 'gemini' },\n ],\n },\n {\n type: 'list',\n name: 'optimization',\n message: 'Optimization priority:',\n choices: [\n { name: 'Balanced (recommended)', value: 'balanced' },\n { name: 'Cost (cheapest)', value: 'cost' },\n { name: 'Quality (best results)', value: 'quality' },\n { name: 'Speed (fastest)', value: 'speed' },\n { name: 'Privacy (local only)', value: 'privacy' },\n ],\n },\n ]);\n\n await manager.setDefaultProvider(answers.defaultProvider);\n\n console.log(chalk.green('\\n✓ Configuration saved successfully!'));\n console.log(chalk.gray(`\\nDefault provider: ${answers.defaultProvider}`));\n console.log(chalk.gray(`Optimization: ${answers.optimization}`));\n } catch (error: any) {\n console.error(chalk.red('\\n✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\n return config;\n}\n"],"names":["Command","chalk","inquirer","ProviderManager","createConfigCommand","config","description","command","argument","option","action","provider","options","manager","setDefaultProvider","model","configureProvider","enabled","console","log","green","error","red","message","process","exit","alias","providers","listProviders","defaultProvider","getDefaultProvider","format","JSON","stringify","cyan","white","bold","forEach","isDefault","name","prefix","gray","status","priority","answers","prompt","type","choices","value","optimization"],"mappings":"AAIA,SAASA,OAAO,QAAQ,YAAY;AACpC,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,cAAc,WAAW;AAChC,SAASC,eAAe,QAAQ,sCAAsC;AAEtE,OAAO,SAASC;IACd,MAAMC,SAAS,IAAIL,QAAQ,UACxBM,WAAW,CAAC;IAGfD,OACGE,OAAO,CAAC,gBACRD,WAAW,CAAC,wBACZE,QAAQ,CAAC,cAAc,uDACvBC,MAAM,CAAC,uBAAuB,8BAC9BC,MAAM,CAAC,OAAOC,UAAUC;QACvB,IAAI;YACF,MAAMC,UAAU,IAAIV;YAEpB,MAAMU,QAAQC,kBAAkB,CAACH;YAEjC,IAAIC,QAAQG,KAAK,EAAE;gBACjB,MAAMF,QAAQG,iBAAiB,CAACL,UAAU;oBACxCI,OAAOH,QAAQG,KAAK;oBACpBE,SAAS;gBACX;YACF;YAEAC,QAAQC,GAAG,CAAClB,MAAMmB,KAAK,CAAC,CAAC,2BAA2B,EAAET,UAAU;YAChE,IAAIC,QAAQG,KAAK,EAAE;gBACjBG,QAAQC,GAAG,CAAClB,MAAMmB,KAAK,CAAC,CAAC,wBAAwB,EAAER,QAAQG,KAAK,EAAE;YACpE;QACF,EAAE,OAAOM,OAAY;YACnBH,QAAQG,KAAK,CAACpB,MAAMqB,GAAG,CAAC,aAAaD,MAAME,OAAO;YAClDC,QAAQC,IAAI,CAAC;QACf;IACF;IAGFpB,OACGE,OAAO,CAAC,kBACRmB,KAAK,CAAC,QACNpB,WAAW,CAAC,6BACZG,MAAM,CAAC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,MAAM,CAAC;QACN,IAAI;YACF,MAAMG,UAAU,IAAIV;YAEpBe,QAAQC,GAAG,CAAClB,MAAMiC,IAAI,CAAC;YAEvB,MAAMU,UAAU,MAAM1C,SAAS2C,MAAM,CAAC;gBACpC;oBACEC,MAAM;oBACNP,MAAM;oBACNhB,SAAS;oBACTwB,SAAS;wBACP;4BAAER,MAAM;4BAA+BS,OAAO;wBAAY;wBAC1D;4BAAET,MAAM;4BAAiCS,OAAO;wBAAa;wBAC7D;4BAAET,MAAM;4BAA+BS,OAAO;wBAAO;wBACrD;4BAAET,MAAM;4BAAsBS,OAAO;wBAAS;qBAC/C;gBACH;gBACA;oBACEF,MAAM;oBACNP,MAAM;oBACNhB,SAAS;oBACTwB,SAAS;wBACP;4BAAER,MAAM;4BAA0BS,OAAO;wBAAW;wBACpD;4BAAET,MAAM;4BAAmBS,OAAO;wBAAO;wBACzC;4BAAET,MAAM;4BAA0BS,OAAO;wBAAU;wBACnD;4BAAET,MAAM;4BAAmBS,OAAO;wBAAQ;wBAC1C;4BAAET,MAAM;4BAAwBS,OAAO;wBAAU;qBAClD;gBACH;aACD;YAED,MAAMnC,QAAQC,kBAAkB,CAAC8B,QAAQf,eAAe;YAExDX,QAAQC,GAAG,CAAClB,MAAMmB,KAAK,CAAC;YACxBF,QAAQC,GAAG,CAAClB,MAAMwC,IAAI,CAAC,CAAC,oBAAoB,EAAEG,QAAQf,eAAe,EAAE;YACvEX,QAAQC,GAAG,CAAClB,MAAMwC,IAAI,CAAC,CAAC,cAAc,EAAEG,QAAQK,YAAY,EAAE;QAChE,EAAE,OAAO5B,OAAY;YACnBH,QAAQG,KAAK,CAACpB,MAAMqB,GAAG,CAAC,eAAeD,MAAME,OAAO;YACpDC,QAAQC,IAAI,CAAC;QACf;IACF;IAEF,OAAOpB;AACT"}lags) {\n const force = subArgs.includes('--force') || subArgs.includes('-f');\n\n if (!force) {\n printWarning('This will reset configuration to defaults');\n console.log('Use --force to confirm reset');\n return;\n }\n\n await initConfig(['--force'], flags);\n printSuccess('Configuration reset to defaults');\n}\n\n// Helper functions\nfunction getNestedValue(obj, path) {\n return path.split('.').reduce((current, key) => current?.[key], obj);\n}\n\nfunction setNestedValue(obj, path, value) {\n const keys = path.split('.');\n const last = keys.pop();\n const target = keys.reduce((current, key) => {\n if (!current[key]) current[key] = {};\n return current[key];\n }, obj);\n target[last] = value;\n}\n\nfunction getFlag(args, flagName) {\n const index = args.indexOf(flagName);\n return index !== -1 && index + 1 < args.length ? args[index + 1] : null;\n}\n\n// fileExists is now imported from utils.js\n\nfunction showConfigHelp() {\n console.log('Configuration commands:');\n console.log(' init [--force] Create default configuration');\n console.log(' show [--format json] Display current configuration');\n console.log(' get <key> Get configuration value');\n console.log(' set <key> <value> Set configuration value');\n console.log(' validate Validate configuration');\n console.log(' reset --force Reset to defaults');\n console.log();\n console.log('Configuration Keys:');\n console.log(' terminal.poolSize Terminal pool size');\n console.log(' terminal.recycleAfter Commands before recycle');\n console.log(' orchestrator.maxConcurrentTasks Max parallel tasks');\n console.log(' orchestrator.taskTimeout Task timeout in ms');\n console.log(' memory.backend Memory storage backend');\n console.log(' memory.path Memory database path');\n console.log(' agents.maxAgents Maximum number of agents');\n console.log();\n console.log('Examples:');\n console.log(' claude-flow config init');\n console.log(' claude-flow config set terminal.poolSize 15');\n console.log(' claude-flow config get orchestrator.maxConcurrentTasks');\n console.log(' claude-flow config validate');\n}\n"],"names":["printSuccess","printError","printWarning","readJsonFile","writeJsonFile","fileExists","configCommand","subArgs","flags","configCmd","initConfig","showConfig","getConfigValue","setConfigValue","validateConfig","resetConfig","showConfigHelp","force","includes","configFile","exists","console","log","defaultConfig","version","terminal","poolSize","recycleAfter","healthCheckInterval","type","orchestrator","maxConcurrentTasks","taskTimeout","defaultPriority","memory","backend","path","cacheSize","indexing","agents","maxAgents","defaultCapabilities","resourceLimits","cpu","mcp","port","host","timeout","logging","level","file","maxSize","maxFiles","err","message","format","getFlag","config","JSON","stringify","key","value","getNestedValue","undefined","parsedValue","isNaN","trim","Number","setNestedValue","errors","warnings","requiredSections","section","push","length","forEach","error","warning","obj","split","reduce","current","keys","last","pop","target","args","flagName","index","indexOf"],"mappings":"AACA,SACEA,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,aAAa,EACbC,UAAU,QACL,cAAc;AAErB,OAAO,eAAeC,cAAcC,OAAO,EAAEC,KAAK;IAChD,MAAMC,YAAYF,OAAO,CAAC,EAAE;IAE5B,OAAQE;QACN,KAAK;YACH,MAAMC,WAAWH,SAASC;YAC1B;QAEF,KAAK;YACH,MAAMG,WAAWJ,SAASC;YAC1B;QAEF,KAAK;YACH,MAAMI,eAAeL,SAASC;YAC9B;QAEF,KAAK;YACH,MAAMK,eAAeN,SAASC;YAC9B;QAEF,KAAK;YACH,MAAMM,eAAeP,SAASC;YAC9B;QAEF,KAAK;YACH,MAAMO,YAAYR,SAASC;YAC3B;QAEF;YACEQ;IACJ;AACF;AAEA,eAAeN,WAAWH,OAAO,EAAEC,KAAK;IACtC,MAAMS,QAAQV,QAAQW,QAAQ,CAAC,cAAcX,QAAQW,QAAQ,CAAC;IAC9D,MAAMC,aAAa;IAEnB,IAAI;QAEF,MAAMC,SAAS,MAAMf,WAAWc;QAChC,IAAIC,UAAU,CAACH,OAAO;YACpBf,aAAa;YACbmB,QAAQC,GAAG,CAAC;YACZ;QACF;QAEAtB,aAAa;QAGb,MAAMuB,gBAAgB;YACpBC,SAAS;YACTC,UAAU;gBACRC,UAAU;gBACVC,cAAc;gBACdC,qBAAqB;gBACrBC,MAAM;YACR;YACAC,cAAc;gBACZC,oBAAoB;gBACpBC,aAAa;gBACbC,iBAAiB;YACnB;YACAC,QAAQ;gBACNC,SAAS;gBACTC,MAAM;gBACNC,WAAW;gBACXC,UAAU;YACZ;YACAC,QAAQ;gBACNC,WAAW;gBACXC,qBAAqB;oBAAC;oBAAY;oBAAQ;iBAAW;gBACrDC,gBAAgB;oBACdR,QAAQ;oBACRS,KAAK;gBACP;YAC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KAAK2C,KAAK,CAAC;IACxB,MAAMI,OAAOD,KAAKE,GAAG;IACrB,MAAMC,SAASH,KAAKF,MAAM,CAAC,CAACC,SAASrB;QACnC,IAAI,CAACqB,OAAO,CAACrB,IAAI,EAAEqB,OAAO,CAACrB,IAAI,GAAG,CAAC;QACnC,OAAOqB,OAAO,CAACrB,IAAI;IACrB,GAAGkB;IACHO,MAAM,CAACF,KAAK,GAAGtB;AACjB;AAEA,SAASL,QAAQ8B,IAAI,EAAEC,QAAQ;IAC7B,MAAMC,QAAQF,KAAKG,OAAO,CAACF;IAC3B,OAAOC,UAAU,CAAC,KAAKA,QAAQ,IAAIF,KAAKZ,MAAM,GAAGY,IAAI,CAACE,QAAQ,EAAE,GAAG;AACrE;AAIA,SAASxE;IACPK,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG;IACXD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;AACd"}
1
+ {"version":3,"sources":["../../../../src/cli/simple-commands/config.ts"],"sourcesContent":["/**\n * Config CLI Commands - Manage provider configuration\n */\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport inquirer from 'inquirer';\nimport { ProviderManager } from '../../execution/provider-manager.js';\n\nexport function createConfigCommand(): Command {\n const config = new Command('config')\n .description('Manage provider configuration');\n\n // config set-provider command\n config\n .command('set-provider')\n .description('Set default provider')\n .argument('<provider>', 'Provider name (anthropic, openrouter, onnx, gemini)')\n .option('-m, --model <model>', 'Default model for provider')\n .action(async (provider, options) => {\n try {\n const manager = new ProviderManager();\n\n await manager.setDefaultProvider(provider);\n\n if (options.model) {\n await manager.configureProvider(provider, {\n model: options.model,\n enabled: true,\n } as any);\n }\n\n console.log(chalk.green(`✓ Default provider set to: ${provider}`));\n if (options.model) {\n console.log(chalk.green(`✓ Default model set to: ${options.model}`));\n }\n } catch (error: any) {\n console.error(chalk.red('✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\n // config list-providers command\n config\n .command('list-providers')\n .alias('list')\n .description('List configured providers')\n .option('-f, --format <format>', 'Output format (text, json)', 'text')\n .action(async (options) => {\n try {\n const manager = new ProviderManager();\n const providers = manager.listProviders();\n const defaultProvider = manager.getDefaultProvider();\n\n if (options.format === 'json') {\n console.log(JSON.stringify({ defaultProvider, providers }, null, 2));\n } else {\n console.log(chalk.cyan('\\n📋 Configured Providers:\\n'));\n console.log(chalk.white(`Default: ${chalk.bold(defaultProvider)}\\n`));\n\n providers.forEach(provider => {\n const isDefault = provider.name === defaultProvider;\n const prefix = isDefault ? chalk.green('●') : chalk.gray('○');\n const status = provider.enabled ? chalk.green('enabled') : chalk.gray('disabled');\n\n console.log(`${prefix} ${chalk.bold(provider.name)}`);\n console.log(` Model: ${provider.model || 'default'}`);\n console.log(` Priority: ${provider.priority || 'balanced'}`);\n console.log(` Status: ${status}`);\n console.log('');\n });\n }\n } catch (error: any) {\n console.error(chalk.red('✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\n // config wizard command\n config\n .command('wizard')\n .description('Interactive provider configuration wizard')\n .action(async () => {\n try {\n const manager = new ProviderManager();\n\n console.log(chalk.cyan('\\n🧙 Provider Configuration Wizard\\n'));\n\n const answers = await inquirer.prompt([\n {\n type: 'list',\n name: 'defaultProvider',\n message: 'Select default provider:',\n choices: [\n { name: 'Anthropic (Highest quality)', value: 'anthropic' },\n { name: 'OpenRouter (99% cost savings)', value: 'openrouter' },\n { name: 'ONNX (Free local inference)', value: 'onnx' },\n { name: 'Gemini (Free tier)', value: 'gemini' },\n ],\n },\n {\n type: 'list',\n name: 'optimization',\n message: 'Optimization priority:',\n choices: [\n { name: 'Balanced (recommended)', value: 'balanced' },\n { name: 'Cost (cheapest)', value: 'cost' },\n { name: 'Quality (best results)', value: 'quality' },\n { name: 'Speed (fastest)', value: 'speed' },\n { name: 'Privacy (local only)', value: 'privacy' },\n ],\n },\n ]);\n\n await manager.setDefaultProvider(answers.defaultProvider);\n\n console.log(chalk.green('\\n✓ Configuration saved successfully!'));\n console.log(chalk.gray(`\\nDefault provider: ${answers.defaultProvider}`));\n console.log(chalk.gray(`Optimization: ${answers.optimization}`));\n } catch (error: any) {\n console.error(chalk.red('\\n✗ Error:'), error.message);\n process.exit(1);\n }\n });\n\n return config;\n}\n"],"names":["Command","chalk","inquirer","ProviderManager","createConfigCommand","config","description","command","argument","option","action","provider","options","manager","setDefaultProvider","model","configureProvider","enabled","console","log","green","error","red","message","process","exit","alias","providers","listProviders","defaultProvider","getDefaultProvider","format","JSON","stringify","cyan","white","bold","forEach","isDefault","name","prefix","gray","status","priority","answers","prompt","type","choices","value","optimization"],"mappings":"AAIA,SAASA,OAAO,QAAQ,YAAY;AACpC,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,cAAc,WAAW;AAChC,SAASC,eAAe,QAAQ,sCAAsC;AAEtE,OAAO,SAASC;IACd,MAAMC,SAAS,IAAIL,QAAQ,UACxBM,WAAW,CAAC;IAGfD,OACGE,OAAO,CAAC,gBACRD,WAAW,CAAC,wBACZE,QAAQ,CAAC,cAAc,uDACvBC,MAAM,CAAC,uBAAuB,8BAC9BC,MAAM,CAAC,OAAOC,UAAUC;QACvB,IAAI;YACF,MAAMC,UAAU,IAAIV;YAEpB,MAAMU,QAAQC,kBAAkB,CAACH;YAEjC,IAAIC,QA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MnC,QAAQC,kBAAkB,CAAC8B,QAAQf,eAAe;YAExDX,QAAQC,GAAG,CAAClB,MAAMmB,KAAK,CAAC;YACxBF,QAAQC,GAAG,CAAClB,MAAMwC,IAAI,CAAC,CAAC,oBAAoB,EAAEG,QAAQf,eAAe,EAAE;YACvEX,QAAQC,GAAG,CAAClB,MAAMwC,IAAI,CAAC,CAAC,cAAc,EAAEG,QAAQK,YAAY,EAAE;QAChE,EAAE,OAAO5B,OAAY;YACnBH,QAAQG,KAAK,CAACpB,MAAMqB,GAAG,CAAC,eAAeD,MAAME,OAAO;YACpDC,QAAQC,IAAI,CAAC;QACf;IACF;IAEF,OAAOpB;AACT"}
@@ -12,14 +12,23 @@ let sqliteAvailable = false;
12
12
  async function loadSqlite() {
13
13
  if (Database !== null) return sqliteAvailable;
14
14
  try {
15
- const sqlite = await import('better-sqlite3');
16
- Database = sqlite.default;
15
+ const { createRequire } = await import('module');
16
+ const require = createRequire(import.meta.url);
17
+ Database = require('better-sqlite3');
17
18
  const testDb = new Database(':memory:');
18
19
  testDb.close();
19
20
  sqliteAvailable = true;
20
- } catch (err) {
21
- sqliteAvailable = false;
22
- Database = null;
21
+ } catch (requireErr) {
22
+ try {
23
+ const sqlite = await import('better-sqlite3');
24
+ Database = sqlite.default || sqlite;
25
+ const testDb = new Database(':memory:');
26
+ testDb.close();
27
+ sqliteAvailable = true;
28
+ } catch (err) {
29
+ sqliteAvailable = false;
30
+ Database = null;
31
+ }
23
32
  }
24
33
  return sqliteAvailable;
25
34
  }
@@ -494,6 +503,14 @@ async function spawnSwarmWizard() {
494
503
  return swarmResult;
495
504
  }
496
505
  async function spawnSwarm(args, flags) {
506
+ const hasSqlite = await loadSqlite();
507
+ if (!hasSqlite) {
508
+ console.error(chalk.red('Error: SQLite is required for hive-mind spawn'));
509
+ console.log(chalk.yellow('Please ensure better-sqlite3 is properly installed:'));
510
+ console.log(chalk.gray(' npm install better-sqlite3'));
511
+ console.log(chalk.gray(' # or for ARM64/M1: npm rebuild better-sqlite3'));
512
+ return;
513
+ }
497
514
  const objective = args.join(' ').trim();
498
515
  const isNonInteractive = flags['non-interactive'] || flags.nonInteractive;
499
516
  if (!objective && !flags.wizard) {
@@ -1048,6 +1065,11 @@ async function showStatus(flags) {
1048
1065
  }
1049
1066
  }
1050
1067
  async function showConsensus(flags) {
1068
+ const hasSqlite = await loadSqlite();
1069
+ if (!hasSqlite) {
1070
+ console.error(chalk.red('Error: SQLite is required for this command'));
1071
+ return;
1072
+ }
1051
1073
  try {
1052
1074
  const dbPath = path.join(cwd(), '.hive-mind', 'hive.db');
1053
1075
  const db = new Database(dbPath);
@@ -1111,6 +1133,11 @@ async function showConsensus(flags) {
1111
1133
  }
1112
1134
  }
1113
1135
  async function showMetrics(flags) {
1136
+ const hasSqlite = await loadSqlite();
1137
+ if (!hasSqlite) {
1138
+ console.error(chalk.red('Error: SQLite is required for this command'));
1139
+ return;
1140
+ }
1114
1141
  try {
1115
1142
  const dbPath = path.join(cwd(), '.hive-mind', 'hive.db');
1116
1143
  const db = new Database(dbPath);
@@ -1442,6 +1469,11 @@ export async function hiveMindCommand(args, flags) {
1442
1469
  }
1443
1470
  }
1444
1471
  async function listMemories() {
1472
+ const hasSqlite = await loadSqlite();
1473
+ if (!hasSqlite) {
1474
+ console.error(chalk.red('Error: SQLite is required for this command'));
1475
+ return;
1476
+ }
1445
1477
  try {
1446
1478
  console.log(chalk.blue('\n📋 Collective Memory Store\n'));
1447
1479
  const dbPath = path.join(cwd(), '.hive-mind', 'hive.db');
@@ -1487,6 +1519,11 @@ async function listMemories() {
1487
1519
  }
1488
1520
  }
1489
1521
  async function searchMemories() {
1522
+ const hasSqlite = await loadSqlite();
1523
+ if (!hasSqlite) {
1524
+ console.error(chalk.red('Error: SQLite is required for this command'));
1525
+ return;
1526
+ }
1490
1527
  try {
1491
1528
  const { searchTerm } = await inquirer.prompt([
1492
1529
  {