aboutsummaryrefslogtreecommitdiff
path: root/.ai/scripts/todo-cleanup.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-12 15:26:22 -0500
committerCraig Jennings <c@cjennings.net>2026-06-12 15:26:22 -0500
commit21ab10ef9e2fff9b4726695036e95e33937e1fa9 (patch)
tree1d994b7a4228e70c7ad7b0980eede70eec875de2 /.ai/scripts/todo-cleanup.el
parentf2f5f571b5269a012f8c84de60d69b62658b1e9e (diff)
downloadrulesets-21ab10ef9e2fff9b4726695036e95e33937e1fa9.tar.gz
rulesets-21ab10ef9e2fff9b4726695036e95e33937e1fa9.zip
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.
Diffstat (limited to '.ai/scripts/todo-cleanup.el')
-rw-r--r--.ai/scripts/todo-cleanup.el38
1 files changed, 24 insertions, 14 deletions
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"