Commit Graph
9 Commits
Author SHA1 Message Date
JefferyandClaude Opus 4.8 bc4cea6daf refactor(calculate-version): 抽出 truncateString 並明確化 repository 驗證命名
- releases 將片段截斷邏輯抽為可重用、可獨立測試的 truncateString(text, limit) 並 export
- config 將 assertRepository 更名為 assertGiteaRepositoryFormat,凸顯其驗證 Gitea owner/repo 格式的領域語義

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 15:21:45 +08:00
JefferyandClaude Opus 4.8 4aa1393af2 refactor(calculate-version): 強化片段截斷記憶體安全與抽出區段驗證
- releases 在 Array.from 前先以長度上限截斷字串,避免將可能極大的回應整個陣列化
- config 將 repository 區段驗證抽為具名函式 isValidRepoSegment 提升可讀性

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 14:14:30 +08:00
JefferyandClaude Opus 4.8 d8a86e90ea refactor(calculate-version): 將驗證常數抽離為具名常數
- config 將每段長度上限與允許字元抽為 MAX_REPO_NAME_LENGTH / REPO_SEGMENT_PATTERN(regex 提升至模組層級,避免每次重編譯)
- releases 將片段截斷長度抽為 API_ERROR_SNIPPET_LENGTH

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 14:11:36 +08:00
JefferyandClaude Opus 4.8 da83f4fc30 fix(calculate-version): 強化片段截斷與 repository 驗證健全性
- releases 改以 Array.from 依字元截斷回應片段,避免拆分多位元組字元造成亂碼,並標記片段內容
- config assertRepository 加入每段長度上限,並將 valid 更名為語義明確的 isRepoFormatValid

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 14:05:08 +08:00
JefferyandClaude Opus 4.8 b8804c5218 fix(calculate-version): 強化輸入驗證與錯誤訊息
- config 對 GITEA_REPOSITORY 加入 owner/repo 格式驗證,拒絕路徑穿越與特殊字元
- releases JSON 解析失敗時,錯誤訊息納入截斷的回傳內容片段以利除錯

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 14:01:30 +08:00
JefferyandClaude Opus 4.8 fdf33b41d8 fix(calculate-version): 修復 AI 審查的安全與健全性問題
- Dockerfile 移除 --no-check-certificate,恢復 TLS 憑證檢查以防中間人攻擊
- config 對 GITEA_SERVER_URL 加入 http/https URL 格式驗證
- logger.fail 改為 logger.error(僅輸出不終止行程),退出移至 index 頂層處理
- index.main 改用相依注入並於頂層攔截錯誤後 exit 1,避免 library 內呼叫 process.exit
- releases 將 response.text() 包入 try-catch 並附帶頁碼

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 10:52:19 +08:00
JefferyandClaude Opus 4.8 bd6b6017ab refactor(calculate-version): 將版本計算邏輯由 bash 改寫為 Node.js 並依功能分檔
保留 entrypoint.sh 作為容器進入點,改為啟動 app/ 下的 Node.js 程式;
依功能拆分為 logger/config/version/releases/output/index,並更新 Dockerfile 改用 node:lts-alpine。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 10:41:34 +08:00
jiantw83 e8fa3ab67e feat(calculate-version): 改為計算版本 Docker Action 2026-06-25 10:52:39 +00:00
jiantw83 3cf52a2302 feat: add role management and usage tracking modules
- Implemented role parsing and loading functionality in roles.js, allowing for structured role definitions with metadata.
- Added tests for role management to ensure correct parsing and loading of roles.
- Created usage.js to track API usage metrics, including token counts and rate limits.
- Developed tests for usage tracking to validate functionality and edge cases.
- Enhanced overall code structure and documentation for clarity and maintainability.
2026-06-25 09:13:15 +00:00