mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-05 21:39:54 +02:00
The current cursor-agent CLI no longer has a 'chat' subcommand. The positional 'chat' argument was silently treated as prompt text, leaking into the user message (e.g. 'chat <actual prompt>'). Remove 'chat' from buildCursorArgs so the generated argv matches the current cursor-agent CLI interface. Fixes #3077
32 lines
1.0 KiB
Go
32 lines
1.0 KiB
Go
package agent
|
|
|
|
import (
|
|
"io"
|
|
"log/slog"
|
|
"path/filepath"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
// TestChooseCursorInvocation_PassthroughForNonLauncher verifies that when the
|
|
// resolved executable is not a Windows .cmd/.bat launcher, both argv[0] and
|
|
// the argv list are returned unchanged on every platform. This guards against
|
|
// accidental rewriting on macOS/Linux and for direct binary launches on
|
|
// Windows.
|
|
func TestChooseCursorInvocation_PassthroughForNonLauncher(t *testing.T) {
|
|
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
|
|
|
execName := "cursor-agent"
|
|
lookedUp := filepath.Join(t.TempDir(), "cursor-agent") // no .cmd / .bat
|
|
args := []string{"-p", "hello\nworld", "--output-format", "stream-json", "--yolo"}
|
|
|
|
gotExec, gotArgs := chooseCursorInvocation(execName, lookedUp, args, logger)
|
|
|
|
if gotExec != execName {
|
|
t.Errorf("argv0 changed unexpectedly: got %q want %q", gotExec, execName)
|
|
}
|
|
if !reflect.DeepEqual(gotArgs, args) {
|
|
t.Errorf("argv changed unexpectedly:\n got %#v\n want %#v", gotArgs, args)
|
|
}
|
|
}
|