Skip to content

Commit 1e1cd29

Browse files
authored
feat: Auto-rename workspace branches before pushing to origin (#610)
1 parent 4889e9f commit 1e1cd29

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

packages/agent/src/adapters/claude/agent.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,20 +313,28 @@ export class ClaudeAcpAgent extends BaseAcpAgent implements Agent {
313313
addAcpMcpServer(mcpServers, this, sessionId, this.clientCapabilities);
314314
}
315315

316+
const branchNamingInstructions = `
317+
# Branch Naming
318+
319+
Before pushing a "workspace-*" branch to origin, rename it to something descriptive based on the work done. Do this automatically without asking the user.
320+
`;
321+
316322
let systemPrompt: Options["systemPrompt"] = {
317323
type: "preset",
318324
preset: "claude_code",
325+
append: branchNamingInstructions,
319326
};
327+
320328
if (params._meta?.systemPrompt) {
321329
const customPrompt = params._meta.systemPrompt;
322330
if (typeof customPrompt === "string") {
323-
systemPrompt = customPrompt;
331+
systemPrompt = customPrompt + branchNamingInstructions;
324332
} else if (
325333
typeof customPrompt === "object" &&
326334
"append" in customPrompt &&
327335
typeof customPrompt.append === "string"
328336
) {
329-
systemPrompt.append = customPrompt.append;
337+
systemPrompt.append = customPrompt.append + branchNamingInstructions;
330338
}
331339
}
332340

packages/agent/src/adapters/claude/session-helpers.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,21 @@ export interface BuildOptionsParams {
7474
additionalDirectories?: string[];
7575
}
7676

77+
const BRANCH_NAMING_INSTRUCTIONS = `
78+
# Branch Naming
79+
80+
Before pushing a "workspace-*" branch to origin, rename it to something descriptive based on the work done. Do this automatically without asking the user.
81+
`;
82+
7783
function buildBaseOptions(params: BuildOptionsParams): Options {
84+
const defaultSystemPrompt: Options["systemPrompt"] = {
85+
type: "preset",
86+
preset: "claude_code",
87+
append: BRANCH_NAMING_INSTRUCTIONS,
88+
};
89+
7890
return {
79-
systemPrompt: params.systemPrompt ?? {
80-
type: "preset",
81-
preset: "claude_code",
82-
},
91+
systemPrompt: params.systemPrompt ?? defaultSystemPrompt,
8392
settingSources: ["user", "project", "local"],
8493
stderr: (err) => params.logger.error(err),
8594
cwd: params.cwd,

0 commit comments

Comments
 (0)