feat: add session cleanup script with flexible filtering options

Add cleanup-sessions.ts script that enables deletion of sessions from the database with support for multiple filtering strategies:
- Message count filtering (delete sessions with fewer than N messages)
- Path pattern matching with glob support
- Orphaned session detection (sessions whose path no longer exists)
- Optional confirmation prompt with --force flag to skip

Includes 'clean-session' npm script for convenient invocation.
This commit is contained in:
weishu
2025-12-23 17:45:15 +08:00
parent 7f9145b6de
commit eafd4d12a9
2 changed files with 312 additions and 1 deletions
+2 -1
View File
@@ -18,7 +18,8 @@
"typecheck:cli": "cd cli && bun run typecheck",
"typecheck:server": "cd server && bun run typecheck",
"typecheck:web": "cd web && bun run typecheck",
"test": "cd cli && bun run test"
"test": "cd cli && bun run test",
"clean-session": "bun run server/scripts/cleanup-sessions.ts"
},
"devDependencies": {
"concurrently": "^9.2.1",