mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-04 02:20:42 +08:00
fix(codeagent-wrapper): remove extraneous dash arg for opencode stdin mode (#124)
opencode does not support "-" as a stdin marker like codex/claude/gemini. When using stdin mode, omit the "-" argument so opencode reads from stdin without an unrecognized positional argument. Closes #124 Generated with SWE-Agent.ai Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
@@ -188,6 +188,15 @@ func TestOpencodeBackend_BuildArgs(t *testing.T) {
|
||||
t.Errorf("got %v, want %v", got, want)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("stdin mode omits dash", func(t *testing.T) {
|
||||
cfg := &Config{Mode: "new"}
|
||||
got := backend.BuildArgs(cfg, "-")
|
||||
want := []string{"run", "--format", "json"}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("got %v, want %v", got, want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestOpencodeBackend_Interface(t *testing.T) {
|
||||
|
||||
@@ -204,7 +204,10 @@ func (OpencodeBackend) BuildArgs(cfg *Config, targetArg string) []string {
|
||||
if cfg.Mode == "resume" && cfg.SessionID != "" {
|
||||
args = append(args, "-s", cfg.SessionID)
|
||||
}
|
||||
args = append(args, "--format", "json", targetArg)
|
||||
args = append(args, "--format", "json")
|
||||
if targetArg != "-" {
|
||||
args = append(args, targetArg)
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user