Elffuss BraidHub

kikocis/continue public

feat: pass --config to cn remote
Changeset32d3dfe694fd46b717e575ce2923a6522df9d67d2073cfcd70f0f0594db6ca55
AuthorNate <sestinj@gmail.com> · 2025-09-04 20:27 -07:00
CommitterNate <sestinj@gmail.com> · 2025-09-04 20:27 -07:00
Parentse42bdc2c5fca

Browse the files at this changeset

4 files changed

modified .github/workflows/respond-to-cubic.yaml +2 −2
@@ -91,7 +91,7 @@
9191 Please analyze the current PR, understand the request, implement the necessary changes, and commit them to this branch."
9292
9393 # Start remote session and capture JSON output
94- SESSION_OUTPUT=$(echo "$PROMPT" | cn remote -s --branch ${{ steps.pr-info.outputs.head_ref }})
94+ SESSION_OUTPUT=$(echo "$PROMPT" | cn remote -s --config continuedev/address-code-review --branch ${{ steps.pr-info.outputs.head_ref }})
9595 echo "Raw session output: $SESSION_OUTPUT"
9696
9797 # Extract URL from JSON output
@@ -195,7 +195,7 @@
195195
196196 # Start remote session and capture JSON output
197197 echo "Starting cn with prompt..."
198- SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --branch ${{ github.event.pull_request.head.ref }})
198+ SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --config continuedev/address-code-review --branch ${{ github.event.pull_request.head.ref }})
199199 echo "Raw session output: $SESSION_OUTPUT"
200200
201201 # Extract URL from JSON output
modified extensions/cli/src/commands/remote.test.ts +65 −0
@@ -236,6 +236,71 @@
236236 prompt: "test prompt",
237237 idempotencyKey: testIdempotencyKey,
238238 branchName: testBranch,
239+ agent: undefined,
240+ config: undefined,
241+ });
242+ });
243+
244+ it("should include config in request body when config option is provided", async () => {
245+ const testConfig = "test-config-path";
246+
247+ await remote("test prompt", { config: testConfig });
248+
249+ expect(mockFetch).toHaveBeenCalledWith(
250+ new URL("agents/devboxes", mockEnv.env.apiBase),
251+ expect.objectContaining({
252+ method: "POST",
253+ headers: {
254+ "Content-Type": "application/json",
255+ Authorization: "Bearer test-token",
256+ },
257+ body: expect.stringContaining(`"config":"${testConfig}"`),
258+ }),
259+ );
260+
261+ expect(mockFetch).toHaveBeenCalledWith(
262+ new URL("agents/devboxes", mockEnv.env.apiBase),
263+ expect.objectContaining({
264+ body: expect.stringContaining(`"agent":"${testConfig}"`),
265+ }),
266+ );
267+ });
268+
269+ it("should handle proper request body structure with config field", async () => {
270+ const testConfig = "my-agent-config";
271+ const testIdempotencyKey = "test-with-config";
272+
273+ await remote("test prompt", {
274+ config: testConfig,
275+ idempotencyKey: testIdempotencyKey,
276+ });
277+
278+ const fetchCall = mockFetch.mock.calls[0];
279+ const requestBody = JSON.parse(fetchCall[1].body);
280+
281+ expect(requestBody).toEqual({
282+ repoUrl: "https://github.com/user/test-repo.git",
283+ name: expect.stringMatching(/^devbox-\d+$/),
284+ prompt: "test prompt",
285+ idempotencyKey: testIdempotencyKey,
286+ agent: testConfig,
287+ config: testConfig,
288+ });
289+ });
290+
291+ it("should not include config in request body when config option is not provided", async () => {
292+ await remote("test prompt", {});
293+
294+ const fetchCall = mockFetch.mock.calls[0];
295+ const requestBody = JSON.parse(fetchCall[1].body);
296+
297+ expect(requestBody).toEqual({
298+ repoUrl: "https://github.com/user/test-repo.git",
299+ name: expect.stringMatching(/^devbox-\d+$/),
300+ prompt: "test prompt",
301+ idempotencyKey: undefined,
302+ agent: undefined,
303+ config: undefined,
239304 });
240305 });
241306
modified extensions/cli/src/commands/remote.ts +3 −0
@@ -16,6 +16,7 @@
1616 start?: boolean;
1717 branch?: string;
1818 repo?: string;
19+ config?: string;
1920 } = {},
2021 ) {
2122 // Check if prompt should come from stdin instead of parameter
@@ -84,6 +85,8 @@
8485 name: `devbox-${Date.now()}`,
8586 prompt: actualPrompt,
8687 idempotencyKey: options.idempotencyKey,
88+ agent: options.config,
89+ config: options.config,
8790 };
8891
8992 // Add branchName to request body if branch option is provided
modified extensions/cli/src/index.ts +5 −3
@@ -218,9 +218,11 @@
218218 });
219219
220220 // Remote subcommand
221-program
222- .command("remote [prompt]", { hidden: true })
223- .description("Launch a remote instance of the cn agent")
221+addCommonOptions(
222+ program
223+ .command("remote [prompt]", { hidden: true })
224+ .description("Launch a remote instance of the cn agent"),
225+)
224226 .option(
225227 "--url <url>",
226228 "Connect directly to the specified URL instead of creating a new remote environment",