UNPKG

safevibe

Version:

Safevibe CLI - Simple personal secret vault for AI developers and amateur vibe coders

76 lines (75 loc) 3.19 kB
#!/usr/bin/env node import { Command } from "commander"; import chalk from "chalk"; import { initCommand } from "./commands/init.js"; import { startCommand } from "./commands/start.js"; /** * Safevibe CLI - Zero-knowledge secret management for AI developers * Simplified without project management - everything is user-scoped */ const program = new Command(); // ASCII art banner const banner = chalk.cyan(` ┌─────────────────────────────────────────┐ │ ✨ SafeVibe - Zero-Knowledge Secrets │ │ 🔐 For AI Developers & Agents │ │ 🌿 Secure • Simple • Organic │ └─────────────────────────────────────────┘ `); // Program configuration program .name("safevibe") .description("Zero-knowledge secret management for AI developers") .version("0.3.0"); // Essential commands only program .command("init") .description("Initialize Safevibe with authentication and encryption keys") .option("-f, --force", "Overwrite existing configuration") .option("--backend-url <url>", "Custom backend URL", "https://safevibe-backend.vercel.app") .action(initCommand); program .command("start") .description("Start the MCP server for Cursor integration") .option("-d, --daemon", "Run in daemon mode") .option("-p, --port <port>", "Port number", parseInt) .action(startCommand); // Show help and usage information program.on("--help", () => { console.log(banner); console.log(chalk.cyan("🚀 Quick Start:")); console.log(chalk.white(" 1. safevibe init # Set up authentication and keys")); console.log(chalk.white(" 2. safevibe start # Start MCP server for Cursor")); console.log(chalk.white(" 3. Use Cursor MCP tools to manage your secrets")); console.log(""); console.log(chalk.yellow("💡 All secret management (save, get, list, rotate) is done through")); console.log(chalk.yellow(" Cursor's MCP integration. The CLI only handles setup and server.")); console.log(""); console.log(chalk.cyan("🔗 Available MCP Tools:")); console.log(chalk.gray(" • save_key - Store encrypted secrets")); console.log(chalk.gray(" • get_key - Retrieve encrypted secrets")); console.log(chalk.gray(" • list_keys - List all your secrets")); console.log(chalk.gray(" • rotate_key - Rotate secret versions")); console.log(""); console.log(chalk.gray("📚 Documentation: https://safevibe.dev/docs")); console.log(chalk.gray("🐛 Issues: https://github.com/safevibe/safevibe/issues")); }); // Enhanced error handling program.exitOverride(); try { await program.parseAsync(); } catch (error) { if (error.code === 'commander.help') { // Help was displayed, exit normally process.exit(0); } else if (error.code === 'commander.version') { // Version was displayed, exit normally process.exit(0); } else { console.error(chalk.red(`\n❌ ${error.message}`)); process.exit(1); } }