job5: J5-13 delete pending verbs (v2 hook rejected by BDR-037, J4-17 moot)

This commit is contained in:
Bastien Chanot
2026-07-07 00:53:49 +02:00
parent af4f5cc6a4
commit da3abf9f1b
2 changed files with 8 additions and 31 deletions
+6 -16
View File
@@ -1,20 +1,19 @@
#!/usr/bin/env bash
# memory-commit.sh — surgically commit ONLY .claude/memory + .claude/tasks.
#
# Used by the dev-flow capitalize step (and, later, the v2 Stop hook) to couple
# the memory commit to the flow. Safety lives in the PATHSPEC, never in a human
# diff review — automation removes that review, so the scope must be airtight:
# code that happens to be dirty or staged is NEVER embarked.
# Used by the dev-flow capitalize step to couple the memory commit to the
# flow. Safety lives in the PATHSPEC, never in a human diff review —
# automation removes that review, so the scope must be airtight: code that
# happens to be dirty or staged is NEVER embarked.
#
# Usage (CLI):
# memory-commit.sh pending # exit 0 if memory/tasks have changes, 1 if clean
# memory-commit.sh commit "<message>" # surgical commit; exit 0 ok/no-op, 3 unsafe state
#
# Output contract for `commit`: diagnostics go to stderr; on a real commit the
# short hash of the MEMORY commit is the ONLY thing on stdout (empty on no-op or
# unsafe), so callers can capture it: `mem_hash=$(memory-commit.sh commit "msg")`.
#
# Sourceable: `memory_pending` and `commit_memory` for the v2 hook.
# Sourceable: `commit_memory`.
set -uo pipefail
@@ -47,14 +46,6 @@ _changed_paths() {
done
}
# 0 if something is pending under the scoped paths, 1 if clean / absent.
memory_pending() {
_in_git_repo || return 1
local changed
mapfile -t changed < <(_changed_paths)
[ "${#changed[@]}" -gt 0 ]
}
# Surgical commit of the scoped paths only. Returns 0 (ok or no-op), 3 (unsafe).
# On a real commit, prints the memory-commit short hash to stdout (stderr = diag).
commit_memory() {
@@ -103,13 +94,12 @@ commit_memory() {
main() {
local cmd="${1:-}"
case "$cmd" in
pending) memory_pending ;;
commit)
shift
commit_memory "${1:-}"
;;
*)
echo "usage: memory-commit.sh {pending | commit <message>}" >&2
echo "usage: memory-commit.sh commit <message>" >&2
return 2
;;
esac