feat(KB-156): implement archive cleanup with restoration support

- Add ArchiveEntry type and archive.jsonl storage format for compact task archives
- Implement archiveTask() with optional cleanup and archiveTaskAndCleanup() convenience method
- Add restoreFromArchive() to reconstruct tasks from archive entries when directory is missing
- Implement cleanupArchivedTasks() for bulk cleanup of all archived task directories
- Add comprehensive tests for archive, cleanup, and restore operations (385+ lines)
- Add readArchiveLog(), findInArchive(), and unarchiveTask() API methods
- Document archive storage pattern and restoration behavior in AGENTS.md
- Include changeset for patch release noting archive cleanup feature
This commit is contained in:
gsxdsm
2026-03-30 11:01:48 -07:00
parent e02356b836
commit 904a95f7c0
6 changed files with 768 additions and 6 deletions

View File

@@ -0,0 +1,13 @@
---
"@dustinbyrne/kb": patch
---
Add filesystem cleanup for archived tasks. Archived tasks can now be condensed into a compact archive.jsonl entry and removed from the filesystem to save space. Tasks can be restored from the archive log when unarchived.
New TaskStore methods:
- `archiveTask(id, cleanup)` - Optional cleanup parameter to archive and clean up immediately
- `archiveTaskAndCleanup(id)` - Convenience method for immediate cleanup
- `cleanupArchivedTasks()` - Bulk cleanup of all archived tasks with existing directories
- `readArchiveLog()` - Parse archive.jsonl entries
- `findInArchive(id)` - Find a specific task in the archive log
- `unarchiveTask(id)` - Now restores from archive if directory is missing