UNPKG

@dailyautomations/terminal-logger

Version:

Terminal command logger with Supabase sync for swarm prompts

58 lines (57 loc) 2.6 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.config = void 0; exports.validateConfig = validateConfig; const dotenv = __importStar(require("dotenv")); const path = __importStar(require("path")); const os = __importStar(require("os")); dotenv.config(); exports.config = { supabaseUrl: process.env.SUPABASE_URL, supabaseAnonKey: process.env.SUPABASE_ANON_KEY, logFilePath: process.env.LOG_FILE_PATH || path.join(__dirname, '../logs/commands.json'), syncIntervalMinutes: parseInt(process.env.SYNC_INTERVAL_MINUTES || '5', 10), enableRealTimeSync: process.env.ENABLE_REAL_TIME_SYNC === 'true', shellHistoryFile: process.env.SHELL_HISTORY_FILE || path.join(os.homedir(), '.bash_history'), watchIntervalMs: parseInt(process.env.WATCH_INTERVAL_MS || '1000', 10), logLevel: process.env.LOG_LEVEL || 'info' }; function validateConfig() { if (exports.config.enableRealTimeSync && (!exports.config.supabaseUrl || !exports.config.supabaseAnonKey || exports.config.supabaseUrl === 'your-supabase-url' || exports.config.supabaseAnonKey === 'your-supabase-anon-key')) { throw new Error('Valid Supabase credentials required when real-time sync is enabled'); } }