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.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# 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
|
||||
# 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
|
||||
|
||||
@@ -70,14 +69,6 @@ _changed_paths() {
|
||||
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),
|
||||
# 4 (scope violation), 5 (commit rejected by git). On a real commit, prints the
|
||||
# doc-commit short hash to stdout.
|
||||
@@ -143,16 +134,12 @@ commit_docs() {
|
||||
main() {
|
||||
local cmd="${1:-}"
|
||||
case "$cmd" in
|
||||
pending)
|
||||
shift
|
||||
docs_pending "$@"
|
||||
;;
|
||||
commit)
|
||||
shift
|
||||
commit_docs "$@"
|
||||
;;
|
||||
*)
|
||||
echo "usage: doc-commit.sh {pending <file>... | commit <message> <file>...}" >&2
|
||||
echo "usage: doc-commit.sh commit <message> <file>..." >&2
|
||||
return 2
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user