Skip to main content
Glama
db-setup.tsβ€’2.41 kB
#!/usr/bin/env tsx /** * ChurnFlow Database Setup Command * Sets up the SQLite database with proper schema and initial data */ import { DatabaseManager } from '../storage/DatabaseManager.js'; import path from 'path'; interface SetupOptions { reset?: boolean; dbPath?: string; verbose?: boolean; } async function setupDatabase(options: SetupOptions = {}) { const dbPath = options.dbPath || path.join(process.cwd(), 'churnflow.db'); console.log('πŸš€ ChurnFlow Database Setup\n'); if (options.verbose) { console.log(`πŸ“ Database path: ${dbPath}`); console.log(`πŸ”„ Reset mode: ${options.reset ? 'Yes' : 'No'}`); console.log(''); } const dbManager = new DatabaseManager({ dbPath, enableWAL: true, enableForeignKeys: true }); try { if (options.reset) { await dbManager.resetDatabase(); } else { await dbManager.setupDatabase(); } console.log('\nπŸŽ‰ Database setup completed successfully!'); console.log('\nπŸ“‹ Next steps:'); console.log(' β€’ Run captures: npm run cli capture "your text"'); console.log(' β€’ View database: npm run db:studio'); console.log(' β€’ Run tests: npm test'); } catch (error) { console.error('\n❌ Database setup failed:', error); process.exit(1); } } // Parse command line arguments const args = process.argv.slice(2); const options: SetupOptions = {}; for (let i = 0; i < args.length; i++) { const arg = args[i]; switch (arg) { case '--reset': options.reset = true; break; case '--db-path': options.dbPath = args[++i]; break; case '--verbose': case '-v': options.verbose = true; break; case '--help': case '-h': console.log(` ChurnFlow Database Setup Usage: npm run db:setup [options] Options: --reset Reset the database (delete all data) --db-path <path> Specify database file path --verbose, -v Show detailed output --help, -h Show this help message Examples: npm run db:setup # Initial setup npm run db:setup -- --reset # Reset database npm run db:setup -- --verbose # Setup with detailed output `); process.exit(0); default: console.error(`Unknown option: ${arg}`); console.log('Use --help for usage information'); process.exit(1); } } // Run setup setupDatabase(options);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jgsteeler/churnflow-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server