feat(ai-code-review): 支援 Antigravity CLI
CI / Release Tag Version (pull_request) Successful in 4s
CI / AI Code Review (pull_request) Failing after 17s

This commit is contained in:
2026-06-27 13:47:44 +00:00
parent 5457e68065
commit 6f997083ef
8 changed files with 60 additions and 12 deletions
+16 -2
View File
@@ -42,6 +42,16 @@ const CLI_CANDIDATES = [
command: 'claude',
defaultModel: 'sonnet',
},
{
provider: 'antigravity',
command: 'agy',
defaultModel: 'gemini-2.5-flash',
},
{
provider: 'antigravity',
command: 'antigravity',
defaultModel: 'gemini-2.5-flash',
},
{
provider: 'opencode',
command: 'opencode',
@@ -49,6 +59,10 @@ const CLI_CANDIDATES = [
},
];
export function getLLMCLICommands() {
return CLI_CANDIDATES.map(c => c.command);
}
function commandExists(command) {
try {
execFileSync('/bin/sh', ['-lc', `command -v ${command}`], { stdio: 'ignore' });
@@ -61,11 +75,11 @@ function commandExists(command) {
/**
* 依環境變數解析並回傳 LLM 提供者設定。
*
* 優先使用 `AI_ASSISTANT_CLI` 指定的 CLI;未指定時依序偵測 codex、claude、opencode。
* 優先使用 `AI_ASSISTANT_CLI` 指定的 CLI;未指定時依序偵測 codex、claude、antigravity、opencode。
* model 優先取 `MODEL`,再相容舊的 `OPENCODE_MODEL`,最後使用各 CLI 預設值。
*
* @param {{ commandExistsFn?: (command: string) => boolean }} [deps] - 可注入的 CLI 偵測函式,供測試使用。
* @returns {{ provider: ('codex'|'claude'|'opencode'|null), apiKeys: string[], baseURL: null, model: (string|null), command: (string|null) }}
* @returns {{ provider: ('codex'|'claude'|'antigravity'|'opencode'|null), apiKeys: string[], baseURL: null, model: (string|null), command: (string|null) }}
* LLM 設定物件;`provider` 為 `null` 表示沒有可用的提供者。
*/
export function getLLMConfig({ commandExistsFn = commandExists } = {}) {