housebroken-cli 0.22.0__tar.gz → 0.24.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/PKG-INFO +2 -2
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/README.md +1 -1
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/bin/housebroken +8 -3
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/pyproject.toml +1 -1
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/close.sh +2 -2
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/common.sh +29 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/edit-pr.sh +1 -1
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/file-pr.sh +1 -1
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/fork-hygiene.sh +4 -2
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/inbox.sh +1 -1
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/pr-sweep.sh +46 -4
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/push.sh +2 -2
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/reply.sh +12 -10
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/review.sh +24 -4
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/skills/housebroken/SKILL.md +8 -1
- housebroken_cli-0.24.0/src/housebroken/__init__.py +1 -0
- housebroken_cli-0.22.0/src/housebroken/__init__.py +0 -1
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/.gitignore +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/LICENSE +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/hatch_build.py +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/branch-check.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/check-ai-policy.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/ci-legs.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/claim-check.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/comment-census.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/comment-check.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/declare.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/diff-defaults.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/distinct-outside.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/file-issue.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/gate-hook.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/notes.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/prior-art.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/proof.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/ref-check.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/refuse.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/same-code.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/scripts/verify-filed-pr.sh +0 -0
- {housebroken_cli-0.22.0 → housebroken_cli-0.24.0}/src/housebroken/cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: housebroken-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.24.0
|
|
4
4
|
Summary: Agent-written pull requests that do not make a mess in someone else's house.
|
|
5
5
|
Project-URL: Repository, https://github.com/lenamonj/housebroken
|
|
6
6
|
Project-URL: Issues, https://github.com/lenamonj/housebroken/issues
|
|
@@ -144,7 +144,7 @@ An upgrade moves the package and not those two copies, so after one run `housebr
|
|
|
144
144
|
| `scripts/file-pr.sh` | the only way a pull request gets filed: every gate above in front of `gh pr create` |
|
|
145
145
|
| `scripts/file-issue.sh` | the only way an issue gets filed: the same printouts and prose, and a fix offered is a fix linked |
|
|
146
146
|
| `scripts/verify-filed-pr.sh` | the filed pull request is what was meant, and CI is green: one line when it is, the report when it is not |
|
|
147
|
-
| `scripts/pr-sweep.sh` | every open pull request where the ball is in your court, a head CI never started on and a standing stale notice among them, and every merged or closed one whose fork branch is still there, repeated each run until it is gone (one used again for other work is named once and left alone) |
|
|
147
|
+
| `scripts/pr-sweep.sh` | every open pull request where the ball is in your court, a head CI never started on and a standing stale notice among them, and every merged or closed one whose fork branch is still there, repeated each run until it is gone (one used again for other work is named once and left alone); and a count of the open ones whose head this machine holds no review of under the current brief, each named on a `READ` line by `--all` |
|
|
148
148
|
| `scripts/inbox.sh` | what GitHub has to tell you since you last looked, bodies included, with a census of every open pull request |
|
|
149
149
|
| `scripts/notes.sh` | what this repository's maintainers have asked for before |
|
|
150
150
|
| `scripts/reply.sh` | the only way an answer on a thread gets posted, and only to a voice with a role in the repository unless the user says otherwise |
|
|
@@ -121,7 +121,7 @@ An upgrade moves the package and not those two copies, so after one run `housebr
|
|
|
121
121
|
| `scripts/file-pr.sh` | the only way a pull request gets filed: every gate above in front of `gh pr create` |
|
|
122
122
|
| `scripts/file-issue.sh` | the only way an issue gets filed: the same printouts and prose, and a fix offered is a fix linked |
|
|
123
123
|
| `scripts/verify-filed-pr.sh` | the filed pull request is what was meant, and CI is green: one line when it is, the report when it is not |
|
|
124
|
-
| `scripts/pr-sweep.sh` | every open pull request where the ball is in your court, a head CI never started on and a standing stale notice among them, and every merged or closed one whose fork branch is still there, repeated each run until it is gone (one used again for other work is named once and left alone) |
|
|
124
|
+
| `scripts/pr-sweep.sh` | every open pull request where the ball is in your court, a head CI never started on and a standing stale notice among them, and every merged or closed one whose fork branch is still there, repeated each run until it is gone (one used again for other work is named once and left alone); and a count of the open ones whose head this machine holds no review of under the current brief, each named on a `READ` line by `--all` |
|
|
125
125
|
| `scripts/inbox.sh` | what GitHub has to tell you since you last looked, bodies included, with a census of every open pull request |
|
|
126
126
|
| `scripts/notes.sh` | what this repository's maintainers have asked for before |
|
|
127
127
|
| `scripts/reply.sh` | the only way an answer on a thread gets posted, and only to a voice with a role in the repository unless the user says otherwise |
|
|
@@ -129,6 +129,12 @@ case "$cmd" in
|
|
|
129
129
|
push) script=push.sh ;;
|
|
130
130
|
close) script=close.sh ;;
|
|
131
131
|
install-hook) script=gate-hook.sh; set -- --install ;;
|
|
132
|
+
# The Python command answers these two before it calls this file, so here the
|
|
133
|
+
# install is install.sh's or a clone's, and install.sh installs the skill.
|
|
134
|
+
install-skill|skill-path)
|
|
135
|
+
echo "housebroken: $cmd belongs to the pip, pipx and uv installs; this one came from install.sh or a clone, and install.sh installs the skill: run bash install.sh from the repository again" >&2
|
|
136
|
+
exit 2
|
|
137
|
+
;;
|
|
132
138
|
*)
|
|
133
139
|
echo "housebroken: unknown subcommand: $cmd (try: housebroken help)" >&2
|
|
134
140
|
exit 2
|
|
@@ -151,9 +157,8 @@ stale() { # installed-copy packaged-copy command
|
|
|
151
157
|
echo "note: $1 is not this version's; run $3" >&2
|
|
152
158
|
fi
|
|
153
159
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
done
|
|
160
|
+
stale "$HOME/.claude/skills/housebroken/SKILL.md" "$scripts_dir/../skill/SKILL.md" "housebroken install-skill"
|
|
161
|
+
stale "$HOME/.claude/skills/housebroken/SKILL.md" "$scripts_dir/../skills/housebroken/SKILL.md" "bash install.sh"
|
|
157
162
|
[ "$cmd" = "install-hook" ] || stale "$HOME/.claude/hooks/housebroken-gate.sh" "$scripts_dir/gate-hook.sh" "housebroken install-hook"
|
|
158
163
|
|
|
159
164
|
export HOUSEBROKEN_HOME
|
|
@@ -89,7 +89,7 @@ if pr=$(gh pr view "$num" --repo "$repo" --json author,state,headRefName,headRep
|
|
|
89
89
|
fork=$(printf '%s' "$pr" | jq -r '.headRepository.name // ""' | tr -d '\r')
|
|
90
90
|
branch=$(printf '%s' "$pr" | jq -r '.headRefName // ""' | tr -d '\r')
|
|
91
91
|
oid=$(printf '%s' "$pr" | jq -r '.headRefOid // ""' | tr -d '\r')
|
|
92
|
-
[ "$author" = "$user" ] || refuse close-not-yours "$repo#$num is $author's, not yours"
|
|
92
|
+
[ "$(lower "$author")" = "$(lower "$user")" ] || refuse close-not-yours "$repo#$num is $author's, not yours"
|
|
93
93
|
[ "$state" = "OPEN" ] || refuse close-not-open "$repo#$num is $state; only an open pull request is closed"
|
|
94
94
|
else
|
|
95
95
|
refuse close-thread-unreadable "cannot read $repo#$num, so whose it is and whether it is open are unknown"
|
|
@@ -128,7 +128,7 @@ if ! gh pr close "$num" --repo "$repo"; then
|
|
|
128
128
|
fi
|
|
129
129
|
rc=0
|
|
130
130
|
bash "$here/notes.sh" "$repo" add "we closed #$num: $(printf '%s' "$own" | clean_line | cut -c1-200)" || rc=1
|
|
131
|
-
if [ "$fork_owner" = "$user" ] && [ -n "$fork" ] && [ -n "$branch" ]; then
|
|
131
|
+
if [ "$(lower "$fork_owner")" = "$(lower "$user")" ] && [ -n "$fork" ] && [ -n "$branch" ]; then
|
|
132
132
|
if ! drop_fork_branch "$user" "$fork" "$branch" "CLOSED $repo#$num" 0 "$oid"; then
|
|
133
133
|
echo "housebroken hygiene deletes it on its next run" >&2
|
|
134
134
|
rc=1
|
|
@@ -419,6 +419,35 @@ is_bot() { case "$1" in *"[bot]"|Copilot|codecov-commenter|coveralls|CLAassistan
|
|
|
419
419
|
# can type into the thread: read, never answered without the user's word.
|
|
420
420
|
has_role() { case "$(printf '%s' "$1" | tr '[:lower:]' '[:upper:]')" in OWNER|MEMBER|COLLABORATOR) return 0 ;; *) return 1 ;; esac; }
|
|
421
421
|
|
|
422
|
+
# The review brief's number: that of the last item in a code review's brief
|
|
423
|
+
# (a brief with no clone stops earlier and carries the same number). review.sh
|
|
424
|
+
# has the reviewer write it into the report, and the sweep compares it with
|
|
425
|
+
# this one, so a head reviewed before an item existed is told from one
|
|
426
|
+
# reviewed after. Raise it with every item the brief gains.
|
|
427
|
+
# shellcheck disable=SC2034 # read by the scripts that source this file
|
|
428
|
+
review_brief_items=13
|
|
429
|
+
|
|
430
|
+
# GitHub logins and repository names are one name in any case.
|
|
431
|
+
lower() { printf '%s' "$1" | tr '[:upper:]' '[:lower:]'; }
|
|
432
|
+
|
|
433
|
+
# The brief a head was reviewed under, read from the header of the report
|
|
434
|
+
# review.sh names for that head: its number, 0 when the header carries none or
|
|
435
|
+
# one no brief will reach, "unreadable" when the report cannot be read, and
|
|
436
|
+
# nothing when this machine holds no report of this repository for the head.
|
|
437
|
+
# The name alone does not say which: a-b/c and a/b-c share it, so the report's
|
|
438
|
+
# review-of line must name the repository.
|
|
439
|
+
reviewed_under() { # repo head home
|
|
440
|
+
local report="$3/reviews/review-${1%%/*}-${1##*/}-${2:0:12}.md" n
|
|
441
|
+
[ -f "$report" ] || return 0
|
|
442
|
+
n=$(awk -v repo="$1" '{sub(/\r$/, "")} NF == 0 {exit}
|
|
443
|
+
/^review-of:/ && !named {named = 1; of = $0; sub(/^review-of: */, "", of); sub(/ *$/, "", of)}
|
|
444
|
+
$1 == "brief:" && !seen {seen = 1; brief = $2}
|
|
445
|
+
END {if (tolower(of) == tolower(repo)) print "brief=" brief}' "$report" 2>/dev/null) || { echo unreadable; return 0; }
|
|
446
|
+
[ -n "$n" ] || return 0
|
|
447
|
+
n=${n#brief=}
|
|
448
|
+
case "$n" in ''|*[!0-9]*|???????*) echo 0 ;; *) echo "$n" ;; esac
|
|
449
|
+
}
|
|
450
|
+
|
|
422
451
|
# Prints stdin as someone else's words: fenced and marked, each line prefixed so
|
|
423
452
|
# nothing inside can pass for the script's own output or close the fence.
|
|
424
453
|
fence() { # who indent
|
|
@@ -94,7 +94,7 @@ pr=$(gh pr view "$num" --repo "$repo" --json author,state,headRefOid 2>/dev/null
|
|
|
94
94
|
author=$(printf '%s' "$pr" | jq -r '.author.login // "?"' | tr -d '\r')
|
|
95
95
|
state=$(printf '%s' "$pr" | jq -r '.state // "?"' | tr -d '\r')
|
|
96
96
|
head=$(printf '%s' "$pr" | jq -r '.headRefOid // ""' | tr -d '\r')
|
|
97
|
-
[ "$author" = "$user" ] || { refused edit-pr-not-yours "$repo#$num is $author's, not yours" >&2; exit 2; }
|
|
97
|
+
[ "$(lower "$author")" = "$(lower "$user")" ] || { refused edit-pr-not-yours "$repo#$num is $author's, not yours" >&2; exit 2; }
|
|
98
98
|
[ "$state" = "OPEN" ] || { refused edit-pr-not-open "$repo#$num is $state; only an open pull request is edited" >&2; exit 2; }
|
|
99
99
|
|
|
100
100
|
log="$home/edits/${repo%%/*}-${repo##*/}.log"
|
|
@@ -284,7 +284,7 @@ if [ ! -f "$review" ]; then
|
|
|
284
284
|
refused file-pr-no-review "no adversarial review at $review - run review.sh brief with --text $decl and have a different model attack this head" >&2
|
|
285
285
|
exit 2
|
|
286
286
|
fi
|
|
287
|
-
bash "$(dirname "$0")/review.sh" check "$review" --clone . --text "$bodyfile" --text "$decl" >/dev/null || exit 2
|
|
287
|
+
bash "$(dirname "$0")/review.sh" check "$review" --clone . --text "$bodyfile" --text "$decl" --repo "$repo" >/dev/null || exit 2
|
|
288
288
|
|
|
289
289
|
if [ "${FILE_PR_DRY:-0}" = "1" ]; then
|
|
290
290
|
printf 'DRY RUN, not filed:\ngh pr create -R %s' "$repo"
|
|
@@ -38,6 +38,8 @@ if [ -z "$ME" ]; then
|
|
|
38
38
|
echo "fork-hygiene.sh: cannot determine the GitHub login; set HOUSEBROKEN_USER" >&2
|
|
39
39
|
exit 1
|
|
40
40
|
fi
|
|
41
|
+
# HOUSEBROKEN_USER is typed by hand, and GitHub gives back its own spelling of an owner
|
|
42
|
+
me=$(lower "$ME")
|
|
41
43
|
|
|
42
44
|
if ! closed="$(gh search prs --author "$ME" --state closed --sort updated --json repository,number --limit "$MAX" \
|
|
43
45
|
--jq '.[] | "\(.repository.nameWithOwner) \(.number)"')"; then
|
|
@@ -48,7 +50,7 @@ fi
|
|
|
48
50
|
|
|
49
51
|
while read -r repo n; do
|
|
50
52
|
[ -n "$repo" ] || continue
|
|
51
|
-
|
|
53
|
+
[ "$(lower "${repo%%/*}")" != "$me" ] || continue
|
|
52
54
|
# Tabs and @tsv: a branch name can hold a | or a #.
|
|
53
55
|
# shellcheck disable=SC2016 # jq text
|
|
54
56
|
info=$(gh pr view "$n" --repo "$repo" --json headRefName,headRepository,headRepositoryOwner,state,headRefOid \
|
|
@@ -57,7 +59,7 @@ while read -r repo n; do
|
|
|
57
59
|
continue
|
|
58
60
|
}
|
|
59
61
|
IFS=$'\t' read -r owner fork branch state oid <<< "$info"
|
|
60
|
-
if [ "$owner" != "$
|
|
62
|
+
if [ "$(lower "$owner")" != "$me" ] || [ "$fork" = "-" ] || [ "$branch" = "-" ]; then continue; fi
|
|
61
63
|
drop_fork_branch "$ME" "$fork" "$branch" "$state $repo#$n" "$DRY" "$oid"
|
|
62
64
|
done <<< "$closed"
|
|
63
65
|
|
|
@@ -134,7 +134,7 @@ while IFS= read -r t; do
|
|
|
134
134
|
[ -n "$e" ] || continue
|
|
135
135
|
who=$(jq -r .who <<<"$e"); when=$(jq -r .t <<<"$e"); kind=$(jq -r .kind <<<"$e"); where=$(jq -r .where <<<"$e" | clean_line); rst=$(jq -r .rst <<<"$e"); bot=$(jq -r .bot <<<"$e"); role=$(jq -r .role <<<"$e")
|
|
136
136
|
shown=$((shown + 1))
|
|
137
|
-
if [ "$who" = "$user" ]; then
|
|
137
|
+
if [ "$(lower "$who")" = "$(lower "$user")" ]; then
|
|
138
138
|
echo " $when yours: $kind$where"
|
|
139
139
|
elif [ "$bot" = "true" ] || is_bot "$who"; then
|
|
140
140
|
echo " $when $who (bot): $kind$where${rst:+ [$rst]}"
|
|
@@ -22,6 +22,16 @@
|
|
|
22
22
|
# keeps it, so the sweep prints one KEPT line and stops asking. The obligation
|
|
23
23
|
# is in the output, not in anyone's memory.
|
|
24
24
|
#
|
|
25
|
+
# A gate reads a pull request when it is pushed, so one filed before a review
|
|
26
|
+
# item existed is never read under it, however long it stays open. A run
|
|
27
|
+
# counts the open pull requests, outside repositories under your own login,
|
|
28
|
+
# whose head this machine holds no review report for, holds one written under
|
|
29
|
+
# an earlier brief, or holds one it cannot read; it prints the count when
|
|
30
|
+
# there is any, and --all prints a READ line for each. A pull request leaves
|
|
31
|
+
# the count once its head has a report under the current brief. It is not
|
|
32
|
+
# counted as an action and changes no exit status: the reports are local, so a
|
|
33
|
+
# head reviewed on another machine reads the same as one never reviewed.
|
|
34
|
+
#
|
|
25
35
|
# Usage:
|
|
26
36
|
# bash pr-sweep.sh # only PRs where the ball is in our court
|
|
27
37
|
# bash pr-sweep.sh --all # every open PR with its state
|
|
@@ -77,6 +87,9 @@ if [ -z "$ME" ]; then
|
|
|
77
87
|
echo "pr-sweep.sh: cannot determine the GitHub login; set HOUSEBROKEN_USER" >&2
|
|
78
88
|
exit 1
|
|
79
89
|
fi
|
|
90
|
+
# what the login is compared as: HOUSEBROKEN_USER is typed by hand, and GitHub
|
|
91
|
+
# gives back its own spelling of an owner or an author
|
|
92
|
+
me=$(lower "$ME")
|
|
80
93
|
|
|
81
94
|
if ! list="$(gh search prs --author "$ME" --state open --limit "$MAX" --json repository,number,title,updatedAt \
|
|
82
95
|
--jq '.[] | [.repository.nameWithOwner, (.number | tostring), .updatedAt, .title] | @tsv' | sort)"; then
|
|
@@ -136,7 +149,7 @@ $id"
|
|
|
136
149
|
head_branch="$(printf '%s' "$v" | jq -r '.headRefName // "-"' | tr -d '\r')"
|
|
137
150
|
head_oid="$(printf '%s' "$v" | jq -r '.headRefOid // "-"' | tr -d '\r')"
|
|
138
151
|
gone_state="$(printf '%s' "$v" | jq -r '.state // "-"' | tr -d '\r')"
|
|
139
|
-
if [ "$gone_state" != OPEN ] && [ "$head_owner" = "$
|
|
152
|
+
if [ "$gone_state" != OPEN ] && [ "$(lower "$head_owner")" = "$me" ] && [ "$(lower "$gone_repo")" != "$me/$(lower "$head_fork")" ] && [ "$head_branch" != "-" ]; then
|
|
140
153
|
tidy="$(printf '%s\n%s\n' "$tidy" "$ME/$head_fork $head_branch $id $head_oid")"
|
|
141
154
|
fi
|
|
142
155
|
case "$gone_state" in
|
|
@@ -205,7 +218,8 @@ if ! jq -n --arg t "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
|
|
|
205
218
|
exit 1
|
|
206
219
|
fi
|
|
207
220
|
|
|
208
|
-
|
|
221
|
+
home="${HOUSEBROKEN_HOME:-$HOME/.housebroken}"
|
|
222
|
+
n=0; act=0; nread=0; reads=""
|
|
209
223
|
while IFS=$'\t' read -r repo num updated title; do
|
|
210
224
|
[ -n "$repo" ] || continue
|
|
211
225
|
n=$((n + 1))
|
|
@@ -221,17 +235,40 @@ while IFS=$'\t' read -r repo num updated title; do
|
|
|
221
235
|
| sort_by(.t) | last | "\(.a // "-") \(.t // "-") \(.r // "-")"')"
|
|
222
236
|
read -r la_user la_time la_role <<<"$last_actor"
|
|
223
237
|
ci="$(printf '%s' "$j" | jq -r "$ci_jq"'[.statusCheckRollup[]?] | if length == 0 then "none" elif any(.[]; ci == "red" and check_state != "ACTION_REQUIRED") then "FAILING" elif any(.[]; check_state == "ACTION_REQUIRED") then "needs-approval" elif any(.[]; ci == "running") then "pending" else "green" end')"
|
|
238
|
+
head_oid="$(printf '%s' "$j" | jq -r '.headRefOid // ""' | tr -d '\r')"
|
|
224
239
|
# An empty check list is a quiet repository or a head GitHub made no run for.
|
|
225
240
|
if [ "$ci" = "none" ]; then
|
|
226
|
-
ci="$(empty_rollup_reading "$repo" "$
|
|
241
|
+
ci="$(empty_rollup_reading "$repo" "$head_oid")"
|
|
227
242
|
[ "$ci" = "needs-run-approval" ] && ci="needs-approval"
|
|
228
243
|
fi
|
|
244
|
+
# A gate reads a pull request when it is pushed, so one filed before a review
|
|
245
|
+
# item existed is never read under it. The reports are this machine's, and a
|
|
246
|
+
# pull request in a repository of our own never went through the door.
|
|
247
|
+
if [ "$(lower "${repo%%/*}")" != "$me" ]; then
|
|
248
|
+
mark=""
|
|
249
|
+
if [ -z "$head_oid" ]; then
|
|
250
|
+
mark="head-unread"
|
|
251
|
+
else
|
|
252
|
+
under="$(reviewed_under "$repo" "$head_oid" "$home")"
|
|
253
|
+
if [ -z "$under" ]; then mark="no-review-of-head"
|
|
254
|
+
elif [ "$under" = unreadable ]; then mark="review-report-unreadable"
|
|
255
|
+
elif [ "$under" -eq 0 ]; then mark="reviewed-under-an-unnumbered-brief"
|
|
256
|
+
elif [ "$under" -lt "$review_brief_items" ]; then mark="reviewed-under-brief-$under-of-$review_brief_items"
|
|
257
|
+
fi
|
|
258
|
+
[ -z "$mark" ] || mark="$mark ${head_oid:0:12}"
|
|
259
|
+
fi
|
|
260
|
+
if [ -n "$mark" ]; then
|
|
261
|
+
nread=$((nread + 1))
|
|
262
|
+
reads="$reads$(printf 'READ %-38s #%-5s %s [%s] %s' "$repo" "$num" "${title:0:60}" "$mark" "https://github.com/$repo/pull/$num")
|
|
263
|
+
"
|
|
264
|
+
fi
|
|
265
|
+
fi
|
|
229
266
|
mergeable="$(printf '%s' "$j" | jq -r '.mergeable // "-"')"
|
|
230
267
|
decision="$(printf '%s' "$j" | jq -r '.reviewDecision // "-"')"
|
|
231
268
|
why=""
|
|
232
269
|
# The role is GitHub's word on who spoke last: a maintainer is answered, an
|
|
233
270
|
# outsider is read, and the desk should know which before it drafts.
|
|
234
|
-
[ "$la_user" != "-" ] && [ "$la_user" != "$
|
|
271
|
+
[ "$la_user" != "-" ] && [ "$(lower "$la_user")" != "$me" ] && why="$why last-word:$la_user@${la_time:0:10} role:$(printf '%s' "$la_role" | tr '[:upper:]' '[:lower:]')"
|
|
235
272
|
[ "$decision" = "CHANGES_REQUESTED" ] && why="$why changes-requested"
|
|
236
273
|
[ "$ci" = "FAILING" ] && why="$why ci-failing"
|
|
237
274
|
[ "$ci" = "no-ci-on-head" ] && why="$why no-ci-on-head"
|
|
@@ -256,7 +293,12 @@ while IFS=$'\t' read -r repo num updated title; do
|
|
|
256
293
|
printf 'ok %-38s #%-5s %s ci=%s mergeable=%s updated=%s\n' "$repo" "$num" "${title:0:60}" "$ci" "$mergeable" "${updated:0:10}"
|
|
257
294
|
fi
|
|
258
295
|
done <<< "$list"
|
|
296
|
+
if [ "$nread" -gt 0 ] && [ "$ALL" = 1 ]; then
|
|
297
|
+
echo "--- no review of the head under the current brief ($review_brief_items items) on this machine"
|
|
298
|
+
printf '%s' "$reads"
|
|
299
|
+
fi
|
|
259
300
|
echo "open PRs: $n; needing action: $act"
|
|
301
|
+
[ "$nread" -gt 0 ] && echo "not read under the current review brief: $nread of $n (housebroken sweep --all names them)"
|
|
260
302
|
[ "$ntidy" -gt 0 ] && echo "fork branches to tidy: $ntidy (housebroken hygiene)"
|
|
261
303
|
if [ "$unreadable" -gt 0 ]; then
|
|
262
304
|
echo "SWEEP UNREADABLE: $unreadable pull request(s) could not be read, so their state is unknown, not clean" >&2
|
|
@@ -78,11 +78,11 @@ patch_id() { # head
|
|
|
78
78
|
reviews="$home/reviews/review-${repo%%/*}-${repo##*/}"
|
|
79
79
|
review="$reviews-${head:0:12}.md"
|
|
80
80
|
if [ -f "$review" ]; then
|
|
81
|
-
bash "$here/review.sh" check "$review" --clone . >/dev/null || exit 2
|
|
81
|
+
bash "$here/review.sh" check "$review" --clone . --repo "$repo" >/dev/null || exit 2
|
|
82
82
|
else
|
|
83
83
|
old="$reviews-${theirs:0:12}.md"
|
|
84
84
|
if [ -f "$old" ] && [ "$(patch_id "$head")" = "$(patch_id "$theirs")" ] && [ -n "$(patch_id "$head")" ] \
|
|
85
|
-
&& grep -q "^head: $theirs" "$old" && bash "$here/review.sh" check "$old" >/dev/null 2>&1; then
|
|
85
|
+
&& grep -q "^head: $theirs" "$old" && bash "$here/review.sh" check "$old" --repo "$repo" >/dev/null 2>&1; then
|
|
86
86
|
echo "note: the patch is unchanged since ${theirs:0:12}, so the review of ${theirs:0:12} holds for ${head:0:12}: $old" >&2
|
|
87
87
|
else
|
|
88
88
|
refused push-head-not-reviewed "no review of head ${head:0:12} at $review (a rebase carries the review of ${theirs:0:12} only when both heads are stamped and the patch is unchanged)" >&2
|
|
@@ -58,13 +58,13 @@ repo="${1:-}"; num="${2:-}"
|
|
|
58
58
|
case "$repo" in */*) ;; *) refused reply-repo-form "name the repository as owner/repo" >&2; exit 2 ;; esac
|
|
59
59
|
case "$num" in ''|*[!0-9]*) refused reply-no-number "name the pull request or issue number" >&2; exit 2 ;; esac
|
|
60
60
|
shift 2
|
|
61
|
-
body=""; report=""; long=0; clone=""; thread=""; outsider=0
|
|
61
|
+
body=""; report=""; long=0; clone=""; thread=""; inline=0; outsider=0
|
|
62
62
|
while [ "$#" -gt 0 ]; do
|
|
63
63
|
case "$1" in
|
|
64
64
|
--body-file) body="${2:-}"; shift ;;
|
|
65
65
|
--review) report="${2:-}"; shift ;;
|
|
66
66
|
--clone) clone="${2:-}"; shift ;;
|
|
67
|
-
--in-reply-to) thread="${2:-}"; shift ;;
|
|
67
|
+
--in-reply-to) thread="${2:-}"; inline=1; shift ;;
|
|
68
68
|
--long) long=1 ;;
|
|
69
69
|
--outsider) outsider=1 ;;
|
|
70
70
|
*) refused reply-unknown-argument "unknown argument $1" >&2; exit 2 ;;
|
|
@@ -72,7 +72,10 @@ while [ "$#" -gt 0 ]; do
|
|
|
72
72
|
shift
|
|
73
73
|
done
|
|
74
74
|
[ -f "$body" ] || { refused reply-body-file-missing "--body-file names no file" >&2; exit 2; }
|
|
75
|
-
|
|
75
|
+
# The id is digits and nothing else, and the flag with no id is not a reply to the conversation.
|
|
76
|
+
if [ "$inline" -eq 1 ]; then
|
|
77
|
+
case "$thread" in ''|*[!0-9]*) refused reply-in-reply-to-form "--in-reply-to needs the comment id" >&2; exit 2 ;; esac
|
|
78
|
+
fi
|
|
76
79
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
77
80
|
# shellcheck source=scripts/common.sh
|
|
78
81
|
. "$here/common.sh"
|
|
@@ -94,7 +97,7 @@ if ! refs=$(bash "$here/ref-check.sh" "${refargs[@]}" 2>&1); then
|
|
|
94
97
|
refuse reply-reference-not-found "it names something that does not exist: $(printf '%s\n' "$refs" | grep 'NOT FOUND' | tr -s ' ' | tr '\n' ';')"
|
|
95
98
|
fi
|
|
96
99
|
if [ -n "$report" ]; then
|
|
97
|
-
checked=$(bash "$here/review.sh" check "$report" --text "$body" 2>&1) || refuse reply-review-not-clear "the review does not clear this text: $checked"
|
|
100
|
+
checked=$(bash "$here/review.sh" check "$report" --text "$body" --repo "$repo" 2>&1) || refuse reply-review-not-clear "the review does not clear this text: $checked"
|
|
98
101
|
fi
|
|
99
102
|
|
|
100
103
|
# Whom this answers. One thread read, every page, into a file: a long thread
|
|
@@ -108,11 +111,10 @@ read_all() { # endpoint file
|
|
|
108
111
|
}
|
|
109
112
|
voice=""
|
|
110
113
|
if [ -n "$thread" ]; then
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
fi
|
|
114
|
+
# An answer that is not the comment leaves no voice, and no voice is not nobody to answer.
|
|
115
|
+
one=$(gh api "repos/$repo/pulls/comments/$thread" 2>/dev/null) &&
|
|
116
|
+
voice=$(printf '%s' "$one" | jq -r 'select(type == "object" and (.user.login | type) == "string") | "\(.user.login) \(.author_association // "?")"' 2>/dev/null | tr -d '\r')
|
|
117
|
+
[ -n "$voice" ] || refuse reply-comment-unreadable "cannot read comment $thread, so who it answers is unknown"
|
|
116
118
|
else
|
|
117
119
|
ok=1
|
|
118
120
|
# The opening post says whether this is a pull request, and its author is a
|
|
@@ -134,7 +136,7 @@ else
|
|
|
134
136
|
($ic[0][] | {t: .created_at, who: .user.login, type: .user.type, r: .author_association}),
|
|
135
137
|
($rv[0][] | {t: .submitted_at, who: .user.login, type: .user.type, r: .author_association}),
|
|
136
138
|
($rc[0][] | {t: .created_at, who: .user.login, type: .user.type, r: .author_association}) ]
|
|
137
|
-
| map(select(.who != null and .who != $me and (.type // "") != "Bot")) | sort_by(.t) | reverse
|
|
139
|
+
| map(select(.who != null and (.who | ascii_downcase) != ($me | ascii_downcase) and (.type // "") != "Bot")) | sort_by(.t) | reverse
|
|
138
140
|
| .[] | "\(.who) \(.r // "?")"' | tr -d '\r')
|
|
139
141
|
while IFS= read -r v; do
|
|
140
142
|
[ -n "$v" ] || continue
|
|
@@ -17,14 +17,17 @@
|
|
|
17
17
|
# The report is bound to what it read. Its header records the head it attacked
|
|
18
18
|
# and the sha256 of every text, and check refuses when the branch or the text
|
|
19
19
|
# has moved since, or when the verdict is anything but POST AS IS: a fix the
|
|
20
|
-
# reviewer asked for is a new head, and a new head is reviewed again.
|
|
20
|
+
# reviewer asked for is a new head, and a new head is reviewed again. The
|
|
21
|
+
# header also records the brief it answers, by the number of the last item in
|
|
22
|
+
# a code review's brief, and `housebroken sweep` counts every open pull request
|
|
23
|
+
# whose head was never read under the current one; `sweep --all` names them.
|
|
21
24
|
#
|
|
22
25
|
# Usage:
|
|
23
26
|
# bash review.sh reviewer MODEL
|
|
24
27
|
# bash review.sh brief --author MODEL --repo owner/repo [--reviewer MODEL]
|
|
25
28
|
# [--clone DIR [--base REF]] [--text FILE]...
|
|
26
29
|
# [--context FILE]...
|
|
27
|
-
# bash review.sh check REPORT [--clone DIR] [--text FILE]...
|
|
30
|
+
# bash review.sh check REPORT [--clone DIR] [--text FILE]... [--repo owner/repo]
|
|
28
31
|
# bash review.sh --help
|
|
29
32
|
#
|
|
30
33
|
# reviewer prints the model that reviews work written by MODEL.
|
|
@@ -34,7 +37,8 @@
|
|
|
34
37
|
# keyed by the clone's head, or by the first text's sha256 when there
|
|
35
38
|
# is no clone.
|
|
36
39
|
# check exits 0 when REPORT may gate a filing or a reply, 1 when it may
|
|
37
|
-
# not, with the reason on stderr, and 2 on a usage error.
|
|
40
|
+
# not, with the reason on stderr, and 2 on a usage error. With
|
|
41
|
+
# --repo, the report's review-of line must name that repository.
|
|
38
42
|
#
|
|
39
43
|
# Environment:
|
|
40
44
|
# HOUSEBROKEN_HOME work directory, default $HOME/.housebroken.
|
|
@@ -50,6 +54,8 @@ bad_usage() { echo "review.sh: $1" >&2; exit 2; }
|
|
|
50
54
|
|
|
51
55
|
home="${HOUSEBROKEN_HOME:-$HOME/.housebroken}"
|
|
52
56
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
57
|
+
# shellcheck source=scripts/common.sh
|
|
58
|
+
. "$here/common.sh"
|
|
53
59
|
|
|
54
60
|
# A name that mentions two families, such as "claude-haiku-4-5 (sonnet
|
|
55
61
|
# floor)", belongs to neither, so it cannot pass as the one named second.
|
|
@@ -250,6 +256,8 @@ EOF
|
|
|
250
256
|
printf 'text: sha256:%s %s\n' "$(sha256 "$t")" "$(basename "$t")"
|
|
251
257
|
done
|
|
252
258
|
printf 'author-model: %s\nreviewer-model: %s\n' "$author" "$reviewer"
|
|
259
|
+
# which brief this report answers, so the sweep can name a head read under an earlier one
|
|
260
|
+
printf 'brief: %s\n' "$review_brief_items"
|
|
253
261
|
[ -n "$head" ] && printf 'blind-fix: %s\n' "$blind"
|
|
254
262
|
printf 'skipped: none | <the item numbers you did not attack, each with why>\n'
|
|
255
263
|
printf 'verdict: POST AS IS | POST WITH CHANGES | DO NOT POST\n\n'
|
|
@@ -259,7 +267,7 @@ EOF
|
|
|
259
267
|
}
|
|
260
268
|
|
|
261
269
|
cmd_check() {
|
|
262
|
-
local report="${1:-}" clone="" t
|
|
270
|
+
local report="${1:-}" clone="" repo="" t
|
|
263
271
|
local texts=()
|
|
264
272
|
[ -n "$report" ] || bad_usage "check needs the report path"
|
|
265
273
|
shift
|
|
@@ -267,6 +275,10 @@ cmd_check() {
|
|
|
267
275
|
case "$1" in
|
|
268
276
|
--clone) clone="${2:-}"; shift ;;
|
|
269
277
|
--text) texts+=("${2:-}"); shift ;;
|
|
278
|
+
--repo)
|
|
279
|
+
repo="${2:-}"
|
|
280
|
+
case "$repo" in */*) ;; *) bad_usage "check --repo needs owner/repo" ;; esac
|
|
281
|
+
shift ;;
|
|
270
282
|
*) bad_usage "unknown argument: $1" ;;
|
|
271
283
|
esac
|
|
272
284
|
shift
|
|
@@ -284,6 +296,14 @@ cmd_check() {
|
|
|
284
296
|
reviewer=$(field reviewer-model)
|
|
285
297
|
verdict=$(field verdict | tr '[:lower:]' '[:upper:]')
|
|
286
298
|
head=$(field head)
|
|
299
|
+
# Two repositories can share a report name (a-b/c and a/b-c), so the report
|
|
300
|
+
# clears only the repository it says it reviewed.
|
|
301
|
+
if [ -n "$repo" ]; then
|
|
302
|
+
local of
|
|
303
|
+
of=$(field review-of)
|
|
304
|
+
[ "$(lower "$of")" = "$(lower "$repo")" ] ||
|
|
305
|
+
refuse review-other-repository "$report is a review of ${of:-no repository}, not of $repo: its review-of line names the repository it read"
|
|
306
|
+
fi
|
|
287
307
|
[ -n "$author" ] || refuse review-no-author-model "$report names no author-model in its header, the lines above the first blank line"
|
|
288
308
|
why=$(objection "$(family "$author")" "$(family "$reviewer")")
|
|
289
309
|
[ -z "$why" ] || { refused_reason "$why" >&2; exit 1; }
|
|
@@ -331,7 +331,14 @@ report it in one line and do not proceed to the next step.
|
|
|
331
331
|
pull request whose fork branch still exists, on every run until
|
|
332
332
|
`housebroken hygiene` has deleted it; a branch that moved past the head
|
|
333
333
|
its pull request held is other work, which hygiene keeps, so `sweep`
|
|
334
|
-
prints one `KEPT` line for it and stops asking.
|
|
334
|
+
prints one `KEPT` line for it and stops asking. A gate reads a pull
|
|
335
|
+
request when it is pushed, so one filed before a review item existed was
|
|
336
|
+
never read under it: `sweep` counts the open pull requests whose head
|
|
337
|
+
this machine holds no review report for under the current brief, on
|
|
338
|
+
every run, and `sweep --all` names each on a `READ` line, until
|
|
339
|
+
`housebroken review` has been run on that head and its report written.
|
|
340
|
+
The count is a prompt to re-read old work, not a maintainer waiting;
|
|
341
|
+
which ones to re-read first is the user's call. Both `sweep` and the inbox census
|
|
335
342
|
name two states that look quiet. A head no CI job ever started on reads
|
|
336
343
|
`no-ci-on-head` when GitHub made no run for it and `ci-never-started`
|
|
337
344
|
when the run it made finished without one. A new push or a close and
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.24.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.22.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|