diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-28 10:43:42 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-28 10:43:42 +0300 |
| commit | bff9775a92d653d74e575fd6fc1398ca4505ea30 (patch) | |
| tree | 8985d735aa98e0c86b4fe0a8bab9b8fbe99de550 /internal/showcase | |
| parent | cda151ec9654fd8b4d043668da21f909477f5e9c (diff) | |
refactor(aitool): extract shared AI tool dispatch chain (cq)
Diffstat (limited to 'internal/showcase')
| -rw-r--r-- | internal/showcase/showcase.go | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/internal/showcase/showcase.go b/internal/showcase/showcase.go index 4e8d637..b9e1fe1 100644 --- a/internal/showcase/showcase.go +++ b/internal/showcase/showcase.go @@ -11,6 +11,7 @@ import ( "strings" "time" + "codeberg.org/snonux/gitsyncer/internal/aitool" "codeberg.org/snonux/gitsyncer/internal/config" ) @@ -230,47 +231,7 @@ func findReadmeContent(repoPath string) ([]byte, string, bool) { } func selectSummaryTool(aiTool string) string { - switch aiTool { - case "opencode", "": - // Default chain: opencode (via ollama launch) → hexai → claude → amp - if _, err := exec.LookPath("ollama"); err == nil { - return "opencode" - } - if _, err := exec.LookPath("hexai"); err == nil { - return "hexai" - } - if _, err := exec.LookPath("claude"); err == nil { - return "claude" - } - if _, err := exec.LookPath("amp"); err == nil { - return "amp" - } - case "hexai": - // Explicit hexai: hexai → claude → amp - if _, err := exec.LookPath("hexai"); err == nil { - return "hexai" - } - if _, err := exec.LookPath("claude"); err == nil { - return "claude" - } - if _, err := exec.LookPath("amp"); err == nil { - return "amp" - } - case "claude", "claude-code": - // Explicit claude: claude → amp - if _, err := exec.LookPath("claude"); err == nil { - return "claude" - } - if _, err := exec.LookPath("amp"); err == nil { - return "amp" - } - case "amp": - if _, err := exec.LookPath(aiTool); err == nil { - return aiTool - } - } - - return "" + return string(aitool.FirstAvailable(aiTool, nil)) } func runSummaryTool(selectedTool, prompt, repoPath, readmeFile string, readmeContent []byte, readmeFound bool) string { |
