refactor: move config loading to shared directory

This commit is contained in:
syntaxbullet
2026-01-08 16:15:55 +01:00
parent 88b266f81b
commit 2b641c952d
23 changed files with 15 additions and 219 deletions

View File

@@ -0,0 +1,19 @@
import { readFileSync, writeFileSync } from 'fs';
import { join } from 'path';
const configPath = join(process.cwd(), 'config', 'config.json');
export const configManager = {
toggleCommand: (commandName: string, enabled: boolean) => {
const raw = readFileSync(configPath, 'utf-8');
const data = JSON.parse(raw);
if (!data.commands) {
data.commands = {};
}
data.commands[commandName] = enabled;
writeFileSync(configPath, JSON.stringify(data, null, 4));
}
};