Changesets · Branches · Tags · Compare
| Changeset | 32d3dfe694fd46b717e575ce2923a6522df9d67d2073cfcd70f0f0594db6ca55 |
|---|---|
| Author | Nate <sestinj@gmail.com> · 2025-09-04 20:27 -07:00 |
| Committer | Nate <sestinj@gmail.com> · 2025-09-04 20:27 -07:00 |
| Parents | e42bdc2c5fca |
4 files changed
modified .github/workflows/respond-to-cubic.yaml +2 −2
| @@ -91,7 +91,7 @@ | ||
| 91 | 91 | Please analyze the current PR, understand the request, implement the necessary changes, and commit them to this branch." |
| 92 | 92 | |
| 93 | 93 | # 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 }}) | |
| 95 | 95 | echo "Raw session output: $SESSION_OUTPUT" |
| 96 | 96 | |
| 97 | 97 | # Extract URL from JSON output |
| @@ -195,7 +195,7 @@ | ||
| 195 | 195 | |
| 196 | 196 | # Start remote session and capture JSON output |
| 197 | 197 | 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 }}) | |
| 199 | 199 | echo "Raw session output: $SESSION_OUTPUT" |
| 200 | 200 | |
| 201 | 201 | # Extract URL from JSON output |
modified extensions/cli/src/commands/remote.test.ts +65 −0
| @@ -236,6 +236,71 @@ | ||
| 236 | 236 | prompt: "test prompt", |
| 237 | 237 | idempotencyKey: testIdempotencyKey, |
| 238 | 238 | 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, | |
| 239 | 304 | }); |
| 240 | 305 | }); |
| 241 | 306 |
modified extensions/cli/src/commands/remote.ts +3 −0
| @@ -16,6 +16,7 @@ | ||
| 16 | 16 | start?: boolean; |
| 17 | 17 | branch?: string; |
| 18 | 18 | repo?: string; |
| 19 | + config?: string; | |
| 19 | 20 | } = {}, |
| 20 | 21 | ) { |
| 21 | 22 | // Check if prompt should come from stdin instead of parameter |
| @@ -84,6 +85,8 @@ | ||
| 84 | 85 | name: `devbox-${Date.now()}`, |
| 85 | 86 | prompt: actualPrompt, |
| 86 | 87 | idempotencyKey: options.idempotencyKey, |
| 88 | + agent: options.config, | |
| 89 | + config: options.config, | |
| 87 | 90 | }; |
| 88 | 91 | |
| 89 | 92 | // Add branchName to request body if branch option is provided |
modified extensions/cli/src/index.ts +5 −3
| @@ -218,9 +218,11 @@ | ||
| 218 | 218 | }); |
| 219 | 219 | |
| 220 | 220 | // 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 | +) | |
| 224 | 226 | .option( |
| 225 | 227 | "--url <url>", |
| 226 | 228 | "Connect directly to the specified URL instead of creating a new remote environment", |