refactor: 將 herdr-issue 併入 herdr 外掛並改名為 gitea-issue
指令由 /herdr-issue:herdr-issue 改為 /herdr:gitea-issue,herdr 升至 0.0.2。 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
c61a502220
commit
64c748922b
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"name": "herdr-issue",
|
||||
"version": "0.0.1",
|
||||
"description": "透過 Herdr 讓 Claude agent 逐一實作 Gitea 議題(每個議題一個 worktree 與 tab)",
|
||||
"license": "MIT",
|
||||
"skills": "./skills",
|
||||
"author": {
|
||||
"name": "JSC"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "herdr",
|
||||
"version": "0.0.1",
|
||||
"description": "控制 Herdr 終端多工器(workspace、tab、pane、指令與其他 agent)的技能",
|
||||
"version": "0.0.2",
|
||||
"description": "控制 Herdr 終端多工器(workspace、tab、pane、指令與其他 agent),並可透過 gitea-issue 技能逐一實作 Gitea 議題",
|
||||
"license": "MIT",
|
||||
"skills": "./skills",
|
||||
"author": {
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
---
|
||||
name: herdr-issue
|
||||
description: "Run Gitea issues through Herdr: one Claude agent per issue in its own worktree and tab, watch the issue to closure, then offer the next unblocked issues. Use only when the user runs /herdr-issue or explicitly asks to drive a Gitea issue or repo link with Herdr."
|
||||
name: gitea-issue
|
||||
description: "Run Gitea issues through Herdr: one Claude agent per issue in its own worktree and tab, watch the issue to closure, then offer the next unblocked issues. Use only when the user runs /herdr:gitea-issue or explicitly asks to drive a Gitea issue or repo link with Herdr."
|
||||
---
|
||||
|
||||
# herdr-issue
|
||||
# gitea-issue
|
||||
|
||||
把 Gitea 議題交給 Herdr 裡的 Claude agent 實作。所有確定性的工作都在 `scripts/` 裡,你只在「要做決定」的時刻出手。腳本都要在該 repo 的 clone 裡執行;`S` 代表 `~/.claude/skills/herdr-issue/scripts`。
|
||||
把 Gitea 議題交給 Herdr 裡的 Claude agent 實作。所有確定性的工作都在 `scripts/` 裡,你只在「要做決定」的時刻出手。腳本都要在該 repo 的 clone 裡執行;`S` 代表 `~/.claude/skills/gitea-issue/scripts`。
|
||||
|
||||
## 使用者身分
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# herdr-issue 共用函式。每個腳本都 source 這個檔。
|
||||
# gitea-issue 共用函式。每個腳本都 source 這個檔。
|
||||
set -euo pipefail
|
||||
|
||||
LABEL="in-progress"
|
||||
@@ -9,7 +9,7 @@ INTERVAL="${HERDR_ISSUE_INTERVAL:-300}"
|
||||
MODEL="${HERDR_ISSUE_MODEL:-claude-sonnet-5-5}"
|
||||
SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
die() { echo "herdr-issue: $*" >&2; exit 1; }
|
||||
die() { echo "gitea-issue: $*" >&2; exit 1; }
|
||||
|
||||
# tea 的預設使用者。在 clone 裡 tea 會依 remote URL 挑第一個符合的 login(可能不是預設的),
|
||||
# 所以明確取 default 那個 login,所有 tea 呼叫都加 --login。可用 HERDR_ISSUE_LOGIN 覆寫。
|
||||
@@ -17,7 +17,7 @@ if [ -z "${HERDR_ISSUE_LOGIN:-}" ]; then
|
||||
HERDR_ISSUE_LOGIN="$(tea login list --output json | python3 -c "import sys,json
|
||||
print(next((l['name'] for l in json.load(sys.stdin) if str(l.get('default')).lower()=='true'),''))")"
|
||||
fi
|
||||
[ -n "$HERDR_ISSUE_LOGIN" ] || { echo "herdr-issue: tea 沒有預設 login,請先 tea login default <name>" >&2; exit 1; }
|
||||
[ -n "$HERDR_ISSUE_LOGIN" ] || { echo "gitea-issue: tea 沒有預設 login,請先 tea login default <name>" >&2; exit 1; }
|
||||
export HERDR_ISSUE_LOGIN
|
||||
|
||||
# 忽略所有 TLS 檢查:tea 的 insecure 只能寫在設定檔(沒有環境變數),所以把所有 login 設成 insecure: true(冪等);
|
||||
@@ -39,7 +39,7 @@ tea() {
|
||||
out="$(command tea "$1" --login "$HERDR_ISSUE_LOGIN" "${@:2}" 2>"$ef")" && rc=0 || rc=$?
|
||||
err="$(cat "$ef")"
|
||||
if [ "$rc" -eq 0 ] || ! grep -qiE 'tls|x509|certificate|handshake' <<<"$out$err"; then break; fi
|
||||
echo "herdr-issue: tea 遇到 TLS/憑證錯誤(第 $try/$max 次),3 秒後重試" >&2
|
||||
echo "gitea-issue: tea 遇到 TLS/憑證錯誤(第 $try/$max 次),3 秒後重試" >&2
|
||||
rc=${rc/#0/1}; sleep 3
|
||||
done
|
||||
rm -f "$ef"
|
||||
@@ -125,7 +125,7 @@ raw=sys.stdin.read()
|
||||
try: d=json.loads(raw)
|
||||
except Exception: d=None
|
||||
if not isinstance(d,list):
|
||||
sys.stderr.write('herdr-issue: 讀取 #$2 的依賴失敗:'+raw.strip()[:300]+'\n'); sys.exit(1)
|
||||
sys.stderr.write('gitea-issue: 讀取 #$2 的依賴失敗:'+raw.strip()[:300]+'\n'); sys.exit(1)
|
||||
for i in d:
|
||||
if i.get('state')=='open':
|
||||
r=(i.get('repository') or {}).get('full_name','')
|
||||
+1
-1
@@ -38,7 +38,7 @@ def open_blockers(n):
|
||||
try: d = json.loads(raw)
|
||||
except Exception: d = None
|
||||
if not isinstance(d, list):
|
||||
sys.exit(f"herdr-issue: 讀取 #{n} 的依賴失敗:{raw.strip()[:300]}")
|
||||
sys.exit(f"gitea-issue: 讀取 #{n} 的依賴失敗:{raw.strip()[:300]}")
|
||||
out = []
|
||||
for i in d:
|
||||
if i.get("state") != "open": continue
|
||||
+1
-1
@@ -77,7 +77,7 @@ PROMPT_ERR="$(mktemp)"
|
||||
if PROMPT_OUT="$(herdr agent prompt "issue-$N" "$PROMPT" --wait --until working --until blocked --timeout 15000 2>"$PROMPT_ERR")"; then
|
||||
rm -f "$PROMPT_ERR"
|
||||
else
|
||||
echo "herdr-issue: 送出提示詞後 agent 沒有反應,已回滾" >&2
|
||||
echo "gitea-issue: 送出提示詞後 agent 沒有反應,已回滾" >&2
|
||||
cat "$PROMPT_ERR" >&2; rm -f "$PROMPT_ERR"
|
||||
rollback
|
||||
exit 1
|
||||
+1
-1
@@ -16,7 +16,7 @@ NOTIFIED=false
|
||||
close_if_done() { # $1=X $2=label
|
||||
[ "$(issue_state "$REPO" "$1")" = open ] || { echo skip; return; }
|
||||
if [ "$(open_count_with_label "$REPO" "$2")" = 0 ]; then
|
||||
tea comment "$1" --repo "$REPO" "底下的議題全部關閉,由 herdr-issue 自動關閉。" >/dev/null
|
||||
tea comment "$1" --repo "$REPO" "底下的議題全部關閉,由 gitea-issue 自動關閉。" >/dev/null
|
||||
tea issues close "$1" --repo "$REPO" >/dev/null
|
||||
echo closed
|
||||
else
|
||||
Reference in New Issue
Block a user