@junctionpanel/server 0.1.20 → 0.1.22

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.
@@ -20,7 +20,7 @@ import { listDirectoryEntries, readExplorerFile, getDownloadableFileInfo, } from
20
20
  import { slugify, validateBranchSlug, listJunctionWorktrees, deleteJunctionWorktree, isJunctionOwnedWorktreeCwd, resolveJunctionWorktreeRootForCwd, createInRepoWorktree, restoreInRepoWorktree, } from '../utils/worktree.js';
21
21
  import { readJunctionWorktreeMetadata } from '../utils/worktree-metadata.js';
22
22
  import { runAsyncWorktreeBootstrap } from './worktree-bootstrap.js';
23
- import { getCheckoutDiff, getCheckoutStatus, getCheckoutStatusLite, listBranchSuggestions, NotGitRepoError, MergeConflictError, MergeFromBaseConflictError, commitChanges, mergeToBase, mergeFromBase, pushCurrentBranch, createPullRequest, getPullRequestStatus, resolveBaseRef, } from '../utils/checkout-git.js';
23
+ import { getCheckoutDiff, getCheckoutStatus, getCheckoutStatusLite, listBranchSuggestions, NotGitRepoError, MergeConflictError, MergeFromBaseConflictError, commitChanges, mergeToBase, mergeFromBase, pushCurrentBranch, createPullRequest, getPullRequestFailureLogs, getPullRequestStatus, mergePullRequest, resolveBaseRef, } from '../utils/checkout-git.js';
24
24
  import { getProjectIcon } from '../utils/project-icon.js';
25
25
  import { expandTilde } from '../utils/path.js';
26
26
  import { searchHomeDirectories, searchWorkspaceEntries, searchGitRepositories, checkIsGitRepo } from '../utils/directory-suggestions.js';
@@ -830,6 +830,12 @@ export class Session {
830
830
  case 'checkout_pr_status_request':
831
831
  await this.handleCheckoutPrStatusRequest(msg);
832
832
  break;
833
+ case 'checkout_pr_failure_logs_request':
834
+ await this.handleCheckoutPrFailureLogsRequest(msg);
835
+ break;
836
+ case 'checkout_pr_merge_request':
837
+ await this.handleCheckoutPrMergeRequest(msg);
838
+ break;
833
839
  case 'junction_worktree_list_request':
834
840
  await this.handleJunctionWorktreeListRequest(msg);
835
841
  break;
@@ -2090,6 +2096,8 @@ export class Session {
2090
2096
  aheadBehind: null,
2091
2097
  aheadOfOrigin: null,
2092
2098
  behindOfOrigin: null,
2099
+ hasUpstream: false,
2100
+ upstreamBranch: null,
2093
2101
  hasRemote: false,
2094
2102
  remoteUrl: null,
2095
2103
  isJunctionOwnedWorktree: false,
@@ -2113,6 +2121,8 @@ export class Session {
2113
2121
  aheadBehind: status.aheadBehind ?? null,
2114
2122
  aheadOfOrigin: status.aheadOfOrigin ?? null,
2115
2123
  behindOfOrigin: status.behindOfOrigin ?? null,
2124
+ hasUpstream: status.hasUpstream,
2125
+ upstreamBranch: status.upstreamBranch ?? null,
2116
2126
  hasRemote: status.hasRemote,
2117
2127
  remoteUrl: status.remoteUrl,
2118
2128
  isJunctionOwnedWorktree: true,
@@ -2134,6 +2144,8 @@ export class Session {
2134
2144
  aheadBehind: status.aheadBehind ?? null,
2135
2145
  aheadOfOrigin: status.aheadOfOrigin ?? null,
2136
2146
  behindOfOrigin: status.behindOfOrigin ?? null,
2147
+ hasUpstream: status.hasUpstream,
2148
+ upstreamBranch: status.upstreamBranch ?? null,
2137
2149
  hasRemote: status.hasRemote,
2138
2150
  remoteUrl: status.remoteUrl,
2139
2151
  isJunctionOwnedWorktree: false,
@@ -2155,6 +2167,8 @@ export class Session {
2155
2167
  aheadBehind: null,
2156
2168
  aheadOfOrigin: null,
2157
2169
  behindOfOrigin: null,
2170
+ hasUpstream: false,
2171
+ upstreamBranch: null,
2158
2172
  hasRemote: false,
2159
2173
  remoteUrl: null,
2160
2174
  isJunctionOwnedWorktree: false,
@@ -2879,6 +2893,62 @@ export class Session {
2879
2893
  });
2880
2894
  }
2881
2895
  }
2896
+ async handleCheckoutPrFailureLogsRequest(msg) {
2897
+ const { cwd, requestId } = msg;
2898
+ try {
2899
+ const result = await getPullRequestFailureLogs(cwd);
2900
+ this.emit({
2901
+ type: 'checkout_pr_failure_logs_response',
2902
+ payload: {
2903
+ cwd,
2904
+ logs: result.logs,
2905
+ githubFeaturesEnabled: result.githubFeaturesEnabled,
2906
+ error: null,
2907
+ requestId,
2908
+ },
2909
+ });
2910
+ }
2911
+ catch (error) {
2912
+ this.emit({
2913
+ type: 'checkout_pr_failure_logs_response',
2914
+ payload: {
2915
+ cwd,
2916
+ logs: null,
2917
+ githubFeaturesEnabled: true,
2918
+ error: this.toCheckoutError(error),
2919
+ requestId,
2920
+ },
2921
+ });
2922
+ }
2923
+ }
2924
+ async handleCheckoutPrMergeRequest(msg) {
2925
+ const { cwd, requestId } = msg;
2926
+ try {
2927
+ await mergePullRequest(cwd, {
2928
+ method: msg.method ?? 'squash',
2929
+ });
2930
+ this.emit({
2931
+ type: 'checkout_pr_merge_response',
2932
+ payload: {
2933
+ cwd,
2934
+ success: true,
2935
+ error: null,
2936
+ requestId,
2937
+ },
2938
+ });
2939
+ }
2940
+ catch (error) {
2941
+ this.emit({
2942
+ type: 'checkout_pr_merge_response',
2943
+ payload: {
2944
+ cwd,
2945
+ success: false,
2946
+ error: this.toCheckoutError(error),
2947
+ requestId,
2948
+ },
2949
+ });
2950
+ }
2951
+ }
2882
2952
  async handleJunctionWorktreeListRequest(msg) {
2883
2953
  const { requestId } = msg;
2884
2954
  const cwd = msg.repoRoot ?? msg.cwd;