import {
  createGitForPath
} from "./chunk-2UFQ3A3C.js";
import {
  BRANCHES
} from "./chunk-DWMLTXKQ.js";

// ../core/dist/core/worktree-guard.js
import path from "path";
var WORKTREE_PATH_PATTERN = /worktrees\/([\w-]+)-wu-(\d+)/;
async function isMainBranch(options = {}) {
  const git = options.git || createGitForPath(process.cwd());
  const branch = await git.getCurrentBranch();
  return branch === BRANCHES.MAIN || branch === BRANCHES.MASTER;
}
function normalizePath(p) {
  return p.replace(/\\/g, "/").split(path.sep).join("/");
}
function isInWorktree(options = {}) {
  const cwd = options.cwd || process.cwd();
  const normalizedPath = normalizePath(cwd);
  return WORKTREE_PATH_PATTERN.test(normalizedPath);
}

export {
  isMainBranch,
  isInWorktree
};
