docs(release-cleanup): 補齊 config/gitea-client/releases/tags 的 JSDoc
為 loadConfig、GiteaClient(含 fetchAllPages/deleteResource)、 selectReleasesToDelete/cleanupReleases、categorizeTags/cleanupOrphanTags 補上完整 JSDoc(參數、回傳、例外、行為說明)。僅註解變更。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
7082fd7311
commit
7e6f9ef3f6
+11
-3
@@ -5,9 +5,17 @@ import { isEmptyOrNull, requireValue, requireInteger } from './validate.js'
|
||||
import { section, info, warn } from './logger.js'
|
||||
|
||||
/**
|
||||
* 從環境變數載入設定並完成驗證。
|
||||
* @param {NodeJS.ProcessEnv} env 環境變數來源,預設為 process.env
|
||||
* @returns 包含 API 位址、token、保留數量等資訊的設定物件
|
||||
* 從環境變數載入設定並完成驗證,作為整個清理流程的設定來源。
|
||||
*
|
||||
* 讀取 `GITEA_SERVER_URL`、`GITEA_REPOSITORY`、`KEEP_COUNT`、`GITEA_TOKEN`,
|
||||
* 其中前三者為必填(`KEEP_COUNT` 另須為非負整數);`GITEA_TOKEN` 為選填,
|
||||
* 為空時改以匿名方式呼叫 API。驗證過程會將參數印出(token 以 `[redacted]` 遮蔽)。
|
||||
*
|
||||
* @param {NodeJS.ProcessEnv} env 環境變數來源,預設為 `process.env`,可於測試時注入假值
|
||||
* @returns {{serverUrl: string, repository: string, token: string|null, keepCount: number, releaseApiUrl: string, tagApiUrl: string}}
|
||||
* 設定物件:`token` 在環境變數為空時為 `null`;`keepCount` 為數值;
|
||||
* `releaseApiUrl`/`tagApiUrl` 為依 server 與 repository 組出的 API 位址。
|
||||
* @throws {Error} 任一必填項缺漏,或 `KEEP_COUNT` 非非負整數時拋出(由 [[validate]] 的檢查函式丟出)
|
||||
*/
|
||||
export function loadConfig(env = process.env) {
|
||||
section('參數檢查')
|
||||
|
||||
Reference in New Issue
Block a user