()
| 361 | * Clear the current session |
| 362 | */ |
| 363 | export function clearSession(): void { |
| 364 | try { |
| 365 | const manager = SessionManager.getInstance(); |
| 366 | if (manager.hasSession()) { |
| 367 | const sessionFilePath = path.join( |
| 368 | getSessionDir(), |
| 369 | `${manager.getSessionId()}.json`, |
| 370 | ); |
| 371 | if (fs.existsSync(sessionFilePath)) { |
| 372 | fs.unlinkSync(sessionFilePath); |
| 373 | } |
| 374 | manager.clear(); |
| 375 | } |
| 376 | } catch (error) { |
| 377 | logger.error("Error clearing session:", error); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | /** |
| 382 | * Check if a session exists for the current terminal |
no test coverage detected