add branch logic mcp tool
This commit is contained in:
+3
-2
@@ -30,8 +30,9 @@ export const CreateBranchTool = tool({
|
|||||||
// fetch base branch to ensure we're up to date
|
// fetch base branch to ensure we're up to date
|
||||||
$("git", ["fetch", "origin", baseBranch, "--depth=1"]);
|
$("git", ["fetch", "origin", baseBranch, "--depth=1"]);
|
||||||
|
|
||||||
// checkout base branch
|
// checkout base branch, ensuring it matches the remote version
|
||||||
$("git", ["checkout", baseBranch]);
|
// -B creates or resets the branch to match origin/baseBranch
|
||||||
|
$("git", ["checkout", "-B", baseBranch, `origin/${baseBranch}`]);
|
||||||
|
|
||||||
// create and checkout new branch
|
// create and checkout new branch
|
||||||
$("git", ["checkout", "-b", branchName]);
|
$("git", ["checkout", "-b", branchName]);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { log } from "./cli.ts";
|
|
||||||
import { reportProgress } from "../mcp/comment.ts";
|
import { reportProgress } from "../mcp/comment.ts";
|
||||||
import { getMcpContext } from "../mcp/shared.ts";
|
import { getMcpContext } from "../mcp/shared.ts";
|
||||||
|
import { log } from "./cli.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if MCP context is initialized (i.e., MCP server has started)
|
* Check if MCP context is initialized (i.e., MCP server has started)
|
||||||
@@ -37,9 +37,7 @@ export async function reportErrorToComment({
|
|||||||
await reportProgress({ body: formattedError });
|
await reportProgress({ body: formattedError });
|
||||||
} catch (reportError) {
|
} catch (reportError) {
|
||||||
// log but don't throw - we don't want error reporting to fail the workflow
|
// log but don't throw - we don't want error reporting to fail the workflow
|
||||||
const errorMessage =
|
const errorMessage = reportError instanceof Error ? reportError.message : String(reportError);
|
||||||
reportError instanceof Error ? reportError.message : String(reportError);
|
|
||||||
log.warning(`failed to report error to comment: ${errorMessage}`);
|
log.warning(`failed to report error to comment: ${errorMessage}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user