/** * 24K CLI Configuration * Stores agent credentials locally */ import Conf from "conf"; interface Config { apiKey?: string; agentId?: string; agentName?: string; coordinates?: { x: number; y: number }; apiUrl: string; } const config = new Conf({ projectName: "24k", defaults: { apiUrl: "https://avid-chinchilla-743.convex.site", }, }); export function getConfig(): Config { return { apiKey: config.get("apiKey"), agentId: config.get("agentId"), agentName: config.get("agentName"), coordinates: config.get("coordinates"), apiUrl: config.get("apiUrl"), }; } export function setConfig(updates: Partial): void { Object.entries(updates).forEach(([key, value]) => { if (value !== undefined) { config.set(key as keyof Config, value); } }); } export function clearConfig(): void { config.clear(); config.set("apiUrl", "https://avid-chinchilla-743.convex.site"); } export function isAuthenticated(): boolean { return !!config.get("apiKey"); }