[object Object]

← back to Dw Pitch Followup

Add repo-local pre-commit: lint staged launchd/*.plist

705c7158be09d937dc7018c9440e6cbbc751e4f7 · 2026-08-06 08:33:37 -0700 · Steve Abrams

Blocks any commit that stages a malformed plist (mismatched tags, bad
schedule) via plutil -lint on the staged blob. Repo-scoped core.hooksPath
=.githooks so it runs even though this machine's global core.hooksPath
points at a non-existent dir. Prevents a repeat of the silent broken-plist
that froze the pitch board for a week.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 705c7158be09d937dc7018c9440e6cbbc751e4f7
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Aug 6 08:33:37 2026 -0700

    Add repo-local pre-commit: lint staged launchd/*.plist
    
    Blocks any commit that stages a malformed plist (mismatched tags, bad
    schedule) via plutil -lint on the staged blob. Repo-scoped core.hooksPath
    =.githooks so it runs even though this machine's global core.hooksPath
    points at a non-existent dir. Prevents a repeat of the silent broken-plist
    that froze the pitch board for a week.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 .githooks/pre-commit | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/.githooks/pre-commit b/.githooks/pre-commit
new file mode 100755
index 0000000..2ec74f0
--- /dev/null
+++ b/.githooks/pre-commit
@@ -0,0 +1,25 @@
+#!/bin/sh
+# pre-commit: lint every staged launchd/*.plist so a malformed plist (bad
+# schedule, mismatched tags) can never ship silently again. Born 2026-08-06
+# after a broken dw-pitch-rebuild.plist (opened <array>, closed </dict>) failed
+# to parse, never installed, and froze the pitch board for a week.
+#
+# Lints the STAGED blob (via git show :file), not the working tree, so a fixed
+# working copy can't mask a broken thing you're actually committing.
+fail=0
+for f in $(git diff --cached --name-only --diff-filter=ACM -- launchd/); do
+  case "$f" in *.plist) ;; *) continue ;; esac
+  tmp=$(mktemp)
+  git show ":$f" > "$tmp" 2>/dev/null
+  if ! plutil -lint "$tmp" >/dev/null 2>&1; then
+    echo "pre-commit ✗ invalid plist: $f"
+    plutil -lint "$tmp" 2>&1 | sed "s|$tmp|$f|"
+    fail=1
+  fi
+  rm -f "$tmp"
+done
+if [ "$fail" -ne 0 ]; then
+  echo "commit blocked — fix the malformed plist(s) above (macOS: plutil -lint <file>)."
+  exit 1
+fi
+exit 0

← 264deba Fix pitch-rebuild launchd: valid plist + once-daily 2:00 AM  ·  back to Dw Pitch Followup  ·  Pitch drawer: render all Gmail correspondence as a table e26fbb5 →