Skip to content

Commit 55f09af

Browse files
author
Assistant
committed
Fix OpenCode interactive command to use --prompt flag
1 parent 617ea59 commit 55f09af

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

internal/agent/opencode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (p *OpenCodeProvider) LoopCommand(ctx context.Context, prompt, workDir stri
3030
}
3131

3232
func (p *OpenCodeProvider) InteractiveCommand(workDir, prompt string) *exec.Cmd {
33-
cmd := exec.Command(p.cliPath)
33+
cmd := exec.Command(p.cliPath, "--prompt", prompt)
3434
cmd.Dir = workDir
3535
return cmd
3636
}

internal/agent/opencode_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ func TestOpenCodeProvider_FixJSONCommand(t *testing.T) {
8686
if outPath != "" {
8787
t.Errorf("FixJSONCommand outPath = %q, want empty string", outPath)
8888
}
89+
if cmd.Path != "opencode" {
90+
t.Errorf("FixJSONCommand Path = %q, want opencode", cmd.Path)
91+
}
8992
}
9093

9194
func TestOpenCodeProvider_InteractiveCommand(t *testing.T) {
@@ -94,6 +97,9 @@ func TestOpenCodeProvider_InteractiveCommand(t *testing.T) {
9497
if cmd.Dir != "/work" {
9598
t.Errorf("InteractiveCommand Dir = %q, want /work", cmd.Dir)
9699
}
100+
if len(cmd.Args) != 3 || cmd.Args[0] != "opencode" || cmd.Args[1] != "--prompt" || cmd.Args[2] != "my prompt" {
101+
t.Errorf("InteractiveCommand Args = %v, want [opencode --prompt 'my prompt']", cmd.Args)
102+
}
97103
}
98104

99105
func TestOpenCodeProvider_ParseLine(t *testing.T) {

0 commit comments

Comments
 (0)