Rename the scripts that update the policy files
check / check (push) Canceled after 0s

script/commit-current-upstream-policy-docs is now
script/write-upstream-policy-files: it writes the policy files and
commits nothing. script/update-policy is now
script/commit-upstream-policy-files, and make update-policy is now
make commit-upstream-policy-files. test/update-policy.sh follows.
Behaviour is unchanged.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-11 00:47:30 +00:00
1 parent ed60414378
commit f0ec2f38a8
11 files changed
+240 -232

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
#!/bin/sh
# script/commit-upstream-policy-files: bring this repo up to standards.
# It fetches the current script/write-upstream-policy-files from the
# prompts repo over HTTP, runs it on this repo and commits the files it
# wrote. It does not push. Identical in all repos. Our own extension to
# scripts-to-rule-them-all.
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
WRITE_UPSTREAM_POLICY_FILES_URL="https://git.eeqj.de/sneak/prompts/raw/branch/main/script/write-upstream-policy-files"
die() {
echo "commit-upstream-policy-files: $*" >&2
exit 1
}
main() {
[ "$#" -eq 0 ] || die "usage: script/commit-upstream-policy-files"
cd "$ROOT"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
curl --fail --silent --show-error --max-time 60 \
--output "$tmp/write-upstream-policy-files" \
"$WRITE_UPSTREAM_POLICY_FILES_URL" ||
die "cannot fetch $WRITE_UPSTREAM_POLICY_FILES_URL"
sh "$tmp/write-upstream-policy-files" "$ROOT" > "$tmp/written"
commit="$(head -n 1 "$tmp/written")"
paths="$(tail -n +2 "$tmp/written")"
for path in $paths; do
git add -- "$path"
done
if git diff --cached --quiet -- $paths; then
echo "commit-upstream-policy-files: already at prompts $commit, nothing to commit"
else
git commit -m "Update policy files from prompts $commit" -- $paths
fi
}
main "$@"
-45
View File
@@ -1,45 +0,0 @@
#!/bin/sh
# script/update-policy: bring this repo up to standards. It fetches the
# current script/commit-current-upstream-policy-docs from the prompts
# repo over HTTP, runs it on this repo and commits the files it wrote.
# It does not push. Identical in all repos. Our own extension to
# scripts-to-rule-them-all.
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
COMMIT_CURRENT_UPSTREAM_POLICY_DOCS_URL="https://git.eeqj.de/sneak/prompts/raw/branch/main/script/commit-current-upstream-policy-docs"
die() {
echo "update-policy: $*" >&2
exit 1
}
main() {
[ "$#" -eq 0 ] || die "usage: script/update-policy"
cd "$ROOT"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
curl --fail --silent --show-error --max-time 60 \
--output "$tmp/commit-current-upstream-policy-docs" \
"$COMMIT_CURRENT_UPSTREAM_POLICY_DOCS_URL" ||
die "cannot fetch $COMMIT_CURRENT_UPSTREAM_POLICY_DOCS_URL"
sh "$tmp/commit-current-upstream-policy-docs" "$ROOT" > "$tmp/written"
commit="$(head -n 1 "$tmp/written")"
paths="$(tail -n +2 "$tmp/written")"
for path in $paths; do
git add -- "$path"
done
if git diff --cached --quiet -- $paths; then
echo "update-policy: already at prompts $commit, nothing to commit"
else
git commit -m "Update policy files from prompts $commit" -- $paths
fi
}
main "$@"
@@ -1,10 +1,10 @@
#!/bin/sh
# script/commit-current-upstream-policy-docs: write the current policy
# files from the prompts repo into a repo clone, over HTTP. It commits
# nothing; script/update-policy does that. Identical in all repos. Our
# own extension to scripts-to-rule-them-all.
# script/write-upstream-policy-files: write the current policy files
# from the prompts repo into a repo clone, over HTTP. It commits
# nothing; script/commit-upstream-policy-files does that. Identical in
# all repos. Our own extension to scripts-to-rule-them-all.
#
# Usage: script/commit-current-upstream-policy-docs [path of a repo clone]
# Usage: script/write-upstream-policy-files [path of a repo clone]
# Without a path it updates the repo this script sits in.
#
# Standard output is the full hash of the prompts commit, then each path
@@ -50,12 +50,12 @@ prompts/GO_HTTP_SERVER_CONVENTIONS.md
prompts/LLM_PROSE_TELLS.md
prompts/NEW_REPO_CHECKLIST.md
prompts/REPO_POLICIES.md
script/commit-current-upstream-policy-docs
script/update-policy
script/write-upstream-policy-files
script/commit-upstream-policy-files
"
die() {
echo "commit-current-upstream-policy-docs: $*" >&2
echo "write-upstream-policy-files: $*" >&2
exit 1
}
@@ -227,7 +227,7 @@ $own"
main() {
[ "$#" -le 1 ] ||
die "usage: script/commit-current-upstream-policy-docs [path of a repo clone]"
die "usage: script/write-upstream-policy-files [path of a repo clone]"
target="${1:-$(dirname "$0")/..}"
cd "$target" || die "no such directory: $target"
@@ -285,8 +285,8 @@ main() {
mkdir -p "$(dirname "$path")"
case "$path" in
script/*)
# A new name and mv, because script/update-policy may
# be the script running.
# A new name and mv, because the script running may be
# script/commit-upstream-policy-files.
cp "$tmp/$path" "$path.new"
chmod 755 "$path.new"
mv "$path.new" "$path"