@jjdenhertog/ai-driven-development
Version:
AI-driven development workflow with learning capabilities for Claude
37 lines • 1.77 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMainBranch = getMainBranch;
const getGitInstance_1 = require("./getGitInstance");
function getMainBranch() {
return __awaiter(this, void 0, void 0, function* () {
try {
const git = (0, getGitInstance_1.getGitInstance)();
// Get all branches (local and remote)
const branches = yield git.branch(['-a']);
const allBranches = branches.all;
// Check for common main branch names in remote branches
const commonMainBranches = ['main', 'master', 'develop', 'development'];
for (const branch of commonMainBranches) {
if (allBranches.some(b => b.includes(`remotes/origin/${branch}`))) {
console.log(`Found main branch: ${branch}`);
return branch;
}
}
// Default to 'main'
return 'main';
}
catch (_a) {
return 'main';
}
});
}
//# sourceMappingURL=getMainBranch.js.map