UNPKG

runlog

Version:

CLI tool for uploading Claude Code conversations to runlog.io

27 lines 954 B
import * as path from 'path'; import * as fs from 'fs'; import { randomUUID } from 'crypto'; const CLIENT_ID_FILE = 'client_id.txt'; export function getConfig() { const claudeDir = process.env.CLAUDE_DIR || path.join(process.env.HOME || '', '.claude', 'projects'); const clientId = getClientId(claudeDir); return { apiEndpoint: process.env.RUNLOG_API_ENDPOINT || 'https://api.runlog.io', claudeDir: claudeDir, clientId: clientId }; } function getClientId(claudeDir) { const clientIdPath = path.join(claudeDir, CLIENT_ID_FILE); if (fs.existsSync(clientIdPath)) { return fs.readFileSync(clientIdPath, 'utf8').trim(); } else { const newClientId = randomUUID(); // Ensure the directory exists fs.mkdirSync(claudeDir, { recursive: true }); fs.writeFileSync(clientIdPath, newClientId, 'utf8'); return newClientId; } } //# sourceMappingURL=config.js.map