Drop usage of execSync, switch to $ util

This commit is contained in:
Colin McDonnell
2025-11-20 15:37:34 -08:00
parent 43acacd25a
commit e5878de9e4
7 changed files with 106 additions and 27 deletions
+2 -4
View File
@@ -1,6 +1,6 @@
import { execSync } from "node:child_process";
import { type } from "arktype";
import { log } from "../utils/cli.ts";
import { $ } from "../utils/shell.ts";
import { contextualize, tool } from "./shared.ts";
export const PullRequest = type({
@@ -15,9 +15,7 @@ export const PullRequestTool = tool({
parameters: PullRequest,
execute: contextualize(async ({ title, body, base }, ctx) => {
// Get the current branch name
const currentBranch = execSync("git rev-parse --abbrev-ref HEAD", {
encoding: "utf8",
}).trim();
const currentBranch = $("git", ["rev-parse", "--abbrev-ref", "HEAD"], { log: false });
log.info(`Current branch: ${currentBranch}`);