Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/shared/src/agent-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,21 @@ describe("buildAgentPromptCommand", () => {
expect(command).toStartWith("pi \"$(cat <<'SUPERSET_PROMPT_pi1234'");
expect(command).not.toContain("pi -p");
});

it("passes copilot prompts via --prompt flag, not as positional", () => {
// Repro for #3862: `copilot -i ... "<prompt>"` errors with
// "Expected 0 arguments but got 1." because interactive mode does
// not accept a positional prompt. The prompt must be passed via
// the --prompt flag.
const command = buildAgentPromptCommand({
prompt: "hello",
randomId: "copilot-1234",
agent: "copilot",
});

expect(command).not.toMatch(/\bcopilot\b[^"]*\s-i\b/);
expect(command).toStartWith(
"copilot --allow-tool=write --prompt \"$(cat <<'SUPERSET_PROMPT_copilot1234'",
);
});
});
2 changes: 1 addition & 1 deletion packages/shared/src/agent-permissions-migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const LEGACY_BUILTIN_TERMINAL_AGENT_OVERRIDES: Readonly<
},
copilot: {
command: "copilot --allow-all",
promptCommand: "copilot -i --allow-all",
promptCommand: "copilot --allow-all --prompt",
promptCommandSuffix: "--yolo",
},
"cursor-agent": {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/builtin-terminal-agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const BUILTIN_TERMINAL_AGENTS = [
description:
"GitHub's coding agent for planning, editing, and building in your repo.",
command: "copilot --allow-tool=write",
promptCommand: "copilot -i --allow-tool=write",
promptCommand: "copilot --allow-tool=write --prompt",
includeInDefaultTerminalPresets: true,
}),
createBuiltinTerminalAgent({
Expand Down