spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

Use gh.sh wrapper for all gh commands in triage and dedupe workflowsBrowse files
Octavian Guzu authored on Feb 25, 2026 parent 3c917df · commit cebbc4f721ac
3 changed files+65 -14compared with 3c917df
M.claude/commands/dedupe.md
M.claude/commands/triage-issue.md
Ascripts/gh.sh
@@ -1,5 +1,5 @@
11 ---
2-allowed-tools: Bash(gh issue view:*), Bash(gh search:*), Bash(gh issue list:*), Bash(./scripts/comment-on-duplicates.sh:*)
2+allowed-tools: Bash(./scripts/gh.sh:*), Bash(./scripts/comment-on-duplicates.sh:*)
33 description: Find duplicate GitHub issues
44 ---
55
@@ -18,6 +18,10 @@
1818
1919 Notes (be sure to tell this to your agents, too):
2020
21-- Use `gh` to interact with Github, rather than web fetch
22-- Do not use other tools, beyond `gh` and the comment script (eg. don't use other MCP servers, file edit, etc.)
21+- Use `./scripts/gh.sh` to interact with Github, rather than web fetch or raw `gh`. Examples:
22+ - `./scripts/gh.sh issue view 123` — view an issue
23+ - `./scripts/gh.sh issue view 123 --comments` — view with comments
24+ - `./scripts/gh.sh issue list --state open --limit 20` — list issues
25+ - `./scripts/gh.sh search issues "query" --limit 10` — search for issues
26+- Do not use other tools, beyond `./scripts/gh.sh` and the comment script (eg. don't use other MCP servers, file edit, etc.)
2327 - Make a todo list first
@@ -1,5 +1,5 @@
11 ---
2-allowed-tools: Bash(gh label list:*),Bash(gh issue view:*),Bash(./scripts/edit-issue-labels.sh:*),Bash(gh search issues:*)
2+allowed-tools: Bash(./scripts/gh.sh:*),Bash(./scripts/edit-issue-labels.sh:*)
33 description: Triage GitHub issues by analyzing and applying labels
44 ---
55
@@ -12,17 +12,21 @@
1212 $ARGUMENTS
1313
1414 TOOLS:
15-- `gh label list`: Fetch all available labels in this repo
16-- `gh issue view NUMBER`: Read the issue title, body, and labels
17-- `gh issue view NUMBER --comments`: Read the conversation
18-- `gh search issues QUERY`: Find similar or duplicate issues
19-- `./scripts/edit-issue-labels.sh --issue NUMBER --add-label LABEL --remove-label LABEL`: Add or remove labels
15+- `./scripts/gh.sh` — wrapper for `gh` CLI. Only supports these subcommands and flags:
16+ - `./scripts/gh.sh label list` — fetch all available labels
17+ - `./scripts/gh.sh label list --limit 100` — fetch with limit
18+ - `./scripts/gh.sh issue view 123` — read issue title, body, and labels
19+ - `./scripts/gh.sh issue view 123 --comments` — read the conversation
20+ - `./scripts/gh.sh issue list --state open --limit 20` — list issues
21+ - `./scripts/gh.sh search issues "query"` — find similar or duplicate issues
22+ - `./scripts/gh.sh search issues "query" --limit 10` — search with limit
23+- `./scripts/edit-issue-labels.sh --issue NUMBER --add-label LABEL --remove-label LABEL` — add or remove labels
2024
2125 TASK:
2226
23-1. Run `gh label list` to fetch the available labels. You may ONLY use labels from this list. Never invent new labels.
24-2. Run `gh issue view ISSUE_NUMBER` to read the issue details.
25-3. Run `gh issue view ISSUE_NUMBER --comments` to read the conversation.
27+1. Run `./scripts/gh.sh label list` to fetch the available labels. You may ONLY use labels from this list. Never invent new labels.
28+2. Run `./scripts/gh.sh issue view ISSUE_NUMBER` to read the issue details.
29+3. Run `./scripts/gh.sh issue view ISSUE_NUMBER --comments` to read the conversation.
2630
2731 **If EVENT is "issues" (new issue):**
2832
@@ -31,7 +35,7 @@
3135 5. Analyze and apply category labels:
3236 - Type (bug, enhancement, question, etc.)
3337 - Technical areas and platform
34- - Check for duplicates with `gh search issues`. Only mark as duplicate of OPEN issues.
38+ - Check for duplicates with `./scripts/gh.sh search issues`. Only mark as duplicate of OPEN issues.
3539
3640 6. Evaluate lifecycle labels:
3741 - `needs-repro` (bugs only, 7 days): Bug reports without clear steps to reproduce. A good repro has specific, followable steps that someone else could use to see the same issue.
@@ -58,7 +62,7 @@
5862 - Do NOT add or remove category labels (bug, enhancement, etc.) on comment events.
5963
6064 GUIDELINES:
61-- ONLY use labels from `gh label list` — never create or guess label names
65+- ONLY use labels from `./scripts/gh.sh label list` — never create or guess label names
6266 - DO NOT post any comments to the issue
6367 - Be conservative with lifecycle labels — only apply when clearly warranted
6468 - Only apply lifecycle labels (`needs-repro`, `needs-info`) to bugs — never to questions or enhancements
@@ -1,0 +1,43 @@
1+#!/usr/bin/env bash
2+set -euo pipefail
3+
4+# Wrapper around gh CLI that only allows specific subcommands and flags.
5+#
6+# Usage:
7+# ./scripts/gh.sh issue view 123
8+# ./scripts/gh.sh issue view 123 --comments
9+# ./scripts/gh.sh issue list --state open --limit 20
10+# ./scripts/gh.sh search issues "search query" --limit 10
11+# ./scripts/gh.sh label list --limit 100
12+
13+ALLOWED_FLAGS=(--comments --state --limit --label)
14+
15+SUB1="${1:-}"
16+SUB2="${2:-}"
17+CMD="$SUB1 $SUB2"
18+case "$CMD" in
19+ "issue view"|"issue list"|"search issues"|"label list")
20+ ;;
21+ *)
22+ exit 1
23+ ;;
24+esac
25+
26+shift 2
27+for arg in "$@"; do
28+ if [[ "$arg" == -* ]]; then
29+ flag="${arg%%=*}"
30+ matched=false
31+ for allowed in "${ALLOWED_FLAGS[@]}"; do
32+ if [[ "$flag" == "$allowed" ]]; then
33+ matched=true
34+ break
35+ fi
36+ done
37+ if [[ "$matched" == false ]]; then
38+ exit 1
39+ fi
40+ fi
41+done
42+
43+gh "$SUB1" "$SUB2" "$@"