mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-25 22:53:17 +09:00
Checkpoint: File edits
Automatic checkpoint created by Claude Code - Branch: v3 - Timestamp: 2026-01-12T17:37:22Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
947174456e
commit
9d8011bb40
1 file changed
+27
-7
@@ -529,29 +529,36 @@ const initCommand: Command = {
|
||||
options: [
|
||||
{ name: 'model', short: 'm', type: 'string', description: 'ONNX model ID', default: 'all-MiniLM-L6-v2' },
|
||||
{ name: 'hyperbolic', type: 'boolean', description: 'Enable hyperbolic (Poincaré ball) embeddings', default: 'true' },
|
||||
{ name: 'curvature', short: 'c', type: 'number', description: 'Poincaré ball curvature (negative)', default: '-1' },
|
||||
{ name: 'curvature', short: 'c', type: 'string', description: 'Poincaré ball curvature (use --curvature=-1 for negative)', default: '-1' },
|
||||
{ name: 'download', short: 'd', type: 'boolean', description: 'Download model during init', default: 'true' },
|
||||
{ name: 'cache-size', type: 'number', description: 'LRU cache entries', default: '256' },
|
||||
{ name: 'cache-size', type: 'string', description: 'LRU cache entries', default: '256' },
|
||||
{ name: 'force', short: 'f', type: 'boolean', description: 'Overwrite existing configuration', default: 'false' },
|
||||
],
|
||||
examples: [
|
||||
{ command: 'claude-flow embeddings init', description: 'Initialize with defaults' },
|
||||
{ command: 'claude-flow embeddings init --model all-mpnet-base-v2', description: 'Use higher quality model' },
|
||||
{ command: 'claude-flow embeddings init --no-hyperbolic', description: 'Euclidean only' },
|
||||
{ command: 'claude-flow embeddings init --curvature=-0.5', description: 'Custom curvature (use = for negative)' },
|
||||
{ command: 'claude-flow embeddings init --force', description: 'Overwrite existing config' },
|
||||
],
|
||||
action: async (ctx: CommandContext): Promise<CommandResult> => {
|
||||
const model = ctx.flags.model as string || 'all-MiniLM-L6-v2';
|
||||
const hyperbolic = ctx.flags.hyperbolic !== false;
|
||||
const curvature = parseFloat(ctx.flags.curvature as string || '-1');
|
||||
const download = ctx.flags.download !== false;
|
||||
const cacheSize = parseInt(ctx.flags['cache-size'] as string || '256', 10);
|
||||
const force = ctx.flags.force === true;
|
||||
|
||||
// Parse curvature - handle both kebab-case and direct value
|
||||
const curvatureRaw = ctx.flags.curvature as string || '-1';
|
||||
const curvature = parseFloat(curvatureRaw);
|
||||
|
||||
// Parse cache-size - check both kebab-case and camelCase
|
||||
const cacheSizeRaw = (ctx.flags['cache-size'] || ctx.flags.cacheSize || '256') as string;
|
||||
const cacheSize = parseInt(cacheSizeRaw, 10);
|
||||
|
||||
output.writeln();
|
||||
output.writeln(output.bold('Initialize Embedding Subsystem'));
|
||||
output.writeln(output.dim('─'.repeat(55)));
|
||||
|
||||
const spinner = output.createSpinner({ text: 'Initializing...', spinner: 'dots' });
|
||||
spinner.start();
|
||||
|
||||
try {
|
||||
const fs = await import('fs');
|
||||
const path = await import('path');
|
||||
@@ -559,6 +566,19 @@ const initCommand: Command = {
|
||||
// Create directories
|
||||
const configDir = path.join(process.cwd(), '.claude-flow');
|
||||
const modelDir = path.join(configDir, 'models');
|
||||
const configPath = path.join(configDir, 'embeddings.json');
|
||||
|
||||
// Check for existing config
|
||||
if (fs.existsSync(configPath) && !force) {
|
||||
output.printWarning('Embeddings already initialized');
|
||||
output.printInfo(`Config exists: ${configPath}`);
|
||||
output.writeln();
|
||||
output.writeln(output.dim('Use --force to overwrite existing configuration'));
|
||||
return { success: false, exitCode: 1 };
|
||||
}
|
||||
|
||||
const spinner = output.createSpinner({ text: 'Initializing...', spinner: 'dots' });
|
||||
spinner.start();
|
||||
|
||||
if (!fs.existsSync(configDir)) {
|
||||
fs.mkdirSync(configDir, { recursive: true });
|
||||
|
||||
Reference in new issue
Block a user