UNPKG

polish-cli

Version:

AI-powered file organization for Obsidian with automatic markdown conversion

79 lines 2.44 kB
import * as fs from 'fs/promises'; import * as path from 'path'; import * as os from 'os'; export class ConfigService { configPath; constructor() { this.configPath = path.join(os.homedir(), '.polish', 'config.json'); } async exists() { try { await fs.access(this.configPath); return true; } catch { return false; } } async load() { try { const data = await fs.readFile(this.configPath, 'utf-8'); return JSON.parse(data); } catch (error) { throw new Error('Configuration not found'); } } async save(config) { const dir = path.dirname(this.configPath); await fs.mkdir(dir, { recursive: true }); await fs.writeFile(this.configPath, JSON.stringify(config, null, 2)); } getDefaultConfig() { return { vault: { path: path.join(os.homedir(), 'ObsidianVault'), structure: { documents: 'Documents', media: 'Media', code: 'Code', references: 'References', }, }, originals: { path: path.join(os.homedir(), 'OrganizedFiles'), organizationStyle: 'type-based', createYearFolders: true, }, sources: [ { path: path.join(os.homedir(), 'Desktop'), includeSubfolders: false, }, { path: path.join(os.homedir(), 'Downloads'), includeSubfolders: false, }, ], processing: { extractText: true, maxFileSize: '50MB', supportedFormats: ['pdf', 'docx', 'txt', 'md', 'png', 'jpg', 'py', 'js'], }, tagging: { maxTags: 10, autoGenerateTypeTags: true, autoGenerateDateTags: true, customTagPatterns: {}, }, api: { mode: 'claude-code', apiKey: 'env:ANTHROPIC_API_KEY', model: 'claude-3-opus-20240229', maxTokens: 4096, temperature: 0.3, }, }; } } //# sourceMappingURL=ConfigService.js.map