From 91a065535c8c1001a905edcf57159e299ec972c7 Mon Sep 17 00:00:00 2001 From: Midia Kiasat Date: Mon, 9 Mar 2026 19:32:28 +0100 Subject: [PATCH 1/2] Harden guillotine termination contract and success exit semantics --- guillotine.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/guillotine.sh b/guillotine.sh index ee605a4..92921c4 100755 --- a/guillotine.sh +++ b/guillotine.sh @@ -1,14 +1,21 @@ #!/bin/sh -# GUILLOTINE v0.0.0 +# GUILLOTINE v0.1.0 # Claude Code execution terminator # One-way. No recovery. No discussion. set -eu -git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 2 +# --- Preconditions --------------------------------------------------------- + +git rev-parse --is-inside-work-tree >/dev/null 2>&1 || { + printf '%s\n' "GUILLOTINE: not a git repository" >&2 + exit 2 +} + +# --- Termination ----------------------------------------------------------- # Null-delimited, space-safe -git status --porcelain=v1 -z | while IFS= read -r -d '' entry; do +git status --porcelain=v1 -z | while IFS= read -r -d "" entry; do status=${entry%% *} path=${entry#?? } @@ -18,4 +25,5 @@ git status --porcelain=v1 -z | while IFS= read -r -d '' entry; do rm -rf -- "$path" done -exit 1 +printf '%s\n' "TERMINATED" +exit 0 From a624de9728013289dbbd1ed2f3e4000afe2a6606 Mon Sep 17 00:00:00 2001 From: Midia Kiasat Date: Mon, 9 Mar 2026 20:07:55 +0100 Subject: [PATCH 2/2] Enforce empty-stdin rejection in guillotine termination contract --- guillotine.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/guillotine.sh b/guillotine.sh index 92921c4..e79f736 100755 --- a/guillotine.sh +++ b/guillotine.sh @@ -5,6 +5,15 @@ set -eu +# --- Input ----------------------------------------------------------------- + +INPUT="$(cat || true)" + +[ -z "$INPUT" ] && { + printf '%s\n' "INVALID" + exit 1 +} + # --- Preconditions --------------------------------------------------------- git rev-parse --is-inside-work-tree >/dev/null 2>&1 || {