mirror of
https://github.com/anthropics/claude-code.git
synced 2026-05-21 02:52:42 +00:00
Use gh.sh wrapper for all gh commands in triage and dedupe workflows
This commit is contained in:
43
scripts/gh.sh
Executable file
43
scripts/gh.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Wrapper around gh CLI that only allows specific subcommands and flags.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/gh.sh issue view 123
|
||||
# ./scripts/gh.sh issue view 123 --comments
|
||||
# ./scripts/gh.sh issue list --state open --limit 20
|
||||
# ./scripts/gh.sh search issues "search query" --limit 10
|
||||
# ./scripts/gh.sh label list --limit 100
|
||||
|
||||
ALLOWED_FLAGS=(--comments --state --limit --label)
|
||||
|
||||
SUB1="${1:-}"
|
||||
SUB2="${2:-}"
|
||||
CMD="$SUB1 $SUB2"
|
||||
case "$CMD" in
|
||||
"issue view"|"issue list"|"search issues"|"label list")
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
shift 2
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" == -* ]]; then
|
||||
flag="${arg%%=*}"
|
||||
matched=false
|
||||
for allowed in "${ALLOWED_FLAGS[@]}"; do
|
||||
if [[ "$flag" == "$allowed" ]]; then
|
||||
matched=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ "$matched" == false ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
gh "$SUB1" "$SUB2" "$@"
|
||||
Reference in New Issue
Block a user