()
| 359 | * Delete all usage log files, resetting stats to zero. |
| 360 | */ |
| 361 | export async function clearStats(): Promise<{ deletedFiles: number }> { |
| 362 | try { |
| 363 | const files = await readdir(LOG_DIR); |
| 364 | const logFiles = files.filter((f) => f.startsWith("usage-") && f.endsWith(".jsonl")); |
| 365 | |
| 366 | await Promise.all(logFiles.map((f) => unlink(join(LOG_DIR, f)))); |
| 367 | |
| 368 | return { deletedFiles: logFiles.length }; |
| 369 | } catch { |
| 370 | return { deletedFiles: 0 }; |
| 371 | } |
| 372 | } |
no outgoing calls
no test coverage detected