← back to Ticket System
nightly-cleanup: add pass 3 — CNCP panel retire + cache-reload restart
1fffe67d8984d3b8726d56724cbe893edf419feb · 2026-07-28 08:02:14 -0700 · Steve Abrams
Folds the CNCP tab retire (cncp-retire.py) into the 4am job as pass 3; restarts
com.user.cncp only when something was actually retired so caches reload. Skip
with CNCP_RETIRE=0; tune window with CNCP_RETIRE_DAYS.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 1fffe67d8984d3b8726d56724cbe893edf419feb
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Jul 28 08:02:14 2026 -0700
nightly-cleanup: add pass 3 — CNCP panel retire + cache-reload restart
Folds the CNCP tab retire (cncp-retire.py) into the 4am job as pass 3; restarts
com.user.cncp only when something was actually retired so caches reload. Skip
with CNCP_RETIRE=0; tune window with CNCP_RETIRE_DAYS.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
nightly-cleanup.sh | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/nightly-cleanup.sh b/nightly-cleanup.sh
index b0a3dd6..786ac09 100755
--- a/nightly-cleanup.sh
+++ b/nightly-cleanup.sh
@@ -8,9 +8,13 @@
# settled (> APPROVAL_AUTODONE_DAYS). POST /api/approvals/sweep.
# 2. Ticket auto-done — closes doing/blocked tickets whose LATEST line declares
# the whole ticket complete (idle ≥6h, no live worker, not neg/gated).
+# 3. CNCP panel retire — hard-deletes items older than CNCP_RETIRE_DAYS (default 7)
+# across the accumulating tabs (parking-lot, wins, lessons, session-recaps) and
+# drops stopped/archived loops. Snapshots every file first; restarts CNCP so
+# caches reload. project TODO.md files are NEVER touched.
#
# Installed as launchd com.steve.nightly-approvals-tickets (04:00 daily). Skip a
-# pass with CNCP_APPROVAL_AUTODONE=0 / TICKET_AUTODONE=0.
+# pass with CNCP_APPROVAL_AUTODONE=0 / TICKET_AUTODONE=0 / CNCP_RETIRE=0.
set -u
ROOT="$HOME/Projects/ticket-system"
LOG="$ROOT/nightly-cleanup.log"
@@ -33,10 +37,30 @@ TS="$(date '+%F %T')"
# 2) Ticket auto-done (conservative; reversible)
if [ "${TICKET_AUTODONE:-1}" != "0" ]; then
- echo "[2/2] ticket auto-done → node ticket-autodone.js --apply"
+ echo "[2/3] ticket auto-done → node ticket-autodone.js --apply"
( cd "$ROOT" && "$NODE" ticket-autodone.js --apply )
else
- echo "[2/2] ticket auto-done SKIPPED (TICKET_AUTODONE=0)"
+ echo "[2/3] ticket auto-done SKIPPED (TICKET_AUTODONE=0)"
+ fi
+ echo
+
+ # 3) CNCP panel retire (>N days across accumulating tabs; snapshots first)
+ if [ "${CNCP_RETIRE:-1}" != "0" ]; then
+ CNCP_DIR="$HOME/cncp-starter"
+ if [ -f "$CNCP_DIR/cncp-retire.py" ]; then
+ echo "[3/3] cncp panel retire → python3 cncp-retire.py --days ${CNCP_RETIRE_DAYS:-7}"
+ OUT="$( cd "$CNCP_DIR" && python3 cncp-retire.py --days "${CNCP_RETIRE_DAYS:-7}" )"
+ echo "$OUT"
+ # restart CNCP only if something was actually retired (so caches reload)
+ if ! echo "$OUT" | grep -q 'retired 0$'; then
+ echo " retire changed files — restarting CNCP (com.user.cncp) to reload caches"
+ launchctl kickstart -k "gui/$(id -u)/com.user.cncp" >/dev/null 2>&1 || echo " (CNCP restart failed — check com.user.cncp)"
+ fi
+ else
+ echo "[3/3] cncp panel retire SKIPPED (cncp-retire.py not found at $CNCP_DIR)"
+ fi
+ else
+ echo "[3/3] cncp panel retire SKIPPED (CNCP_RETIRE=0)"
fi
echo "=== done $TS ==="
← 32d067a nightly board hygiene: ticket auto-done + approvals sweep at
·
back to Ticket System
·
(newest)