codeburn/src/config.ts
AgentSeal 40d04261d6 cleanup: strip TUI picker, promote currency command, remove verbose comments
- Remove CurrencyPicker component and all related state from dashboard
- Promote 'codeburn config currency' to top-level 'codeburn currency'
- Strip JSDoc comments that explain WHAT not WHY
- Remove forceRender hack and unused imports
2026-04-14 08:47:45 -07:00

36 lines
863 B
TypeScript

import { readFile, writeFile, mkdir } from 'fs/promises'
import { join } from 'path'
import { homedir } from 'os'
export type CodeburnConfig = {
currency?: {
code: string
symbol?: string
}
}
function getConfigDir(): string {
return join(homedir(), '.config', 'codeburn')
}
function getConfigPath(): string {
return join(getConfigDir(), 'config.json')
}
export async function readConfig(): Promise<CodeburnConfig> {
try {
const raw = await readFile(getConfigPath(), 'utf-8')
return JSON.parse(raw) as CodeburnConfig
} catch {
return {}
}
}
export async function saveConfig(config: CodeburnConfig): Promise<void> {
await mkdir(getConfigDir(), { recursive: true })
await writeFile(getConfigPath(), JSON.stringify(config, null, 2) + '\n', 'utf-8')
}
export function getConfigFilePath(): string {
return getConfigPath()
}