From 21ab10ef9e2fff9b4726695036e95e33937e1fa9 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 12 Jun 2026 15:26:22 -0500 Subject: fix(todo-cleanup): keep --archive-done silent on a real-mode no-op The wrap runs --archive-done twice (wrap-it-up, then open-tasks.org Phase A). The first pass archives and reports. The second finds nothing and used to print "0 subtree(s) moved", which reads as alarming next to the first pass's diff. Now a real-mode run that moves nothing and skips nothing says nothing. Check mode still previews "0 would move", and a missing-section skip still reports, since those are conditions the caller needs. --- .ai/scripts/todo-cleanup.el | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to '.ai/scripts/todo-cleanup.el') diff --git a/.ai/scripts/todo-cleanup.el b/.ai/scripts/todo-cleanup.el index 569e7c7..6b3081a 100644 --- a/.ai/scripts/todo-cleanup.el +++ b/.ai/scripts/todo-cleanup.el @@ -397,20 +397,30 @@ before their descendants — a [#A] → [#B] → [#D] chain collapses in one pas (save-buffer)))) (defun tc--emit-archive-report () - (princ (format "todo-cleanup --archive-done: %d subtree(s) %s%s\n" - tc-archived - (if tc-check-only "would move" "moved") - (if tc-check-only " — CHECK MODE (no writes)" ""))) - (dolist (i (reverse tc-issues)) - (pcase (plist-get i :kind) - ('archive-skip - (princ (format " skipped %s: %s\n" (plist-get i :file) (plist-get i :detail)))) - ((or 'archive-moved 'archive-would) - (princ (format " %s:%d: %s %s\n" - (plist-get i :file) - (plist-get i :line) - (if tc-check-only "would move" "moved") - (plist-get i :heading))))))) + ;; A real-mode no-op stays silent. When nothing moved and nothing was + ;; skipped, there's nothing to report — and the wrap runs this twice + ;; (wrap-it-up, then open-tasks.org Phase A), so a vocal "0 subtree(s) moved" + ;; on the second pass reads as alarming next to the first pass's diff. Check + ;; mode always reports (a "0 would move" preview is information the caller + ;; asked for), and a skip always reports (a missing section is a real + ;; condition, not a no-op). + (let ((has-skip (cl-some (lambda (i) (eq (plist-get i :kind) 'archive-skip)) + tc-issues))) + (when (or tc-check-only (> tc-archived 0) has-skip) + (princ (format "todo-cleanup --archive-done: %d subtree(s) %s%s\n" + tc-archived + (if tc-check-only "would move" "moved") + (if tc-check-only " — CHECK MODE (no writes)" ""))) + (dolist (i (reverse tc-issues)) + (pcase (plist-get i :kind) + ('archive-skip + (princ (format " skipped %s: %s\n" (plist-get i :file) (plist-get i :detail)))) + ((or 'archive-moved 'archive-would) + (princ (format " %s:%d: %s %s\n" + (plist-get i :file) + (plist-get i :line) + (if tc-check-only "would move" "moved") + (plist-get i :heading))))))))) (defun tc--emit-hygiene-report () (princ (format "todo-cleanup: %d fix(es) applied%s\n" -- cgit v1.2.3