mirror of
https://github.com/multica-ai/multica.git
synced 2026-06-17 03:38:32 +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
This commit is contained in:
@@ -396,12 +396,11 @@ var cursorBlockedArgs = map[string]blockedArgMode{
|
||||
|
||||
// buildCursorArgs assembles the argv for a one-shot cursor-agent invocation.
|
||||
//
|
||||
// Usage: cursor-agent chat -p <prompt> --output-format stream-json
|
||||
// Usage: cursor-agent -p <prompt> --output-format stream-json
|
||||
//
|
||||
// --workspace <cwd> --yolo [--model <m>] [--resume <id>]
|
||||
func buildCursorArgs(prompt string, opts ExecOptions, logger *slog.Logger) []string {
|
||||
args := []string{
|
||||
"chat",
|
||||
"-p", prompt,
|
||||
"--output-format", "stream-json",
|
||||
"--yolo",
|
||||
|
||||
@@ -18,7 +18,7 @@ func TestChooseCursorInvocation_PassthroughForNonLauncher(t *testing.T) {
|
||||
|
||||
execName := "cursor-agent"
|
||||
lookedUp := filepath.Join(t.TempDir(), "cursor-agent") // no .cmd / .bat
|
||||
args := []string{"chat", "-p", "hello\nworld", "--output-format", "stream-json", "--yolo"}
|
||||
args := []string{"-p", "hello\nworld", "--output-format", "stream-json", "--yolo"}
|
||||
|
||||
gotExec, gotArgs := chooseCursorInvocation(execName, lookedUp, args, logger)
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ func TestPlatformCursorInvocation_RewritesCmdLauncherToPowerShellFile(t *testing
|
||||
stubPowerShell(t, fakePS, true)
|
||||
|
||||
args := []string{
|
||||
"chat",
|
||||
"-p", "line1\nline2\nline3",
|
||||
"--output-format", "stream-json",
|
||||
"--yolo",
|
||||
@@ -84,7 +83,7 @@ func TestPlatformCursorInvocation_SkipsWhenNotCmdOrBat(t *testing.T) {
|
||||
stubPowerShell(t, filepath.Join(dir, "powershell.exe"), true)
|
||||
|
||||
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
||||
if _, _, ok := platformCursorInvocation(exePath, []string{"chat"}, logger); ok {
|
||||
if _, _, ok := platformCursorInvocation(exePath, []string{"-p", "hello"}, logger); ok {
|
||||
t.Fatalf("expected ok=false for non-.cmd/.bat launcher")
|
||||
}
|
||||
}
|
||||
@@ -101,7 +100,7 @@ func TestPlatformCursorInvocation_SkipsWhenPS1Missing(t *testing.T) {
|
||||
stubPowerShell(t, filepath.Join(dir, "powershell.exe"), true)
|
||||
|
||||
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
||||
if _, _, ok := platformCursorInvocation(cmdPath, []string{"chat"}, logger); ok {
|
||||
if _, _, ok := platformCursorInvocation(cmdPath, []string{"-p", "hello"}, logger); ok {
|
||||
t.Fatalf("expected ok=false when cursor-agent.ps1 is missing")
|
||||
}
|
||||
}
|
||||
@@ -119,7 +118,7 @@ func TestPlatformCursorInvocation_SkipsWhenPowerShellMissing(t *testing.T) {
|
||||
stubPowerShell(t, "", false)
|
||||
|
||||
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
|
||||
if _, _, ok := platformCursorInvocation(cmdPath, []string{"chat"}, logger); ok {
|
||||
if _, _, ok := platformCursorInvocation(cmdPath, []string{"-p", "hello"}, logger); ok {
|
||||
t.Fatalf("expected ok=false when no powershell host is available")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ func TestBuildCursorArgs(t *testing.T) {
|
||||
}, slog.Default())
|
||||
|
||||
expected := []string{
|
||||
"chat",
|
||||
"-p", "do something",
|
||||
"--output-format", "stream-json",
|
||||
"--yolo",
|
||||
@@ -67,7 +66,7 @@ func TestBuildCursorArgsMinimal(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
args := buildCursorArgs("hello", ExecOptions{}, slog.Default())
|
||||
expected := []string{"chat", "-p", "hello", "--output-format", "stream-json", "--yolo"}
|
||||
expected := []string{"-p", "hello", "--output-format", "stream-json", "--yolo"}
|
||||
|
||||
if len(args) != len(expected) {
|
||||
t.Fatalf("expected %d args, got %d: %v", len(expected), len(args), args)
|
||||
|
||||
Reference in New Issue
Block a user