UNPKG

@masuidrive/bloom-local-rag

Version:

RAG (Retrieval-Augmented Generation) system for local directories - Index and search your documents with AI-powered answers

34 lines 1.23 kB
#!/usr/bin/env node // Wrapper to suppress stderr when not in verbose mode // This handles both direct execution and npx usage import { spawn } from 'child_process'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); // Check if verbose mode is requested const args = process.argv.slice(2); const isVerbose = args.includes('--verbose') || args.includes('-v') || !!process.env.BLOOM_VERBOSE; if (isVerbose) { // In verbose mode, just import and run the CLI directly import('./cli.js'); } else { // Not verbose - suppress stderr const cliPath = join(__dirname, 'cli.js'); // Spawn the CLI with stderr suppressed const child = spawn(process.execPath, [cliPath, ...args], { stdio: ['inherit', 'inherit', 'ignore'], // stdin, stdout, stderr (ignored) env: process.env }); // Forward the exit code child.on('exit', (code) => { process.exit(code || 0); }); // Handle spawn errors child.on('error', (err) => { console.error('Failed to start bloom-local-rag:', err); process.exit(1); }); } //# sourceMappingURL=cli-wrapper.js.map