(entry: string)
| 20 | } |
| 21 | |
| 22 | export function appendPromptHistory(entry: string): void { |
| 23 | try { |
| 24 | const history = loadPromptHistory() |
| 25 | // Like shells: skip consecutive duplicates. |
| 26 | if (history[history.length - 1] === entry) return |
| 27 | history.push(entry) |
| 28 | fs.mkdirSync(getConfigDir(), { recursive: true }) |
| 29 | fs.writeFileSync(historyPath(), JSON.stringify(history.slice(-MAX_HISTORY), null, "\t") + "\n", { |
| 30 | mode: 0o600, |
| 31 | }) |
| 32 | } catch { |
| 33 | // history is best-effort |
| 34 | } |
| 35 | } |
no test coverage detected