aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-04 12:10:18 +0200
committerDanilo M. <danix@danix.xyz>2026-08-04 12:10:18 +0200
commit89a41a913d5f0fbf385b70643cba26d64c9ed81c (patch)
tree435776d3af4edb8e5c603fd4923a42dbeff4b08e
parent9f586a8e79c73cba5267aa1848c72123ded37f9b (diff)
downloadmailctl-89a41a913d5f0fbf385b70643cba26d64c9ed81c.tar.gz
mailctl-89a41a913d5f0fbf385b70643cba26d64c9ed81c.zip
deleted mailsync.sh as it now lives in **mailctl** project repository.
-rw-r--r--CLAUDE.md9
-rw-r--r--README.md16
-rwxr-xr-xmailsync.sh67
3 files changed, 21 insertions, 71 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 1cf9b0a..24fdf21 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -6,14 +6,19 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
`mailctl.py` is a deliberately narrow, agent-safe CLI wrapper around `notmuch`. It exists so an agent can search and organize local mail **without any ability to send**. There is no SMTP, reply, or compose code path in the tool. Adding one violates the core design; do not add send capability.
-`mailsync.sh` is the separate sync driver (mbsync + `notmuch new`), meant for cron/systemd, not called by `mailctl.py`.
+**`mailsync.sh` no longer lives here.** It moved to the companion project
+`qtmaildir`, at `assets/mailsync.sh`. It never belonged in this repo:
+`mailctl.py` does not call it, while qtmaildir runs it as a subprocess and
+depends on how it behaves, so the constraints on the script are all over
+there. Sync and organization stay separate here exactly as before; there is
+simply nothing to sync with in this tree.
## Installation
No installer, just copy files into place:
```bash
-cp mailctl.py mailsync.sh ~/bin/ # executables (skill calls ~/bin/mailctl.py)
+cp mailctl.py ~/bin/ # executable (skill calls ~/bin/mailctl.py)
cp -r mail-organize ~/.claude/skills/ # skill in its own directory
```
diff --git a/README.md b/README.md
index 3e1ef04..c33a5f2 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ An agent given raw `notmuch`/`mbsync` access can do anything, including mangle t
No installer, just copy files into place:
```bash
-cp mailctl.py mailsync.sh ~/bin/ # executables
+cp mailctl.py ~/bin/ # executable
cp -r mail-organize ~/.claude/skills/ # Claude Code skill, in its own dir
```
@@ -85,7 +85,19 @@ mailctl tag "from:substack.com" --account personal --add newsletter --apply
## Companion sync script
-`mailsync.sh` runs `mbsync -a` followed by `notmuch new`, with a `flock` guard and timestamped, rotated logging. It is meant for a cron/systemd timer and is **not** called by `mailctl.py`; sync and organization stay separate on purpose.
+`mailsync.sh` used to live here. It now lives in the companion project
+**qtmaildir**, at `assets/mailsync.sh`, which is where to look for it and where
+to change it.
+
+It runs `mbsync -a` followed by `notmuch new`, with a `flock` guard and
+timestamped, rotated logging, and is meant for a cron/systemd timer. It is still
+**not** called by `mailctl.py`: sync and organization stay separate on purpose,
+which is precisely why it moved. qtmaildir runs it as a subprocess and depends
+on how it behaves, so the script and the constraints on it belong together.
+
+Two of those constraints are worth knowing if you edit it: it must print to
+stdout as well as its log file, or qtmaildir's sync pane shows nothing, and it
+must exit with the real status, or a failed sync is reported as a clean one.
## Claude Code skill
diff --git a/mailsync.sh b/mailsync.sh
deleted file mode 100755
index 1ea2aa2..0000000
--- a/mailsync.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-# ~/bin/mailsync.sh
-#
-# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-# Defensive: don't rely on cron/systemd/whatever invokes this to have
-# set these correctly. Explicit beats inferred, especially after the
-# HOME-not-set failure we hit once already. Fall back to the invoking
-# user's home from passwd rather than a hardcoded path.
-export HOME="${HOME:-$(getent passwd "$(id -u)" | cut -d: -f6)}"
-export GNUPGHOME="${GNUPGHOME:-$HOME/.gnupg}"
-
-LOCKFILE="/tmp/mbsync.lock"
-LOGFILE="$HOME/.local/state/mailsync.log"
-MAX_LOG_BYTES=$((10 * 1024 * 1024)) # rotate past 10MB, see note below
-
-exec 200>"$LOCKFILE"
-if ! flock -n 200; then
- echo "$(date -Iseconds) === SKIPPED: previous run still in progress ===" >> "$LOGFILE"
- exit 1
-fi
-
-# Simple rotation: if the log's gotten big, keep the last run's worth
-# and move the rest aside rather than letting it grow forever.
-if [ -f "$LOGFILE" ] && [ "$(stat -c%s "$LOGFILE" 2>/dev/null || echo 0)" -gt "$MAX_LOG_BYTES" ]; then
- mv "$LOGFILE" "${LOGFILE}.1"
-fi
-
-START_TS="$(date -Iseconds)"
-{
- echo "===== RUN START: $START_TS ====="
-
- # Timestamp every line of mbsync/notmuch output as it streams,
- # rather than only marking run boundaries, this is what actually
- # lets you tell which errors are from which run at a glance.
- mbsync -a 2>&1 | while IFS= read -r line; do
- echo "$(date '+%H:%M:%S') $line"
- done
- MBSYNC_STATUS=${PIPESTATUS[0]}
-
- notmuch new 2>&1 | while IFS= read -r line; do
- echo "$(date '+%H:%M:%S') $line"
- done
- NOTMUCH_STATUS=${PIPESTATUS[0]}
-
- END_TS="$(date -Iseconds)"
- if [ "$MBSYNC_STATUS" -eq 0 ] && [ "$NOTMUCH_STATUS" -eq 0 ]; then
- echo "===== RUN END: $END_TS status=OK ====="
- else
- echo "===== RUN END: $END_TS status=FAILED mbsync=$MBSYNC_STATUS notmuch=$NOTMUCH_STATUS ====="
- fi
-} >> "$LOGFILE"
-
-exit 0