()
| 38 | } |
| 39 | |
| 40 | private saveHistory(): void { |
| 41 | try { |
| 42 | const dir = path.dirname(HISTORY_FILE); |
| 43 | if (!fs.existsSync(dir)) { |
| 44 | fs.mkdirSync(dir, { recursive: true }); |
| 45 | } |
| 46 | |
| 47 | fs.writeFileSync(HISTORY_FILE, JSON.stringify(this.history, null, 2)); |
| 48 | } catch (error) { |
| 49 | console.error("Failed to save input history:", error); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | addEntry(text: string): void { |
| 54 | if (!text.trim()) return; |
no test coverage detected