@eldrforge/kodrdriv 1.2.20 → 1.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import { hasStagedChanges } from '../content/diff.js';
4
4
  import { execute as execute$2 } from './release.js';
5
5
  import { getDryRunLogger, getLogger } from '../logging.js';
6
6
  import { run, localBranchExists, runSecure, runWithDryRunSupport, safeJsonParse, validatePackageJson, validateGitRef, safeSyncBranchWithRemote, isBranchInSyncWithRemote } from '@eldrforge/git-tools';
7
- import { getCurrentBranchName, findOpenPullRequestByHeadRef, createPullRequest, waitForPullRequestChecks, mergePullRequest, createRelease, closeMilestoneForVersion, getWorkflowsTriggeredByRelease, waitForReleaseWorkflows } from '../util/github.js';
7
+ import * as GitHub from '@eldrforge/github-tools';
8
8
  import { create } from '../util/storage.js';
9
9
  import { calculateBranchDependentVersion, calculateTargetVersion, checkIfTagExists, confirmVersionInteractively, getOutputPath } from '../util/general.js';
10
10
  import { DEFAULT_OUTPUT_DIRECTORY, KODRDRIV_DEFAULTS } from '../constants.js';
@@ -171,7 +171,7 @@ const runPrechecks = async (runConfig, targetBranch)=>{
171
171
  if (isDryRun) {
172
172
  logger.info(`Would verify current branch is not the target branch (${effectiveTargetBranch})`);
173
173
  } else {
174
- const currentBranch = await getCurrentBranchName();
174
+ const currentBranch = await GitHub.getCurrentBranchName();
175
175
  if (currentBranch === effectiveTargetBranch) {
176
176
  throw new Error(`Cannot run publish from the target branch '${effectiveTargetBranch}'. Please switch to a different branch before running publish.`);
177
177
  }
@@ -277,7 +277,7 @@ const sortObjectKeys = (value)=>{
277
277
  const isReleaseNecessaryComparedToTarget = async (targetBranch, isDryRun)=>{
278
278
  const logger = getDryRunLogger(isDryRun);
279
279
  // We compare current HEAD branch to the provided target branch
280
- const currentBranch = await getCurrentBranchName();
280
+ const currentBranch = await GitHub.getCurrentBranchName();
281
281
  // Check if target branch exists before trying to compare
282
282
  try {
283
283
  // Validate target branch exists and is accessible
@@ -393,7 +393,7 @@ const execute = async (runConfig)=>{
393
393
  if (isDryRun) {
394
394
  currentBranch = 'mock-branch';
395
395
  } else {
396
- currentBranch = await getCurrentBranchName();
396
+ currentBranch = await GitHub.getCurrentBranchName();
397
397
  // Fetch latest remote information to avoid conflicts
398
398
  logger.info('📡 Fetching latest remote information to avoid conflicts...');
399
399
  try {
@@ -509,8 +509,8 @@ const execute = async (runConfig)=>{
509
509
  logger.info('Would check for existing pull request');
510
510
  logger.info('Assuming no existing PR found for demo purposes');
511
511
  } else {
512
- const branchName = await getCurrentBranchName();
513
- pr = await findOpenPullRequestByHeadRef(branchName);
512
+ const branchName = await GitHub.getCurrentBranchName();
513
+ pr = await GitHub.findOpenPullRequestByHeadRef(branchName);
514
514
  }
515
515
  if (pr) {
516
516
  logger.info(`Found existing pull request for branch: ${pr.html_url}`);
@@ -758,7 +758,7 @@ const execute = async (runConfig)=>{
758
758
  }
759
759
  logger.info('Pushing to origin...');
760
760
  // Get current branch name and push explicitly to avoid pushing to wrong remote/branch
761
- const branchName = await getCurrentBranchName();
761
+ const branchName = await GitHub.getCurrentBranchName();
762
762
  await runWithDryRunSupport(`git push origin ${branchName}`, isDryRun);
763
763
  logger.info('Creating pull request...');
764
764
  if (isDryRun) {
@@ -770,7 +770,7 @@ const execute = async (runConfig)=>{
770
770
  };
771
771
  } else {
772
772
  const { stdout: commitTitle } = await run('git log -1 --pretty=%B');
773
- pr = await createPullRequest(commitTitle, 'Automated release PR.', branchName, targetBranch);
773
+ pr = await GitHub.createPullRequest(commitTitle, 'Automated release PR.', branchName, targetBranch);
774
774
  if (!pr) {
775
775
  throw new Error('Failed to create pull request.');
776
776
  }
@@ -785,7 +785,7 @@ const execute = async (runConfig)=>{
785
785
  const senditMode = ((_runConfig_publish16 = runConfig.publish) === null || _runConfig_publish16 === void 0 ? void 0 : _runConfig_publish16.sendit) || false;
786
786
  // sendit flag overrides skipUserConfirmation - if sendit is true, skip confirmation
787
787
  const skipUserConfirmation = senditMode || ((_runConfig_publish17 = runConfig.publish) === null || _runConfig_publish17 === void 0 ? void 0 : _runConfig_publish17.skipUserConfirmation) || false;
788
- await waitForPullRequestChecks(pr.number, {
788
+ await GitHub.waitForPullRequestChecks(pr.number, {
789
789
  timeout,
790
790
  skipUserConfirmation
791
791
  });
@@ -795,7 +795,7 @@ const execute = async (runConfig)=>{
795
795
  logger.info(`Would merge PR #${pr.number} using ${mergeMethod} method`);
796
796
  } else {
797
797
  try {
798
- await mergePullRequest(pr.number, mergeMethod, false); // Don't delete branch
798
+ await GitHub.mergePullRequest(pr.number, mergeMethod, false); // Don't delete branch
799
799
  } catch (error) {
800
800
  // Check if this is a merge conflict error
801
801
  if (error.message && (error.message.includes('not mergeable') || error.message.includes('Pull Request is not mergeable') || error.message.includes('merge conflict'))) {
@@ -1004,14 +1004,14 @@ const execute = async (runConfig)=>{
1004
1004
  while(retries > 0){
1005
1005
  try {
1006
1006
  var _runConfig_publish19;
1007
- await createRelease(tagName, releaseTitle, releaseNotesContent);
1007
+ await GitHub.createRelease(tagName, releaseTitle, releaseNotesContent);
1008
1008
  logger.info(`GitHub release created successfully for tag: ${tagName}`);
1009
1009
  // Close milestone for this version if enabled
1010
1010
  const milestonesEnabled = !((_runConfig_publish19 = runConfig.publish) === null || _runConfig_publish19 === void 0 ? void 0 : _runConfig_publish19.noMilestones);
1011
1011
  if (milestonesEnabled) {
1012
1012
  logger.info('🏁 Closing milestone for released version...');
1013
1013
  const version = tagName.replace(/^v/, ''); // Remove 'v' prefix if present
1014
- await closeMilestoneForVersion(version);
1014
+ await GitHub.closeMilestoneForVersion(version);
1015
1015
  } else {
1016
1016
  logger.debug('Milestone integration disabled via --no-milestones');
1017
1017
  }
@@ -1049,7 +1049,7 @@ const execute = async (runConfig)=>{
1049
1049
  if (!workflowNames || workflowNames.length === 0) {
1050
1050
  logger.info('No specific workflow names configured, auto-detecting workflows triggered by release events...');
1051
1051
  try {
1052
- workflowNames = await getWorkflowsTriggeredByRelease();
1052
+ workflowNames = await GitHub.getWorkflowsTriggeredByRelease();
1053
1053
  if (workflowNames.length === 0) {
1054
1054
  logger.info('No workflows found that are triggered by release events.');
1055
1055
  } else {
@@ -1060,7 +1060,7 @@ const execute = async (runConfig)=>{
1060
1060
  workflowNames = undefined; // Fall back to monitoring all workflows
1061
1061
  }
1062
1062
  }
1063
- await waitForReleaseWorkflows(tagName, {
1063
+ await GitHub.waitForReleaseWorkflows(tagName, {
1064
1064
  timeout: workflowTimeout,
1065
1065
  workflowNames,
1066
1066
  skipUserConfirmation