@posthog/agent 2.1.156 → 2.1.157

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/agent",
3
- "version": "2.1.156",
3
+ "version": "2.1.157",
4
4
  "repository": "https://github.com/PostHog/twig",
5
5
  "description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
6
6
  "exports": {
@@ -384,5 +384,33 @@ describe("AgentServer HTTP Mode", () => {
384
384
  expect(prompt).toContain("Create a draft pull request");
385
385
  expect(prompt).toContain("gh pr create --draft");
386
386
  });
387
+
388
+ it("includes --base flag when baseBranch is configured", () => {
389
+ server = new AgentServer({
390
+ port,
391
+ jwtPublicKey: TEST_PUBLIC_KEY,
392
+ repositoryPath: repo.path,
393
+ apiUrl: "http://localhost:8000",
394
+ apiKey: "test-api-key",
395
+ projectId: 1,
396
+ mode: "interactive",
397
+ taskId: "test-task-id",
398
+ runId: "test-run-id",
399
+ baseBranch: "add-yolo-to-readme",
400
+ });
401
+ const prompt = (
402
+ server as unknown as TestableServer
403
+ ).buildCloudSystemPrompt();
404
+ expect(prompt).toContain(
405
+ "gh pr create --draft --base add-yolo-to-readme",
406
+ );
407
+ });
408
+
409
+ it("omits --base flag when baseBranch is not configured", () => {
410
+ const s = createServer();
411
+ const prompt = (s as unknown as TestableServer).buildCloudSystemPrompt();
412
+ expect(prompt).toContain("gh pr create --draft`");
413
+ expect(prompt).not.toContain("--base");
414
+ });
387
415
  });
388
416
  });
@@ -747,7 +747,7 @@ After completing the requested changes:
747
747
  1. Create a new branch with a descriptive name based on the work done
748
748
  2. Stage and commit all changes with a clear commit message
749
749
  3. Push the branch to origin
750
- 4. Create a draft pull request using \`gh pr create --draft\` with a descriptive title and body
750
+ 4. Create a draft pull request using \`gh pr create --draft${this.config.baseBranch ? ` --base ${this.config.baseBranch}` : ""}\` with a descriptive title and body
751
751
 
752
752
  Important:
753
753
  - Always create the PR as a draft. Do not ask for confirmation.
package/src/server/bin.ts CHANGED
@@ -50,6 +50,7 @@ program
50
50
  "--mcpServers <json>",
51
51
  "MCP servers config as JSON array (ACP McpServer[] format)",
52
52
  )
53
+ .option("--baseBranch <branch>", "Base branch for PR creation")
53
54
  .action(async (options) => {
54
55
  const envResult = envSchema.safeParse(process.env);
55
56
 
@@ -99,6 +100,7 @@ program
99
100
  taskId: options.taskId,
100
101
  runId: options.runId,
101
102
  mcpServers,
103
+ baseBranch: options.baseBranch,
102
104
  });
103
105
 
104
106
  process.on("SIGINT", async () => {
@@ -13,4 +13,5 @@ export interface AgentServerConfig {
13
13
  runId: string;
14
14
  version?: string;
15
15
  mcpServers?: RemoteMcpServer[];
16
+ baseBranch?: string;
16
17
  }