chore: improve tooling quality and docs

- close_issue.sh: add set -euo pipefail, argument validation, confirmation output
- mark_issue.sh: track previously untracked claim/release script
- create_pr.sh: remove hardcoded one-off (use create_pr.py instead)
- README.md: reflect current toolset with usage examples
- .gitignore: ignore venv/ and __pycache__/
This commit is contained in:
2026-06-21 17:11:44 -04:00
parent d3659534ef
commit 7404f768d3
5 changed files with 104 additions and 29 deletions
Executable
+50
View File
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Claim or release a Gitea issue by toggling the `status:in-progress` label, so
# parallel agents/LLMs don't pick up the same issue.
#
# Usage:
# ./mark_issue.sh <issue_number> # claim (adds status:in-progress)
# ./mark_issue.sh <issue_number> start # claim
# ./mark_issue.sh <issue_number> done # release (removes the label)
#
# Auth: macOS keychain via `git credential fill` (same as the other scripts).
set -euo pipefail
HOST="gitea.dadeschools.net"
API="https://$HOST/api/v1"
ORG="Contractor"
REPO="Timesheet"
LABEL="status:in-progress"
NUM="${1:?usage: mark_issue.sh <issue_number> [start|done]}"
ACTION="${2:-start}"
CREDS=$(printf "host=%s\nprotocol=https\n\n" "$HOST" | git credential fill)
USER=$(printf '%s\n' "$CREDS" | sed -n 's/^username=//p')
PASS=$(printf '%s\n' "$CREDS" | sed -n 's/^password=//p')
AUTH=(-u "$USER:$PASS")
# Resolve the label name -> id (Gitea's issue label endpoints take ids).
LID=$(curl -sSL "${AUTH[@]}" "$API/repos/$ORG/$REPO/labels?limit=100" \
| python3 -c "import sys,json;print(next((l['id'] for l in json.load(sys.stdin) if l['name']=='$LABEL'),''))")
if [ -z "$LID" ]; then
echo "Label '$LABEL' not found in $ORG/$REPO -- run manage_labels.py first." >&2
exit 1
fi
case "$ACTION" in
start)
curl -sSL -X POST "${AUTH[@]}" -H "Content-Type: application/json" \
-d "{\"labels\":[$LID]}" "$API/repos/$ORG/$REPO/issues/$NUM/labels" >/dev/null
echo "#$NUM claimed -> $LABEL"
;;
done)
curl -sSL -X DELETE "${AUTH[@]}" \
"$API/repos/$ORG/$REPO/issues/$NUM/labels/$LID" >/dev/null
echo "#$NUM released -> $LABEL removed"
;;
*)
echo "Unknown action '$ACTION' (expected: start | done)" >&2
exit 1
;;
esac