docs(AI Code Review): 補齊 action 與 workflow 註解說明
This commit is contained in:
@@ -51,6 +51,12 @@ export const EXCLUSIONS_PATH = '.gitea/ai-review/exclusions.json';
|
||||
* @returns {import('https').Agent} 已關閉憑證驗證的 HTTPS Agent 單例。
|
||||
*/
|
||||
let _insecureHttpsAgent = null;
|
||||
/**
|
||||
* 取得一個關閉 TLS 憑證驗證的 HTTPS Agent 單例,供內部服務連線使用。
|
||||
*
|
||||
* @remarks 只應在信任的內網或測試環境使用;若需要完整 TLS 安全性,應改用預設
|
||||
* `https.Agent`,不要調用這個函式。
|
||||
*/
|
||||
export function getInsecureHttpsAgent() {
|
||||
return (_insecureHttpsAgent ??= new https.Agent({ rejectUnauthorized: false }));
|
||||
}
|
||||
@@ -86,10 +92,22 @@ const CLI_CANDIDATES = [
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* 取得目前支援的 LLM CLI 指令名稱清單。
|
||||
*
|
||||
* @remarks 內容直接取自 `CLI_CANDIDATES`,若日後候選清單增減,輸出會同步變動。
|
||||
*/
|
||||
export function getLLMCLICommands() {
|
||||
return CLI_CANDIDATES.map(c => c.command);
|
||||
}
|
||||
|
||||
/**
|
||||
* 檢查指定 CLI 指令是否可在目前環境中執行。
|
||||
*
|
||||
* @param {string} command - 要檢查的指令名稱。
|
||||
* @returns {boolean} 找得到指令時回傳 `true`,否則回傳 `false`。
|
||||
* @remarks 透過 `/bin/sh -lc "command -v <command>"` 檢查,屬於同步存在性檢查。
|
||||
*/
|
||||
function commandExists(command) {
|
||||
try {
|
||||
execFileSync('/bin/sh', ['-lc', `command -v ${command}`], { stdio: 'ignore' });
|
||||
|
||||
Reference in New Issue
Block a user