@eldrforge/kodrdriv 1.2.13 → 1.2.16

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.
@@ -446,7 +446,7 @@ const execute = async (runConfig)=>{
446
446
  if (pr) {
447
447
  logger.info(`Found existing pull request for branch: ${pr.html_url}`);
448
448
  } else {
449
- var _runConfig_publish4, _runConfig_publish5, _runConfig_publish6, _runConfig_publish7, _runConfig_publish8;
449
+ var _runConfig_publish4, _runConfig_publish5, _runConfig_publish6, _runConfig_publish7, _runConfig_publish8, _runConfig_publish9, _runConfig_publish10, _runConfig_publish11;
450
450
  logger.info('No open pull request found, starting new release publishing process...');
451
451
  // STEP 1: Prepare for release (update dependencies and run prepublish checks) with NO version bump yet
452
452
  logger.verbose('Preparing for release: switching from workspace to remote dependencies.');
@@ -587,7 +587,7 @@ const execute = async (runConfig)=>{
587
587
  logger.info('Would determine target version and update package.json');
588
588
  newVersion = '1.0.0'; // Mock version for dry run
589
589
  } else {
590
- var _runConfig_publish9;
590
+ var _runConfig_publish12;
591
591
  const packageJsonContents = await storage.readFile('package.json', 'utf-8');
592
592
  const parsed = safeJsonParse(packageJsonContents, 'package.json');
593
593
  const packageJson = validatePackageJson(parsed, 'package.json');
@@ -604,9 +604,9 @@ const execute = async (runConfig)=>{
604
604
  // Update targetBranch for the rest of the function
605
605
  targetBranch = finalTargetBranch;
606
606
  } else {
607
- var _runConfig_publish10;
607
+ var _runConfig_publish13;
608
608
  // Use existing logic for backward compatibility
609
- const targetVersionInput = ((_runConfig_publish10 = runConfig.publish) === null || _runConfig_publish10 === void 0 ? void 0 : _runConfig_publish10.targetVersion) || 'patch';
609
+ const targetVersionInput = ((_runConfig_publish13 = runConfig.publish) === null || _runConfig_publish13 === void 0 ? void 0 : _runConfig_publish13.targetVersion) || 'patch';
610
610
  proposedVersion = calculateTargetVersion(currentVersion, targetVersionInput);
611
611
  }
612
612
  const targetTagName = `v${proposedVersion}`;
@@ -614,9 +614,9 @@ const execute = async (runConfig)=>{
614
614
  if (tagExists) {
615
615
  throw new Error(`Tag ${targetTagName} already exists. Please choose a different version or delete the existing tag.`);
616
616
  }
617
- if ((_runConfig_publish9 = runConfig.publish) === null || _runConfig_publish9 === void 0 ? void 0 : _runConfig_publish9.interactive) {
618
- var _runConfig_publish11;
619
- newVersion = await confirmVersionInteractively(currentVersion, proposedVersion, (_runConfig_publish11 = runConfig.publish) === null || _runConfig_publish11 === void 0 ? void 0 : _runConfig_publish11.targetVersion);
617
+ if ((_runConfig_publish12 = runConfig.publish) === null || _runConfig_publish12 === void 0 ? void 0 : _runConfig_publish12.interactive) {
618
+ var _runConfig_publish14;
619
+ newVersion = await confirmVersionInteractively(currentVersion, proposedVersion, (_runConfig_publish14 = runConfig.publish) === null || _runConfig_publish14 === void 0 ? void 0 : _runConfig_publish14.targetVersion);
620
620
  const confirmedTagName = `v${newVersion}`;
621
621
  const confirmedTagExists = await checkIfTagExists(confirmedTagName);
622
622
  if (confirmedTagExists) {
@@ -644,33 +644,33 @@ const execute = async (runConfig)=>{
644
644
  }
645
645
  }
646
646
  logger.info('Generating release notes...');
647
+ // Use the existing currentBranch variable for tag detection
648
+ logger.debug(`Current branch for release notes: ${currentBranch}`);
647
649
  // Create a modified config for release notes generation that includes the publish --from, --interactive, and --from-main options
648
650
  const releaseConfig = {
649
651
  ...runConfig
650
652
  };
651
- if (((_runConfig_publish6 = runConfig.publish) === null || _runConfig_publish6 === void 0 ? void 0 : _runConfig_publish6.from) || ((_runConfig_publish7 = runConfig.publish) === null || _runConfig_publish7 === void 0 ? void 0 : _runConfig_publish7.interactive) || ((_runConfig_publish8 = runConfig.publish) === null || _runConfig_publish8 === void 0 ? void 0 : _runConfig_publish8.fromMain)) {
652
- // Pass the publish options to the release config
653
- releaseConfig.release = {
654
- ...runConfig.release,
655
- ...runConfig.publish.from && {
656
- from: runConfig.publish.from
657
- },
658
- ...runConfig.publish.interactive && {
659
- interactive: runConfig.publish.interactive
660
- },
661
- ...runConfig.publish.fromMain && {
662
- fromMain: runConfig.publish.fromMain
663
- }
664
- };
665
- if (runConfig.publish.from) {
666
- logger.verbose(`Using custom 'from' reference for release notes: ${runConfig.publish.from}`);
667
- }
668
- if (runConfig.publish.interactive) {
669
- logger.verbose('Interactive mode enabled for release notes generation');
670
- }
671
- if (runConfig.publish.fromMain) {
672
- logger.verbose('Forcing comparison against main branch for release notes');
653
+ releaseConfig.release = {
654
+ ...runConfig.release,
655
+ currentBranch: currentBranch,
656
+ ...((_runConfig_publish6 = runConfig.publish) === null || _runConfig_publish6 === void 0 ? void 0 : _runConfig_publish6.from) && {
657
+ from: runConfig.publish.from
658
+ },
659
+ ...((_runConfig_publish7 = runConfig.publish) === null || _runConfig_publish7 === void 0 ? void 0 : _runConfig_publish7.interactive) && {
660
+ interactive: runConfig.publish.interactive
661
+ },
662
+ ...((_runConfig_publish8 = runConfig.publish) === null || _runConfig_publish8 === void 0 ? void 0 : _runConfig_publish8.fromMain) && {
663
+ fromMain: runConfig.publish.fromMain
673
664
  }
665
+ };
666
+ if ((_runConfig_publish9 = runConfig.publish) === null || _runConfig_publish9 === void 0 ? void 0 : _runConfig_publish9.from) {
667
+ logger.verbose(`Using custom 'from' reference for release notes: ${runConfig.publish.from}`);
668
+ }
669
+ if ((_runConfig_publish10 = runConfig.publish) === null || _runConfig_publish10 === void 0 ? void 0 : _runConfig_publish10.interactive) {
670
+ logger.verbose('Interactive mode enabled for release notes generation');
671
+ }
672
+ if ((_runConfig_publish11 = runConfig.publish) === null || _runConfig_publish11 === void 0 ? void 0 : _runConfig_publish11.fromMain) {
673
+ logger.verbose('Forcing comparison against main branch for release notes');
674
674
  }
675
675
  const releaseSummary = await execute$2(releaseConfig);
676
676
  if (isDryRun) {
@@ -707,12 +707,12 @@ const execute = async (runConfig)=>{
707
707
  }
708
708
  logger.info(`Waiting for PR #${pr.number} checks to complete...`);
709
709
  if (!isDryRun) {
710
- var _runConfig_publish12, _runConfig_publish13, _runConfig_publish14;
710
+ var _runConfig_publish15, _runConfig_publish16, _runConfig_publish17;
711
711
  // Configure timeout and user confirmation behavior
712
- const timeout = ((_runConfig_publish12 = runConfig.publish) === null || _runConfig_publish12 === void 0 ? void 0 : _runConfig_publish12.checksTimeout) || KODRDRIV_DEFAULTS.publish.checksTimeout;
713
- const senditMode = ((_runConfig_publish13 = runConfig.publish) === null || _runConfig_publish13 === void 0 ? void 0 : _runConfig_publish13.sendit) || false;
712
+ const timeout = ((_runConfig_publish15 = runConfig.publish) === null || _runConfig_publish15 === void 0 ? void 0 : _runConfig_publish15.checksTimeout) || KODRDRIV_DEFAULTS.publish.checksTimeout;
713
+ const senditMode = ((_runConfig_publish16 = runConfig.publish) === null || _runConfig_publish16 === void 0 ? void 0 : _runConfig_publish16.sendit) || false;
714
714
  // sendit flag overrides skipUserConfirmation - if sendit is true, skip confirmation
715
- const skipUserConfirmation = senditMode || ((_runConfig_publish14 = runConfig.publish) === null || _runConfig_publish14 === void 0 ? void 0 : _runConfig_publish14.skipUserConfirmation) || false;
715
+ const skipUserConfirmation = senditMode || ((_runConfig_publish17 = runConfig.publish) === null || _runConfig_publish17 === void 0 ? void 0 : _runConfig_publish17.skipUserConfirmation) || false;
716
716
  await waitForPullRequestChecks(pr.number, {
717
717
  timeout,
718
718
  skipUserConfirmation
@@ -913,9 +913,9 @@ const execute = async (runConfig)=>{
913
913
  }
914
914
  logger.info('Creating GitHub release...');
915
915
  if (isDryRun) {
916
- var _runConfig_publish15;
916
+ var _runConfig_publish18;
917
917
  logger.info('Would read package.json version and create GitHub release with retry logic');
918
- const milestonesEnabled = !((_runConfig_publish15 = runConfig.publish) === null || _runConfig_publish15 === void 0 ? void 0 : _runConfig_publish15.noMilestones);
918
+ const milestonesEnabled = !((_runConfig_publish18 = runConfig.publish) === null || _runConfig_publish18 === void 0 ? void 0 : _runConfig_publish18.noMilestones);
919
919
  if (milestonesEnabled) {
920
920
  logger.info('Would close milestone for released version');
921
921
  } else {
@@ -931,11 +931,11 @@ const execute = async (runConfig)=>{
931
931
  let retries = 3;
932
932
  while(retries > 0){
933
933
  try {
934
- var _runConfig_publish16;
934
+ var _runConfig_publish19;
935
935
  await createRelease(tagName, releaseTitle, releaseNotesContent);
936
936
  logger.info(`GitHub release created successfully for tag: ${tagName}`);
937
937
  // Close milestone for this version if enabled
938
- const milestonesEnabled = !((_runConfig_publish16 = runConfig.publish) === null || _runConfig_publish16 === void 0 ? void 0 : _runConfig_publish16.noMilestones);
938
+ const milestonesEnabled = !((_runConfig_publish19 = runConfig.publish) === null || _runConfig_publish19 === void 0 ? void 0 : _runConfig_publish19.noMilestones);
939
939
  if (milestonesEnabled) {
940
940
  logger.info('🏁 Closing milestone for released version...');
941
941
  const version = tagName.replace(/^v/, ''); // Remove 'v' prefix if present
@@ -968,12 +968,12 @@ const execute = async (runConfig)=>{
968
968
  if (isDryRun) {
969
969
  logger.info('Would monitor GitHub Actions workflows triggered by release');
970
970
  } else {
971
- var _runConfig_publish17, _runConfig_publish18, _runConfig_publish19, _runConfig_publish20;
972
- const workflowTimeout = ((_runConfig_publish17 = runConfig.publish) === null || _runConfig_publish17 === void 0 ? void 0 : _runConfig_publish17.releaseWorkflowsTimeout) || KODRDRIV_DEFAULTS.publish.releaseWorkflowsTimeout;
973
- const senditMode = ((_runConfig_publish18 = runConfig.publish) === null || _runConfig_publish18 === void 0 ? void 0 : _runConfig_publish18.sendit) || false;
974
- const skipUserConfirmation = senditMode || ((_runConfig_publish19 = runConfig.publish) === null || _runConfig_publish19 === void 0 ? void 0 : _runConfig_publish19.skipUserConfirmation) || false;
971
+ var _runConfig_publish20, _runConfig_publish21, _runConfig_publish22, _runConfig_publish23;
972
+ const workflowTimeout = ((_runConfig_publish20 = runConfig.publish) === null || _runConfig_publish20 === void 0 ? void 0 : _runConfig_publish20.releaseWorkflowsTimeout) || KODRDRIV_DEFAULTS.publish.releaseWorkflowsTimeout;
973
+ const senditMode = ((_runConfig_publish21 = runConfig.publish) === null || _runConfig_publish21 === void 0 ? void 0 : _runConfig_publish21.sendit) || false;
974
+ const skipUserConfirmation = senditMode || ((_runConfig_publish22 = runConfig.publish) === null || _runConfig_publish22 === void 0 ? void 0 : _runConfig_publish22.skipUserConfirmation) || false;
975
975
  // Get workflow names - either from config or auto-detect
976
- let workflowNames = (_runConfig_publish20 = runConfig.publish) === null || _runConfig_publish20 === void 0 ? void 0 : _runConfig_publish20.releaseWorkflowNames;
976
+ let workflowNames = (_runConfig_publish23 = runConfig.publish) === null || _runConfig_publish23 === void 0 ? void 0 : _runConfig_publish23.releaseWorkflowNames;
977
977
  if (!workflowNames || workflowNames.length === 0) {
978
978
  logger.info('No specific workflow names configured, auto-detecting workflows triggered by release events...');
979
979
  try {
@@ -997,64 +997,12 @@ const execute = async (runConfig)=>{
997
997
  } else {
998
998
  logger.verbose('Skipping waiting for release workflows (disabled in config).');
999
999
  }
1000
- // Switch back to source branch and sync with target
1001
1000
  logger.info('');
1002
- logger.info('🔄 Syncing source branch with target after publish...');
1003
- await runWithDryRunSupport(`git checkout ${currentBranch}`, isDryRun);
1004
- if (!isDryRun) {
1005
- // Merge target into source (should be fast-forward since PR just merged)
1006
- logger.info(`Merging ${targetBranch} into ${currentBranch}...`);
1007
- try {
1008
- await run(`git merge ${targetBranch} --ff-only`);
1009
- logger.info(`✅ Merged ${targetBranch} into ${currentBranch}`);
1010
- } catch (error) {
1011
- // If ff-only fails, something is wrong - source diverged somehow
1012
- logger.error(`❌ Failed to fast-forward merge ${targetBranch} into ${currentBranch}`);
1013
- logger.error(' This suggests the source branch has commits not in target.');
1014
- logger.error(' This should not happen after a successful PR merge.');
1015
- logger.warn('⚠️ Attempting regular merge...');
1016
- await run(`git merge ${targetBranch} --no-edit`);
1017
- }
1018
- // Determine version bump based on branch configuration
1019
- let versionCommand = 'prepatch'; // Default
1020
- let versionTag = 'dev'; // Default
1021
- if (branchDependentVersioning && runConfig.branches) {
1022
- const sourceBranchConfig = runConfig.branches[currentBranch];
1023
- if (sourceBranchConfig === null || sourceBranchConfig === void 0 ? void 0 : sourceBranchConfig.version) {
1024
- // Use configured version strategy for source branch
1025
- if (sourceBranchConfig.version.increment) {
1026
- versionCommand = `pre${sourceBranchConfig.version.increment}`;
1027
- }
1028
- if (sourceBranchConfig.version.tag) {
1029
- versionTag = sourceBranchConfig.version.tag;
1030
- }
1031
- }
1032
- }
1033
- // Bump to next development version
1034
- logger.info(`Bumping to next development version...`);
1035
- try {
1036
- const { stdout: newVersion } = await run(`npm version ${versionCommand} --preid=${versionTag}`);
1037
- logger.info(`✅ Version bumped to: ${newVersion.trim()}`);
1038
- } catch (versionError) {
1039
- logger.warn(`⚠️ Failed to bump version: ${versionError.message}`);
1040
- logger.warn(' You may need to manually bump the version for next development cycle.');
1041
- }
1042
- // Push updated source branch
1043
- logger.info(`Pushing updated ${currentBranch} branch...`);
1044
- try {
1045
- await run(`git push origin ${currentBranch}`);
1046
- logger.info(`✅ Pushed ${currentBranch} to origin`);
1047
- } catch (pushError) {
1048
- logger.warn(`⚠️ Failed to push ${currentBranch}: ${pushError.message}`);
1049
- logger.warn(` Please push manually: git push origin ${currentBranch}`);
1050
- }
1051
- } else {
1052
- logger.info(`Would merge ${targetBranch} into ${currentBranch} with --ff-only`);
1053
- logger.info(`Would bump version to next development version`);
1054
- logger.info(`Would push ${currentBranch} to origin`);
1055
- }
1001
+ logger.info(`✅ Publish complete!`);
1056
1002
  logger.info('');
1057
- logger.info(`✅ Publish complete - on ${currentBranch} with next development version`);
1003
+ logger.info(`💡 Next steps:`);
1004
+ logger.info(` - Run 'kodrdriv development' to return to working branch and bump version`);
1005
+ logger.info(` - Or manually switch to your working branch to continue development`);
1058
1006
  };
1059
1007
 
1060
1008
  export { execute };