@vypdev/copilot 3.3.0 → 3.3.1

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.
@@ -56991,7 +56991,7 @@ function sanitizeTitle(title) {
56991
56991
 
56992
56992
  Object.defineProperty(exports, "__esModule", ({ value: true }));
56993
56993
  exports.buildDeploymentMergePlan = buildDeploymentMergePlan;
56994
- /** Returns the ordered merge operations required after a successful deployment. */
56994
+ /** Returns the merge operations required after a successful deployment. */
56995
56995
  function buildDeploymentMergePlan(configuration) {
56996
56996
  if (configuration.releaseBranch) {
56997
56997
  return [
@@ -58865,7 +58865,7 @@ const deployed_action_policy_1 = __nccwpck_require__(5510);
58865
58865
  const logging_ports_1 = __nccwpck_require__(6152);
58866
58866
  const task_emoji_1 = __nccwpck_require__(46103);
58867
58867
  const TASK_ID = 'DeployedActionUseCase';
58868
- /** Replaces the deploy label, performs ordered merges, and closes only after all succeed. */
58868
+ /** Replaces the deploy label, performs the required merges, and closes only after all succeed. */
58869
58869
  async function runDeployedActionWorkflow(param, dependencies) {
58870
58870
  (0, logging_ports_1.logInfo)(`${(0, task_emoji_1.getTaskEmoji)(TASK_ID)} Executing ${TASK_ID}.`);
58871
58871
  const results = [];
@@ -58936,9 +58936,17 @@ async function mergeBranches(param, branchMergePort) {
58936
58936
  defaultBranch: param.branches.defaultBranch,
58937
58937
  developmentBranch: param.branches.development,
58938
58938
  });
58939
+ const executeMerge = (source, target) => (branchMergePort.mergeBranch(param.owner, param.repo, source, target, param.pullRequest.mergeTimeout, param.tokens.token));
58940
+ // Both release merges use the immutable release branch as their source, so
58941
+ // their PRs and checks are independent and can run concurrently. A hotfix
58942
+ // must remain sequential because the second merge uses the updated default
58943
+ // branch produced by the first merge.
58944
+ if (param.currentConfiguration.releaseBranch) {
58945
+ return await Promise.all(plan.map((merge) => executeMerge(merge.source, merge.target)));
58946
+ }
58939
58947
  const mergeResults = [];
58940
58948
  for (const merge of plan) {
58941
- mergeResults.push(await branchMergePort.mergeBranch(param.owner, param.repo, merge.source, merge.target, param.pullRequest.mergeTimeout, param.tokens.token));
58949
+ mergeResults.push(await executeMerge(merge.source, merge.target));
58942
58950
  }
58943
58951
  return mergeResults;
58944
58952
  }
@@ -76055,20 +76063,20 @@ function isBlockingCombinedStatus(state) {
76055
76063
  "use strict";
76056
76064
 
76057
76065
  Object.defineProperty(exports, "__esModule", ({ value: true }));
76058
- exports.MergeChecksWaiter = void 0;
76066
+ exports.MergeChecksWaiter = exports.MERGE_CHECKS_POLL_INTERVAL_SECONDS = void 0;
76059
76067
  const logger_1 = __nccwpck_require__(91151);
76060
76068
  const merge_checks_policy_1 = __nccwpck_require__(39281);
76061
76069
  const merge_checks_waiter_policy_1 = __nccwpck_require__(88955);
76070
+ exports.MERGE_CHECKS_POLL_INTERVAL_SECONDS = 20;
76062
76071
  /** Polls only the checks relevant to one pull request before a merge. */
76063
76072
  class MergeChecksWaiter {
76064
76073
  async wait(octokit, owner, repository, head, pullRequestNumber, timeout) {
76065
- const pollIntervalSeconds = 10;
76066
76074
  const maxWaitForPrChecksAttempts = 3;
76067
76075
  let attempts = 0;
76068
76076
  let waitForPrChecksAttempts = 0;
76069
76077
  const maxAttempts = timeout === 0
76070
76078
  ? Number.POSITIVE_INFINITY
76071
- : Math.max(1, Math.ceil(timeout / pollIntervalSeconds));
76079
+ : Math.max(1, Math.ceil(timeout / exports.MERGE_CHECKS_POLL_INTERVAL_SECONDS));
76072
76080
  while (attempts < maxAttempts) {
76073
76081
  const { data: checkRuns } = await octokit.rest.checks.listForRef({ owner, repo: repository, ref: head });
76074
76082
  const { data: commitStatus } = await octokit.rest.repos.getCombinedStatusForRef({ owner, repo: repository, ref: head });
@@ -76084,7 +76092,7 @@ class MergeChecksWaiter {
76084
76092
  waitForPrChecksAttempts = assessment.nextRegistrationAttempts;
76085
76093
  if (this.handleAssessment(assessment, commitStatus.state, commitStatus.statuses, maxWaitForPrChecksAttempts))
76086
76094
  return;
76087
- await this.waitForNextCheckPoll(pollIntervalSeconds);
76095
+ await this.waitForNextCheckPoll();
76088
76096
  attempts++;
76089
76097
  }
76090
76098
  throw new Error('Timed out waiting for checks to complete');
@@ -76127,8 +76135,8 @@ class MergeChecksWaiter {
76127
76135
  (0, logger_1.logDebugInfo)(`Waiting for ${pendingChecks.length} status checks to complete:`);
76128
76136
  pendingChecks.forEach(check => (0, logger_1.logDebugInfo)(` - ${check.context} (State: ${check.state})`));
76129
76137
  }
76130
- async waitForNextCheckPoll(pollIntervalSeconds) {
76131
- await new Promise(resolve => setTimeout(resolve, pollIntervalSeconds * 1000));
76138
+ async waitForNextCheckPoll() {
76139
+ await new Promise(resolve => setTimeout(resolve, exports.MERGE_CHECKS_POLL_INTERVAL_SECONDS * 1000));
76132
76140
  }
76133
76141
  assertChecksPassed(checkRuns, combinedStatus, statuses) {
76134
76142
  const blockingChecks = (0, merge_checks_policy_1.blockingCheckRuns)(checkRuns);
@@ -76162,13 +76170,25 @@ const merge_checks_policy_1 = __nccwpck_require__(39281);
76162
76170
  function assessMergeChecksPoll(input) {
76163
76171
  const runsForPullRequest = (0, merge_checks_policy_1.selectPullRequestChecks)(input.checkRuns, input.pullRequestNumber);
76164
76172
  if (runsForPullRequest.length > 0) {
76165
- return assessPullRequestChecks(runsForPullRequest, input.combinedStatus, input.registrationAttempts);
76173
+ return assessPullRequestChecks(runsForPullRequest, input.combinedStatus, input.statuses, input.registrationAttempts);
76166
76174
  }
76167
76175
  return assessRefChecks(input.checkRuns.length, input.combinedStatus, input.statuses, input.registrationAttempts, input.maximumRegistrationAttempts);
76168
76176
  }
76169
- function assessPullRequestChecks(checkRuns, combinedStatus, registrationAttempts) {
76177
+ function assessPullRequestChecks(checkRuns, combinedStatus, statuses, registrationAttempts) {
76170
76178
  const pendingChecks = (0, merge_checks_policy_1.pendingCheckRuns)(checkRuns);
76171
- if (pendingChecks.length === 0 && combinedStatus !== 'pending') {
76179
+ if (pendingChecks.length > 0) {
76180
+ return {
76181
+ kind: 'pending-check-runs',
76182
+ nextRegistrationAttempts: registrationAttempts,
76183
+ pendingChecks,
76184
+ };
76185
+ }
76186
+ // GitHub reports the combined commit status as `pending` when no legacy
76187
+ // commit statuses exist. Check runs are a separate API, so that empty
76188
+ // aggregate must not keep completed PR checks waiting forever.
76189
+ const commitStatusesComplete = statuses.length === 0
76190
+ || statusChecksAreComplete(combinedStatus, statuses);
76191
+ if (commitStatusesComplete) {
76172
76192
  return {
76173
76193
  kind: 'completed',
76174
76194
  source: 'pull-request-checks',
@@ -76177,9 +76197,9 @@ function assessPullRequestChecks(checkRuns, combinedStatus, registrationAttempts
76177
76197
  };
76178
76198
  }
76179
76199
  return {
76180
- kind: 'pending-check-runs',
76200
+ kind: 'pending-status-checks',
76181
76201
  nextRegistrationAttempts: registrationAttempts,
76182
- pendingChecks,
76202
+ statuses: [...statuses],
76183
76203
  };
76184
76204
  }
76185
76205
  function assessRefChecks(totalCheckRuns, combinedStatus, statuses, registrationAttempts, maximumRegistrationAttempts) {
@@ -53607,7 +53607,7 @@ function sanitizeTitle(title) {
53607
53607
 
53608
53608
  Object.defineProperty(exports, "__esModule", ({ value: true }));
53609
53609
  exports.buildDeploymentMergePlan = buildDeploymentMergePlan;
53610
- /** Returns the ordered merge operations required after a successful deployment. */
53610
+ /** Returns the merge operations required after a successful deployment. */
53611
53611
  function buildDeploymentMergePlan(configuration) {
53612
53612
  if (configuration.releaseBranch) {
53613
53613
  return [
@@ -55830,7 +55830,7 @@ const deployed_action_policy_1 = __nccwpck_require__(5510);
55830
55830
  const logging_ports_1 = __nccwpck_require__(6152);
55831
55831
  const task_emoji_1 = __nccwpck_require__(46103);
55832
55832
  const TASK_ID = 'DeployedActionUseCase';
55833
- /** Replaces the deploy label, performs ordered merges, and closes only after all succeed. */
55833
+ /** Replaces the deploy label, performs the required merges, and closes only after all succeed. */
55834
55834
  async function runDeployedActionWorkflow(param, dependencies) {
55835
55835
  (0, logging_ports_1.logInfo)(`${(0, task_emoji_1.getTaskEmoji)(TASK_ID)} Executing ${TASK_ID}.`);
55836
55836
  const results = [];
@@ -55901,9 +55901,17 @@ async function mergeBranches(param, branchMergePort) {
55901
55901
  defaultBranch: param.branches.defaultBranch,
55902
55902
  developmentBranch: param.branches.development,
55903
55903
  });
55904
+ const executeMerge = (source, target) => (branchMergePort.mergeBranch(param.owner, param.repo, source, target, param.pullRequest.mergeTimeout, param.tokens.token));
55905
+ // Both release merges use the immutable release branch as their source, so
55906
+ // their PRs and checks are independent and can run concurrently. A hotfix
55907
+ // must remain sequential because the second merge uses the updated default
55908
+ // branch produced by the first merge.
55909
+ if (param.currentConfiguration.releaseBranch) {
55910
+ return await Promise.all(plan.map((merge) => executeMerge(merge.source, merge.target)));
55911
+ }
55904
55912
  const mergeResults = [];
55905
55913
  for (const merge of plan) {
55906
- mergeResults.push(await branchMergePort.mergeBranch(param.owner, param.repo, merge.source, merge.target, param.pullRequest.mergeTimeout, param.tokens.token));
55914
+ mergeResults.push(await executeMerge(merge.source, merge.target));
55907
55915
  }
55908
55916
  return mergeResults;
55909
55917
  }
@@ -71038,20 +71046,20 @@ function isBlockingCombinedStatus(state) {
71038
71046
  "use strict";
71039
71047
 
71040
71048
  Object.defineProperty(exports, "__esModule", ({ value: true }));
71041
- exports.MergeChecksWaiter = void 0;
71049
+ exports.MergeChecksWaiter = exports.MERGE_CHECKS_POLL_INTERVAL_SECONDS = void 0;
71042
71050
  const logger_1 = __nccwpck_require__(91151);
71043
71051
  const merge_checks_policy_1 = __nccwpck_require__(39281);
71044
71052
  const merge_checks_waiter_policy_1 = __nccwpck_require__(88955);
71053
+ exports.MERGE_CHECKS_POLL_INTERVAL_SECONDS = 20;
71045
71054
  /** Polls only the checks relevant to one pull request before a merge. */
71046
71055
  class MergeChecksWaiter {
71047
71056
  async wait(octokit, owner, repository, head, pullRequestNumber, timeout) {
71048
- const pollIntervalSeconds = 10;
71049
71057
  const maxWaitForPrChecksAttempts = 3;
71050
71058
  let attempts = 0;
71051
71059
  let waitForPrChecksAttempts = 0;
71052
71060
  const maxAttempts = timeout === 0
71053
71061
  ? Number.POSITIVE_INFINITY
71054
- : Math.max(1, Math.ceil(timeout / pollIntervalSeconds));
71062
+ : Math.max(1, Math.ceil(timeout / exports.MERGE_CHECKS_POLL_INTERVAL_SECONDS));
71055
71063
  while (attempts < maxAttempts) {
71056
71064
  const { data: checkRuns } = await octokit.rest.checks.listForRef({ owner, repo: repository, ref: head });
71057
71065
  const { data: commitStatus } = await octokit.rest.repos.getCombinedStatusForRef({ owner, repo: repository, ref: head });
@@ -71067,7 +71075,7 @@ class MergeChecksWaiter {
71067
71075
  waitForPrChecksAttempts = assessment.nextRegistrationAttempts;
71068
71076
  if (this.handleAssessment(assessment, commitStatus.state, commitStatus.statuses, maxWaitForPrChecksAttempts))
71069
71077
  return;
71070
- await this.waitForNextCheckPoll(pollIntervalSeconds);
71078
+ await this.waitForNextCheckPoll();
71071
71079
  attempts++;
71072
71080
  }
71073
71081
  throw new Error('Timed out waiting for checks to complete');
@@ -71110,8 +71118,8 @@ class MergeChecksWaiter {
71110
71118
  (0, logger_1.logDebugInfo)(`Waiting for ${pendingChecks.length} status checks to complete:`);
71111
71119
  pendingChecks.forEach(check => (0, logger_1.logDebugInfo)(` - ${check.context} (State: ${check.state})`));
71112
71120
  }
71113
- async waitForNextCheckPoll(pollIntervalSeconds) {
71114
- await new Promise(resolve => setTimeout(resolve, pollIntervalSeconds * 1000));
71121
+ async waitForNextCheckPoll() {
71122
+ await new Promise(resolve => setTimeout(resolve, exports.MERGE_CHECKS_POLL_INTERVAL_SECONDS * 1000));
71115
71123
  }
71116
71124
  assertChecksPassed(checkRuns, combinedStatus, statuses) {
71117
71125
  const blockingChecks = (0, merge_checks_policy_1.blockingCheckRuns)(checkRuns);
@@ -71145,13 +71153,25 @@ const merge_checks_policy_1 = __nccwpck_require__(39281);
71145
71153
  function assessMergeChecksPoll(input) {
71146
71154
  const runsForPullRequest = (0, merge_checks_policy_1.selectPullRequestChecks)(input.checkRuns, input.pullRequestNumber);
71147
71155
  if (runsForPullRequest.length > 0) {
71148
- return assessPullRequestChecks(runsForPullRequest, input.combinedStatus, input.registrationAttempts);
71156
+ return assessPullRequestChecks(runsForPullRequest, input.combinedStatus, input.statuses, input.registrationAttempts);
71149
71157
  }
71150
71158
  return assessRefChecks(input.checkRuns.length, input.combinedStatus, input.statuses, input.registrationAttempts, input.maximumRegistrationAttempts);
71151
71159
  }
71152
- function assessPullRequestChecks(checkRuns, combinedStatus, registrationAttempts) {
71160
+ function assessPullRequestChecks(checkRuns, combinedStatus, statuses, registrationAttempts) {
71153
71161
  const pendingChecks = (0, merge_checks_policy_1.pendingCheckRuns)(checkRuns);
71154
- if (pendingChecks.length === 0 && combinedStatus !== 'pending') {
71162
+ if (pendingChecks.length > 0) {
71163
+ return {
71164
+ kind: 'pending-check-runs',
71165
+ nextRegistrationAttempts: registrationAttempts,
71166
+ pendingChecks,
71167
+ };
71168
+ }
71169
+ // GitHub reports the combined commit status as `pending` when no legacy
71170
+ // commit statuses exist. Check runs are a separate API, so that empty
71171
+ // aggregate must not keep completed PR checks waiting forever.
71172
+ const commitStatusesComplete = statuses.length === 0
71173
+ || statusChecksAreComplete(combinedStatus, statuses);
71174
+ if (commitStatusesComplete) {
71155
71175
  return {
71156
71176
  kind: 'completed',
71157
71177
  source: 'pull-request-checks',
@@ -71160,9 +71180,9 @@ function assessPullRequestChecks(checkRuns, combinedStatus, registrationAttempts
71160
71180
  };
71161
71181
  }
71162
71182
  return {
71163
- kind: 'pending-check-runs',
71183
+ kind: 'pending-status-checks',
71164
71184
  nextRegistrationAttempts: registrationAttempts,
71165
- pendingChecks,
71185
+ statuses: [...statuses],
71166
71186
  };
71167
71187
  }
71168
71188
  function assessRefChecks(totalCheckRuns, combinedStatus, statuses, registrationAttempts, maximumRegistrationAttempts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vypdev/copilot",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "packageManager": "pnpm@10.12.4",
5
5
  "description": "Automates branch management, GitHub project linking, and issue/PR tracking with Git-Flow methodology.",
6
6
  "homepage": "https://github.com/vypdev/copilot",