UNPKG

@stackmemoryai/stackmemory

Version:

Project-scoped memory for AI coding tools. Durable context across sessions with MCP integration, frames, smart retrieval, Claude Code skills, and automatic hooks.

66 lines (65 loc) 1.82 kB
import { fileURLToPath as __fileURLToPath } from 'url'; import { dirname as __pathDirname } from 'path'; const __filename = __fileURLToPath(import.meta.url); const __dirname = __pathDirname(__filename); import { logger } from "../core/monitoring/logger.js"; import { readFileSync, writeFileSync, existsSync } from "fs"; import { join } from "path"; class ConfigService { // Using singleton logger from monitoring config = {}; configPath; constructor() { this.configPath = join(process.cwd(), ".stackmemory", "config.json"); this.loadConfig(); } loadConfig() { try { if (existsSync(this.configPath)) { const content = readFileSync(this.configPath, "utf-8"); this.config = JSON.parse(content); logger.debug("Loaded configuration", this.config); } } catch (error) { logger.warn("Failed to load configuration, using defaults", error); } } saveConfig() { try { writeFileSync(this.configPath, JSON.stringify(this.config, null, 2)); logger.debug("Saved configuration"); } catch (error) { logger.error("Failed to save configuration", error); } } async getConfig() { return this.config; } async updateConfig(updates) { this.config = { ...this.config, ...updates }; this.saveConfig(); } async getLinearConfig() { return this.config.integrations?.linear || {}; } async updateLinearConfig(updates) { if (!this.config.integrations) { this.config.integrations = {}; } if (!this.config.integrations.linear) { this.config.integrations.linear = {}; } this.config.integrations.linear = { ...this.config.integrations.linear, ...updates }; this.saveConfig(); } } export { ConfigService }; //# sourceMappingURL=config-service.js.map