remove hermes cli fallback path

This commit is contained in:
Haitao Pan 2026-04-22 14:09:30 +08:00
parent b4123998b7
commit 849e45bf5b
2 changed files with 3 additions and 46 deletions

View File

@ -171,17 +171,6 @@ func ResolveProviderCommand(
"-p", "-p",
prompt, prompt,
} }
case "hermes":
binary := strings.TrimSpace(EnvOrDefault("ACP_HERMES_BIN", "hermes"))
if strings.TrimSpace(model) == "" {
return binary, []string{"-p", prompt}
}
return binary, []string{
"--model",
strings.TrimSpace(model),
"-p",
prompt,
}
default: default:
return "", nil return "", nil
} }

View File

@ -1,7 +1,6 @@
package shared package shared
import ( import (
"context"
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
@ -39,42 +38,11 @@ func TestNormalizeProviderWorkingDirectorySkipsUnknownProvider(t *testing.T) {
} }
} }
func TestResolveProviderCommandSupportsHermes(t *testing.T) { func TestEnsureWorkingDirectoryExistsCreatesMissingWorkingDirectory(t *testing.T) {
t.Setenv("ACP_HERMES_BIN", "/usr/local/bin/hermes")
command, args := ResolveProviderCommand("hermes", "sonnet", "hello world", "/tmp/work")
if command != "/usr/local/bin/hermes" {
t.Fatalf("expected hermes binary override, got %q", command)
}
if len(args) != 4 {
t.Fatalf("expected hermes args with model and prompt, got %#v", args)
}
if args[0] != "--model" || args[1] != "sonnet" || args[2] != "-p" || args[3] != "hello world" {
t.Fatalf("unexpected hermes args: %#v", args)
}
}
func TestRunProviderCommandCreatesMissingWorkingDirectory(t *testing.T) {
workspaceRoot := filepath.Join(t.TempDir(), "owners", "local", "user", "thread-1") workspaceRoot := filepath.Join(t.TempDir(), "owners", "local", "user", "thread-1")
scriptPath := filepath.Join(t.TempDir(), "hermes.sh")
if err := os.WriteFile(scriptPath, []byte("#!/bin/sh\necho ok\n"), 0o755); err != nil {
t.Fatalf("write script: %v", err)
}
t.Setenv("ACP_HERMES_BIN", scriptPath)
output, err := RunProviderCommand( if err := ensureWorkingDirectoryExists(workspaceRoot); err != nil {
context.Background(), t.Fatalf("ensureWorkingDirectoryExists() error = %v", err)
"hermes",
"sonnet",
"hello world",
workspaceRoot,
)
if err != nil {
t.Fatalf("RunProviderCommand() error = %v", err)
}
if output != "ok" {
t.Fatalf("RunProviderCommand() output = %q, want %q", output, "ok")
} }
if info, err := os.Stat(workspaceRoot); err != nil || !info.IsDir() { if info, err := os.Stat(workspaceRoot); err != nil || !info.IsDir() {
t.Fatalf("expected working directory to be created, stat err=%v info=%v", err, info) t.Fatalf("expected working directory to be created, stat err=%v info=%v", err, info)