claude-flow 2.7.0-alpha.5 → 2.7.0-alpha.6
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 +1 -1
- package/dist/src/cli/simple-commands/config.js +124 -0
- package/dist/src/cli/simple-commands/config.js.map +1 -1
- package/dist/src/cli/validation-helper.js.map +1 -1
- package/dist/src/core/version.js +2 -2
- package/dist/src/core/version.js.map +1 -1
- package/dist/src/memory/swarm-memory.js +348 -416
- package/dist/src/memory/swarm-memory.js.map +1 -1
- package/dist/src/reasoningbank/reasoningbank-adapter.js +174 -264
- package/dist/src/reasoningbank/reasoningbank-adapter.js.map +1 -1
- package/dist/src/utils/metrics-reader.js +41 -29
- package/dist/src/utils/metrics-reader.js.map +1 -1
- package/docs/REASONINGBANK-STATUS.md +127 -98
- package/package.json +1 -1
- package/src/reasoningbank/reasoningbank-adapter.js +231 -351
package/bin/claude-flow
CHANGED
|
@@ -120,4 +120,128 @@ 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
|
+
|
|
123
247
|
//# 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,OAA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AOpB;AACT"}
|
|
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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M;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;Q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K,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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/validation-helper.
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/validation-helper.js"],"sourcesContent":["/**\n * CLI Parameter Validation Helper\n * Provides standardized error messages for invalid parameters\n */\n\nimport { HelpFormatter } from './help-formatter.js';\n\nexport class ValidationHelper {\n /**\n * Validate enum parameter\n */\n static validateEnum(value, paramName, validOptions, commandPath) {\n if (!validOptions.includes(value)) {\n console.error(\n HelpFormatter.formatValidationError(value, paramName, validOptions, commandPath),\n );\n process.exit(1);\n }\n }\n\n /**\n * Validate numeric parameter\n */\n static validateNumber(value, paramName, min, max, commandPath) {\n const num = parseInt(value, 10);\n\n if (isNaN(num)) {\n console.error(\n HelpFormatter.formatError(\n `'${value}' is not a valid number for ${paramName}.`,\n commandPath || 'claude-flow',\n ),\n );\n process.exit(1);\n }\n\n if (min !== undefined && num < min) {\n console.error(\n HelpFormatter.formatError(\n `${paramName} must be at least ${min}. Got: ${num}`,\n commandPath || 'claude-flow',\n ),\n );\n process.exit(1);\n }\n\n if (max !== undefined && num > max) {\n console.error(\n HelpFormatter.formatError(\n `${paramName} must be at most ${max}. Got: ${num}`,\n commandPath || 'claude-flow',\n ),\n );\n process.exit(1);\n }\n\n return num;\n }\n\n /**\n * Validate required parameter\n */\n static validateRequired(value, paramName, commandPath) {\n if (!value || (typeof value === 'string' && value.trim() === '')) {\n console.error(\n HelpFormatter.formatError(\n `Missing required parameter: ${paramName}`,\n commandPath || 'claude-flow',\n ),\n );\n process.exit(1);\n }\n }\n\n /**\n * Validate file path exists\n */\n static async validateFilePath(path, paramName, commandPath) {\n try {\n const fs = await import('fs/promises');\n await fs.access(path);\n } catch (error) {\n console.error(\n HelpFormatter.formatError(\n `File not found for ${paramName}: ${path}`,\n commandPath || 'claude-flow',\n ),\n );\n process.exit(1);\n }\n }\n\n /**\n * Validate boolean flag\n */\n static validateBoolean(value, paramName, commandPath) {\n const lowerValue = value.toLowerCase();\n if (lowerValue === 'true' || lowerValue === '1' || lowerValue === 'yes') {\n return true;\n }\n if (lowerValue === 'false' || lowerValue === '0' || lowerValue === 'no') {\n return false;\n }\n\n console.error(\n HelpFormatter.formatError(\n `'${value}' is not a valid boolean for ${paramName}. Use: true, false, yes, no, 1, or 0.`,\n commandPath || 'claude-flow',\n ),\n );\n process.exit(1);\n }\n}\n"],"names":["HelpFormatter","ValidationHelper","validateEnum","value","paramName","validOptions","commandPath","includes","console","error","formatValidationError","process","exit","validateNumber","min","max","num","parseInt","isNaN","formatError","undefined","validateRequired","trim","validateFilePath","path","fs","access","validateBoolean","lowerValue","toLowerCase"],"mappings":"AAKA,SAASA,aAAa,QAAQ,sBAAsB;AAEpD,OAAO,MAAMC;IAIX,OAAOC,aAAaC,KAAK,EAAEC,SAAS,EAAEC,YAAY,EAAEC,WAAW,EAAE;QAC/D,IAAI,CAACD,aAAaE,QAAQ,CAACJ,QAAQ;YACjCK,QAAQC,KAAK,CACXT,cAAcU,qBAAqB,CAACP,OAAOC,WAAWC,cAAcC;YAEtEK,QAAQC,IAAI,CAAC;QACf;IACF;I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YAGnBK,QAAQC,IAAI,CAAC;QACf;IACF;IAKA,OAAOe,gBAAgBxB,KAAK,EAAEC,SAAS,EAAEE,WAAW,EAAE;QACpD,MAAMsB,aAAazB,MAAM0B,WAAW;QACpC,IAAID,eAAe,UAAUA,eAAe,OAAOA,eAAe,OAAO;YACvE,OAAO;QACT;QACA,IAAIA,eAAe,WAAWA,eAAe,OAAOA,eAAe,MAAM;YACvE,OAAO;QACT;QAEApB,QAAQC,KAAK,CACXT,cAAcmB,WAAW,CACvB,CAAC,CAAC,EAAEhB,MAAM,6BAA6B,EAAEC,UAAU,qCAAqC,CAAC,EACzFE,eAAe;QAGnBK,QAAQC,IAAI,CAAC;IACf;AACF"}MsB,aAAazB,MAAM0B,WAAW;QACpC,IAAID,eAAe,UAAUA,eAAe,OAAOA,eAAe,OAAO;YACvE,OAAO;QACT;QACA,IAAIA,eAAe,WAAWA,eAAe,OAAOA,eAAe,MAAM;YACvE,OAAO;QACT;QAEApB,QAAQC,KAAK,CACXT,cAAcmB,WAAW,CACvB,CAAC,CAAC,EAAEhB,MAAM,6BAA6B,EAAEC,UAAU,qCAAqC,CAAC,EACzFE,eAAe;QAGnBK,QAAQC,IAAI,CAAC;IACf;AACF"}
|
package/dist/src/core/version.js
CHANGED
|
@@ -12,7 +12,7 @@ try {
|
|
|
12
12
|
BUILD_DATE = new Date().toISOString().split('T')[0];
|
|
13
13
|
} catch (error) {
|
|
14
14
|
console.warn('Warning: Could not read version from package.json, using fallback');
|
|
15
|
-
VERSION = '2.0.0-alpha.
|
|
15
|
+
VERSION = '2.0.0-alpha.91';
|
|
16
16
|
BUILD_DATE = new Date().toISOString().split('T')[0];
|
|
17
17
|
}
|
|
18
18
|
export { VERSION, BUILD_DATE };
|
|
@@ -23,4 +23,4 @@ export function displayVersion() {
|
|
|
23
23
|
console.log(getVersionString());
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=version.js.
|
|
26
|
+
//# sourceMappingURL=version.js.mapp
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/version.
|
|
1
|
+
{"version":3,"sources":["../../../src/core/version.ts"],"sourcesContent":["/**\n * Centralized version management\n * Reads version from package.json to ensure consistency\n */\n\nimport { readFileSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\n\n// Get the directory of this module\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Read version from package.json\nlet VERSION: string;\nlet BUILD_DATE: string;\n\ntry {\n // Navigate to project root and read package.json\n const packageJsonPath = join(__dirname, '../../package.json');\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n VERSION = packageJson.version;\n BUILD_DATE = new Date().toISOString().split('T')[0];\n} catch (error) {\n // Fallback version if package.json can't be read\n console.warn('Warning: Could not read version from package.json, using fallback');\n VERSION = '2.0.0-alpha.91';\n BUILD_DATE = new Date().toISOString().split('T')[0];\n}\n\nexport { VERSION, BUILD_DATE };\n\n// Helper function to get formatted version string\nexport function getVersionString(includeV = true): string {\n return includeV ? `v${VERSION}` : VERSION;\n}\n\n// Helper function for version display in CLI\nexport function displayVersion(): void {\n console.log(getVersionString());\n}"],"names":["readFileSync","join","dirname","fileURLToPath","__filename","url","__dirname","VERSION","BUILD_DATE","packageJsonPath","packageJson","JSON","parse","version","Date","toISOString","split","error","console","warn","getVersionString","includeV","displayVersion","log"],"mappings":"AAKA,SAASA,YAAY,QAAQ,KAAK;AAClC,SAASC,IAAI,EAAEC,OAAO,QAAQ,OAAO;AACrC,SAASC,aAAa,QAAQ,MAAM;AAGpC,MAAMC,aAAaD,cAAc,YAAYE,GAAG;AAChD,MAAMC,YAAYJ,QAAQE;AAG1B,IAAIG;AACJ,IAAIC;AAEJ,IAAI;IAEF,MAAMC,kBAAkBR,KAAKK,WAAW;IACxC,MAAMI,cAAcC,KAAKC,KAAK,CAACZ,aAAaS,iBAAiB;IAC7DF,UAAUG,YAAYG,OAAO;IAC7BL,aAAa,IAAIM,OAAOC,WAAW,GAAGC,KAAK,CAAC,IAAI,CAAC,EAAE;AACrD,EAAE,OAAOC,OAAO;IAEdC,QAAQC,IAAI,CAAC;IACbZ,UAAU;IACVC,aAAa,IAAIM,OAAOC,WAAW,GAAGC,KAAK,CAAC,IAAI,CAAC,EAAE;AACrD;AAEA,SAAST,OAAO,EAAEC,UAAU,GAAG;AAG/B,OAAO,SAASY,iBAAiBC,WAAW,IAAI;IAC9C,OAAOA,WAAW,CAAC,CAAC,EAAEd,SAAS,GAAGA;AACpC;AAGA,OAAO,SAASe;IACdJ,QAAQK,GAAG,CAACH;AACd"}
|