summaryrefslogtreecommitdiff
path: root/fish
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-05 10:54:18 +0300
committerPaul Buetow <paul@buetow.org>2026-06-05 10:54:18 +0300
commita9d03c6cca95138b5694ac1aba2239ca8a46fdc8 (patch)
treedad547663ff08f73f04060d3653807972a2f72e8 /fish
parent46498c17ac38dca2e0f85f4df14eeff9903bb1c5 (diff)
feat(taskwarrior): export +agent tasks to JSON history before cleanup
Diffstat (limited to 'fish')
-rw-r--r--fish/conf.d/taskwarrior.fish9
1 files changed, 8 insertions, 1 deletions
diff --git a/fish/conf.d/taskwarrior.fish b/fish/conf.d/taskwarrior.fish
index fc2e637..603f0d8 100644
--- a/fish/conf.d/taskwarrior.fish
+++ b/fish/conf.d/taskwarrior.fish
@@ -150,7 +150,14 @@ end
function taskwarrior::cleanup
# Delete only tasks completed over 30 days ago
test (task +random status:completed end.before:today-30days count) -gt 0; and yes | task +random status:completed end.before:today-30days delete &>/dev/null
- test (task +agent status:completed end.before:today-30days count) -gt 0; and yes | task +agent status:completed end.before:today-30days delete &>/dev/null
+
+ # Export +agent tasks to a JSON history file before deleting them
+ set -l agent_history_dir ~/Documents/Taskwarrior/AgentsHistory
+ if test (task +agent status:completed end.before:today-30days count) -gt 0
+ test -d $agent_history_dir; or mkdir -p $agent_history_dir
+ task +agent status:completed end.before:today-30days export >"$agent_history_dir/tw-agent-export-"(date +%Y%m%d-%H%M%S)".json"
+ yes | task +agent status:completed end.before:today-30days delete &>/dev/null
+ end
end
function taskwarrior::unscheduled