forked from bchanot/claude
job5: J5-13 delete pending verbs (v2 hook rejected by BDR-037, J4-17 moot)
This commit is contained in:
+2
-15
@@ -13,7 +13,6 @@
|
|||||||
# Caller passes EXACTLY the files doc-sync patched this run.
|
# Caller passes EXACTLY the files doc-sync patched this run.
|
||||||
#
|
#
|
||||||
# Usage (CLI):
|
# Usage (CLI):
|
||||||
# doc-commit.sh pending <file>... # exit 0 if any passed file has changes, 1 if clean
|
|
||||||
# doc-commit.sh commit "<message>" <file>... # surgical commit
|
# doc-commit.sh commit "<message>" <file>... # surgical commit
|
||||||
#
|
#
|
||||||
# Exit codes (commit): 0 ok/no-op · 2 usage · 3 unsafe git state · 4 scope violation ·
|
# Exit codes (commit): 0 ok/no-op · 2 usage · 3 unsafe git state · 4 scope violation ·
|
||||||
@@ -22,7 +21,7 @@
|
|||||||
# commit is the ONLY thing on stdout (empty on no-op/abort), so callers can capture
|
# commit is the ONLY thing on stdout (empty on no-op/abort), so callers can capture
|
||||||
# it: doc_hash=$(doc-commit.sh commit "msg" README.md USAGE.md).
|
# it: doc_hash=$(doc-commit.sh commit "msg" README.md USAGE.md).
|
||||||
#
|
#
|
||||||
# Sourceable: docs_pending and commit_docs for the v2 hook.
|
# Sourceable: `commit_docs`.
|
||||||
|
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
|
|
||||||
@@ -70,14 +69,6 @@ _changed_paths() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# 0 if any passed path has pending changes, 1 if all clean / absent.
|
|
||||||
docs_pending() {
|
|
||||||
_in_git_repo || return 1
|
|
||||||
local changed
|
|
||||||
mapfile -t changed < <(_changed_paths "$@")
|
|
||||||
[ "${#changed[@]}" -gt 0 ]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Surgical commit of the passed doc paths only. Returns 0 (ok/no-op), 3 (unsafe),
|
# Surgical commit of the passed doc paths only. Returns 0 (ok/no-op), 3 (unsafe),
|
||||||
# 4 (scope violation), 5 (commit rejected by git). On a real commit, prints the
|
# 4 (scope violation), 5 (commit rejected by git). On a real commit, prints the
|
||||||
# doc-commit short hash to stdout.
|
# doc-commit short hash to stdout.
|
||||||
@@ -143,16 +134,12 @@ commit_docs() {
|
|||||||
main() {
|
main() {
|
||||||
local cmd="${1:-}"
|
local cmd="${1:-}"
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
pending)
|
|
||||||
shift
|
|
||||||
docs_pending "$@"
|
|
||||||
;;
|
|
||||||
commit)
|
commit)
|
||||||
shift
|
shift
|
||||||
commit_docs "$@"
|
commit_docs "$@"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage: doc-commit.sh {pending <file>... | commit <message> <file>...}" >&2
|
echo "usage: doc-commit.sh commit <message> <file>..." >&2
|
||||||
return 2
|
return 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
+6
-16
@@ -1,20 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# memory-commit.sh — surgically commit ONLY .claude/memory + .claude/tasks.
|
# 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
|
# Used by the dev-flow capitalize step to couple the memory commit to the
|
||||||
# the memory commit to the flow. Safety lives in the PATHSPEC, never in a human
|
# flow. Safety lives in the PATHSPEC, never in a human diff review —
|
||||||
# diff review — automation removes that review, so the scope must be airtight:
|
# automation removes that review, so the scope must be airtight: code that
|
||||||
# code that happens to be dirty or staged is NEVER embarked.
|
# happens to be dirty or staged is NEVER embarked.
|
||||||
#
|
#
|
||||||
# Usage (CLI):
|
# 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
|
# 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
|
# 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
|
# 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")`.
|
# 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
|
set -uo pipefail
|
||||||
|
|
||||||
@@ -47,14 +46,6 @@ _changed_paths() {
|
|||||||
done
|
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).
|
# 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).
|
# On a real commit, prints the memory-commit short hash to stdout (stderr = diag).
|
||||||
commit_memory() {
|
commit_memory() {
|
||||||
@@ -103,13 +94,12 @@ commit_memory() {
|
|||||||
main() {
|
main() {
|
||||||
local cmd="${1:-}"
|
local cmd="${1:-}"
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
pending) memory_pending ;;
|
|
||||||
commit)
|
commit)
|
||||||
shift
|
shift
|
||||||
commit_memory "${1:-}"
|
commit_memory "${1:-}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "usage: memory-commit.sh {pending | commit <message>}" >&2
|
echo "usage: memory-commit.sh commit <message>" >&2
|
||||||
return 2
|
return 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Reference in New Issue
Block a user