From 8cef79455739ff98b5f79d143a930adbc963f751 Mon Sep 17 00:00:00 2001 From: AI Review Bot Date: Fri, 15 May 2026 16:18:42 +0000 Subject: [PATCH] chore: update ai-review findings [ai-review-bot][failure] --- .amazonq/rules/triage-findings.md | 14 +++ .claude/skills/triage-findings/SKILL.md | 29 +++++ .codex/skills/triage-findings/SKILL.md | 45 ++++++++ .../skills/triage-findings/agents/openai.yaml | 4 + .gemini/skills/triage-findings/SKILL.md | 29 +++++ .gitea/ai-review/findings.json | 100 ++++++++++++++++++ .github/copilot-instructions.md | 14 +++ .github/skills/triage-findings/SKILL.md | 14 +++ CLAUDE.md | 16 +++ GEMINI.md | 14 +++ 10 files changed, 279 insertions(+) create mode 100644 .amazonq/rules/triage-findings.md create mode 100644 .claude/skills/triage-findings/SKILL.md create mode 100644 .codex/skills/triage-findings/SKILL.md create mode 100644 .codex/skills/triage-findings/agents/openai.yaml create mode 100644 .gemini/skills/triage-findings/SKILL.md create mode 100644 .gitea/ai-review/findings.json create mode 100644 .github/copilot-instructions.md create mode 100644 .github/skills/triage-findings/SKILL.md create mode 100644 CLAUDE.md create mode 100644 GEMINI.md diff --git a/.amazonq/rules/triage-findings.md b/.amazonq/rules/triage-findings.md new file mode 100644 index 0000000..4b65ce1 --- /dev/null +++ b/.amazonq/rules/triage-findings.md @@ -0,0 +1,14 @@ +# Triage Findings + +When the task is to triage review findings, follow this workflow: + +1. Merge all findings into one list. +2. Remove duplicates. +3. Sort by severity: `critical` -> `warning` -> `info`. +4. Renumber from 1 after sorting. +5. Fix real issues with the smallest safe change. +6. Add false positives to `.gitea/ai-review/exclusions.json`, preserving the original wording, language, and semantics as much as possible. +7. Add or update tests when behavior changes. +8. Re-check the issue after each fix. + +Use the repo-local `triage-findings` skill for the same workflow when running in Codex. diff --git a/.claude/skills/triage-findings/SKILL.md b/.claude/skills/triage-findings/SKILL.md new file mode 100644 index 0000000..c4ab450 --- /dev/null +++ b/.claude/skills/triage-findings/SKILL.md @@ -0,0 +1,29 @@ +--- +name: triage-findings +description: Triage findings, fix real issues, and exclude false positives. +--- + +# Triage Findings + +## Use + +直接輸入:`triage-findings 問題原始檔(文字或截圖)` + +## Workflow + +1. Merge all findings. +2. Sort by severity: + - critical + - warning + - info +3. Renumber from 1. +4. Fix real issues. +5. Put false positives into `.gitea/ai-review/exclusions.json`, preserving the original wording, language, and semantics as much as possible. +6. Add tests when behavior changes. + +## Output Rules + +- Keep the final list short. +- Keep numbering contiguous. +- Preserve file path, location, and fix. +- When writing exclusions, prefer the original issue text over paraphrased rewrites. diff --git a/.codex/skills/triage-findings/SKILL.md b/.codex/skills/triage-findings/SKILL.md new file mode 100644 index 0000000..21476cb --- /dev/null +++ b/.codex/skills/triage-findings/SKILL.md @@ -0,0 +1,45 @@ +--- +name: triage-findings +description: Merge code-review findings, sort and renumber them by severity, resolve real issues, and move false positives into exclusions. +--- + +# Triage Findings + +## When To Use + +Use this skill when you receive multiple review findings, screenshots, comments, or issue lists that need to become one final triaged list. +It is also used when some findings are false positives and should be moved into the exclusions list. + +## Workflow + +1. Collect all findings into one list. +2. Merge duplicates into a single finding when they describe the same issue. +3. Sort the final list by severity: + - critical + - warning + - info +4. Renumber the sorted list from 1 upward. +5. Rewrite each finding concisely so the final list reads cleanly and consistently. +6. If a finding is a false positive, do not keep it in the final list. +7. Add false positives to the exclusions list using the existing schema in the repo or task context, and preserve the original finding wording as much as possible, including language and semantics. + +## Resolution Flow + +After the list is merged and ordered, resolve the remaining findings one by one. + +1. Start from the highest severity item. +2. Identify the root cause in the relevant file or context. +3. Apply the smallest safe change that fixes the issue. +4. Add or update tests when behavior changes. +5. Re-check the issue after the change. +6. If the item is confirmed false positive, move it to exclusions instead of changing code. +7. Continue until the list is either fixed or explicitly excluded. + +## Output Rules + +- Keep the final findings list in severity order, then by any stable secondary order needed to make it readable. +- Keep numbering contiguous after filtering and merging. +- Preserve useful details like file path, location, and suggested fix. +- Keep exclusions entries minimal and consistent with the project schema. +- When writing exclusions, prefer the original issue text and language; only paraphrase if needed to fit the schema. +- If the source already provides a severity or title, keep it unless it conflicts with the final ordering. diff --git a/.codex/skills/triage-findings/agents/openai.yaml b/.codex/skills/triage-findings/agents/openai.yaml new file mode 100644 index 0000000..6f59e2c --- /dev/null +++ b/.codex/skills/triage-findings/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Triage Findings" + short_description: "Triage, sort, fix, and exclude review findings" + default_prompt: "Use $triage-findings to merge review findings, sort and renumber them by severity, resolve real issues one by one, and add false positives to exclusions." diff --git a/.gemini/skills/triage-findings/SKILL.md b/.gemini/skills/triage-findings/SKILL.md new file mode 100644 index 0000000..c4ab450 --- /dev/null +++ b/.gemini/skills/triage-findings/SKILL.md @@ -0,0 +1,29 @@ +--- +name: triage-findings +description: Triage findings, fix real issues, and exclude false positives. +--- + +# Triage Findings + +## Use + +直接輸入:`triage-findings 問題原始檔(文字或截圖)` + +## Workflow + +1. Merge all findings. +2. Sort by severity: + - critical + - warning + - info +3. Renumber from 1. +4. Fix real issues. +5. Put false positives into `.gitea/ai-review/exclusions.json`, preserving the original wording, language, and semantics as much as possible. +6. Add tests when behavior changes. + +## Output Rules + +- Keep the final list short. +- Keep numbering contiguous. +- Preserve file path, location, and fix. +- When writing exclusions, prefer the original issue text over paraphrased rewrites. diff --git a/.gitea/ai-review/findings.json b/.gitea/ai-review/findings.json new file mode 100644 index 0000000..88de3f8 --- /dev/null +++ b/.gitea/ai-review/findings.json @@ -0,0 +1,100 @@ +[ + { + "level": "critical", + "role": "Aria", + "location": "entrypoint.sh", + "suggestion": "檔案結尾缺少一個換行符號。根據 POSIX 規範,所有文字檔案都應以換行符號結束。請在檔案的最後一行後新增一個換行符號。", + "is_new": true + }, + { + "level": "critical", + "role": "Maya", + "location": "entrypoint.sh", + "suggestion": "此腳本包含複雜的邏輯,特別是版本解析與遞增,並依賴外部服務(如 `curl` 和 `jq`)。目前完全沒有提供任何測試,這使得任何修改都存在高風險。請務必實作一套健全的測試套件,例如使用 `bats` 或 `shunit2` 等 shell 測試框架。測試應包含單元測試(針對輔助函數)和整合測試(模擬外部依賴,如 `curl` 和 `jq` 的回應),以涵蓋各種情境(例如不同的發布歷史、網路錯誤、格式錯誤的 JSON)。", + "is_new": true + }, + { + "level": "critical", + "role": "Maya", + "location": "entrypoint.sh:86-91", + "suggestion": "版本號遞增邏輯中,當 `PATCH` 達到 `10` 時會遞增 `MINOR`,當 `MINOR` 達到 `10` 時會遞增 `MAJOR`。這與標準的語義化版本控制(Semantic Versioning)慣例不同(例如,通常 `1.9.9` 之後是 `1.9.10`,而非 `2.0.0`)。請釐清預期的版本控制方案。如果目標是標準語義化版本,則應移除 `MINOR` 和 `MAJOR` 在 `10` 時的進位邏輯。如果這是一個自訂的十進位版本系統,請務必清楚文件化此行為,並新增特定測試案例,例如 `v0.0.9`、`v0.9.9`、`v0.9.0`、`v1.9.9`,以驗證進位行為是否符合預期。", + "is_new": true + }, + { + "level": "warning", + "role": "Zara", + "location": "entrypoint.sh:65, entrypoint.sh:90", + "suggestion": "腳本多次對完整的 `RELEASE_JSON` 字串執行 `jq` 命令來提取不同資訊。儘管 `RELEASE_JSON` 已載入記憶體,但每次 `jq` 呼叫都會啟動新程序並重新解析字串。對於擁有大量發行版本的儲存庫,這可能導致顯著的效能開銷。建議考慮將這些 `jq` 操作合併為單次處理,以一次性提取所有所需資料(最新的穩定版本和計算出的新版本最高 beta 編號),從而減少 CPU 週期和程序啟動的開銷。", + "is_new": true + }, + { + "level": "warning", + "role": "Rex", + "location": "entrypoint.sh:42, entrypoint.sh:43, entrypoint.sh:55", + "suggestion": "GITEA_SERVER_URL 和 GITEA_REPOSITORY 變數直接用於構建 URL。雖然在 CI/CD 環境中這些變數通常被視為受信任的輸入,但若這些輸入來源不可信,可能導致伺服器端請求偽造 (SSRF) 或路徑遍歷攻擊。建議對這些變數進行更嚴格的輸入驗證,例如檢查 URL 是否符合預期的格式和網域,並確保儲存庫名稱不包含惡意字元(如 `../` 或特殊編碼字元)。", + "is_new": true + }, + { + "level": "warning", + "role": "Aria", + "location": "entrypoint.sh:44", + "suggestion": "`require_env` 函數中的 `printf '%s=%s\n' \"$name\" \"$value\"` 會直接印出環境變數的值。對於 `RUNNER_TOKEN` 這類敏感資訊,這可能導致安全風險。建議修改此函數,使其僅印出變數名稱,或對敏感變數的值進行遮蔽處理。例如,可以改為 `info \"$name 已設定\"`,或在呼叫 `require_env` 之前處理敏感變數的輸出。", + "is_new": true + }, + { + "level": "warning", + "role": "Maya", + "location": "entrypoint.sh:70-73", + "suggestion": "用於提取 `LATEST_VERSION` 和 `BETA` 的 `jq` 指令相當複雜,且依賴特定的 JSON 結構。儘管 `curl -fsS` 有助於處理網路錯誤,但 `jq` 在面對格式錯誤或邊界條件的 JSON 回應時,仍可能產生非預期的結果。請新增專門的測試案例,為 `jq` 提供各種模擬的 `RELEASE_JSON` 輸入,包括:空的發布陣列 `[]`、僅包含 beta 版本的陣列、沒有任何發布的陣列(例如 `curl` 返回 `null` 或空字串)、具有非標準 `tag_name` 格式的發布,以及格式錯誤的 JSON。", + "is_new": true + }, + { + "level": "warning", + "role": "Maya", + "location": "entrypoint.sh:54-57", + "suggestion": "`IS_BETA` 變數的初始化邏輯 (`IS_BETA=\"${IS_BETA:-false}\"` 接著 `if [ \"$IS_BETA\" = \"null\" ] || [ -z \"$IS_BETA\" ]; then IS_BETA=\"false\"; fi`) 略顯冗餘。如果 `IS_BETA` 確實是字串 \"null\",則第一個賦值不會改變它,而第二個 `if` 條件會處理。如果 `IS_BETA` 未設定或為空,第一個賦值會將其設為 \"false\",使得 `if` 條件中的 `[ -z \"$IS_BETA\" ]` 為假。請簡化 `IS_BETA` 的初始化邏輯,以提高清晰度和穩健性。例如,可以考慮使用 `IS_BETA=$(echo \"${IS_BETA:-false}\" | sed 's/null/false/')` 或更清晰的條件區塊。同時,請新增測試案例,涵蓋 `IS_BETA` 未設定、空字串、字串 \"null\"、\"true\"、\"false\" 以及其他非預期字串值的情況,以確保行為一致。", + "is_new": true + }, + { + "level": "info", + "role": "Zara", + "location": "entrypoint.sh:58", + "suggestion": "腳本從 Gitea API 獲取所有發行版本。如果儲存庫中的發行版本數量非常龐大,這可能會消耗大量的網路頻寬和記憶體。儘管目前的邏輯可能需要檢查多個發行版本(例如,尋找最新的穩定版或特定的 beta 版本),但值得研究 Gitea API 是否提供更精細的過濾(例如,按標籤名稱模式或排除 beta 標籤)或分頁功能,以減少獲取的資料量,特別是當腳本只需要部分發行版本資訊時。", + "is_new": true + }, + { + "level": "info", + "role": "Rex", + "location": "entrypoint.sh:109", + "suggestion": "將 NEW_VERSION 輸出到 GITHUB_OUTPUT 時,雖然目前 NEW_VERSION 的格式(如 `X.Y.Z` 或 `X.Y.Z-beta.N`)相對安全,不太可能包含換行符或其他特殊字元,但一般而言,應確保輸出到環境變數或檔案的內容不包含可能導致指令注入的特殊字元。對於複雜或多行內容,應使用 GitHub Actions 建議的多行輸出語法以確保安全。", + "is_new": true + }, + { + "level": "info", + "role": "Aria", + "location": "entrypoint.sh:5", + "suggestion": "在 `readonly` 變數定義和第一個函數定義之間增加一個空行,可以提高程式碼區塊之間的視覺分隔,增強可讀性。", + "is_new": true + }, + { + "level": "info", + "role": "Aria", + "location": "entrypoint.sh:53", + "suggestion": "為了保持日誌輸出的一致性,建議將 `RUNNER_TOKEN` 的狀態輸出也透過 `info` 函數處理,例如 `info \"RUNNER_TOKEN=***\"` 或 `info \"RUNNER_TOKEN=未提供\"`。這有助於統一日誌格式。", + "is_new": true + }, + { + "level": "info", + "role": "Aria", + "location": "entrypoint.sh:70", + "suggestion": "多行 `jq` 查詢字串的縮排方式可以考慮調整。為了提高可讀性,可以將 `jq` 腳本內容使用 heredoc 語法,或將其縮排與 `jq -r` 對齊,而不是與 `printf` 的內容對齊。目前的縮排方式雖然功能上無誤,但可能在視覺上造成混淆。", + "is_new": true + }, + { + "level": "info", + "role": "Maya", + "location": "entrypoint.sh:109", + "suggestion": "此腳本直接寫入 `$GITHUB_OUTPUT`,這是 GitHub Actions 環境特有的行為。雖然這對於其預期用途是正確的,但這使得在沒有完整 GitHub Actions 環境的情況下,難以獨立測試輸出機制。在建立測試套件時,請確保 `write_output` 函數可以透過將 `$GITHUB_OUTPUT` 重定向到臨時文件,或透過模擬 `write_output` 函數本身來進行測試,以便在不執行完整 GitHub Actions 的情況下驗證生成的輸出。", + "is_new": true + } +] diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..f1a77ef --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,14 @@ +# Triage Findings + +Use the triage-finding workflow for review issue lists: + +1. Merge findings into one list. +2. Remove duplicates. +3. Sort by severity: `critical` -> `warning` -> `info`. +4. Renumber from 1. +5. Fix real issues with the smallest safe change. +6. Put false positives into `.gitea/ai-review/exclusions.json`, preserving the original wording, language, and semantics as much as possible. +7. Add or update tests when behavior changes. +8. Re-check after each fix. + +The full reusable skill lives in `.claude/skills/triage-findings/SKILL.md`. diff --git a/.github/skills/triage-findings/SKILL.md b/.github/skills/triage-findings/SKILL.md new file mode 100644 index 0000000..8ca4117 --- /dev/null +++ b/.github/skills/triage-findings/SKILL.md @@ -0,0 +1,14 @@ +# Triage Findings + +Use the triage-finding workflow for review issue lists: + +1. Merge findings into one list. +2. Remove duplicates. +3. Sort by severity: `critical` -> `warning` -> `info`. +4. Renumber from 1. +5. Fix real issues with the smallest safe change. +6. Put false positives into `.gitea/ai-review/exclusions.json`, preserving the original wording, language, and semantics as much as possible. +7. Add or update tests when behavior changes. +8. Re-check after each fix. + +The reusable skill lives in `.gemini/skills/triage-findings/SKILL.md`. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..fa2403d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,16 @@ +# Triage Findings + +When the task is to triage review findings, follow this workflow: + +1. Merge all findings into one list. +2. Remove duplicates. +3. Sort by severity: `critical` -> `warning` -> `info`. +4. Renumber from 1 after sorting. +5. Fix real issues with the smallest safe change. +6. Add false positives to `.gitea/ai-review/exclusions.json`, preserving the original wording, language, and semantics as much as possible. +7. Add or update tests when behavior changes. +8. Re-check the issue after each fix. + +Use the repo-local `triage-findings` skill for the same workflow when running in Codex. + +Trigger it with `/triage-findings`. diff --git a/GEMINI.md b/GEMINI.md new file mode 100644 index 0000000..8ca4117 --- /dev/null +++ b/GEMINI.md @@ -0,0 +1,14 @@ +# Triage Findings + +Use the triage-finding workflow for review issue lists: + +1. Merge findings into one list. +2. Remove duplicates. +3. Sort by severity: `critical` -> `warning` -> `info`. +4. Renumber from 1. +5. Fix real issues with the smallest safe change. +6. Put false positives into `.gitea/ai-review/exclusions.json`, preserving the original wording, language, and semantics as much as possible. +7. Add or update tests when behavior changes. +8. Re-check after each fix. + +The reusable skill lives in `.gemini/skills/triage-findings/SKILL.md`.