@@ -51,129 +51,16 @@ import {
5151} from '../integrations/providers/models' ;
5252import type { EnrichableItem , EnrichedItem } from './enrichmentService' ;
5353import { convertRemoteProviderIdToEnrichProvider , isEnrichableRemoteProviderId } from './enrichmentService' ;
54+ import type { LaunchpadAction , LaunchpadActionCategory , LaunchpadGroup } from './models' ;
55+ import {
56+ launchpadActionCategories ,
57+ launchpadCategoryToGroupMap ,
58+ launchpadGroups ,
59+ prActionsMap ,
60+ sharedCategoryToLaunchpadActionCategoryMap ,
61+ } from './models' ;
5462import { getPullRequestIdentityFromMaybeUrl } from './utils' ;
5563
56- export const launchpadActionCategories = [
57- 'mergeable' ,
58- 'unassigned-reviewers' ,
59- 'failed-checks' ,
60- 'conflicts' ,
61- 'needs-my-review' ,
62- 'code-suggestions' ,
63- 'changes-requested' ,
64- 'reviewer-commented' ,
65- 'waiting-for-review' ,
66- 'draft' ,
67- 'other' ,
68- ] as const ;
69- export type LaunchpadActionCategory = ( typeof launchpadActionCategories ) [ number ] ;
70-
71- export const launchpadGroups = [
72- 'current-branch' ,
73- 'pinned' ,
74- 'mergeable' ,
75- 'blocked' ,
76- 'follow-up' ,
77- 'needs-review' ,
78- 'waiting-for-review' ,
79- 'draft' ,
80- 'other' ,
81- 'snoozed' ,
82- ] as const ;
83- export type LaunchpadGroup = ( typeof launchpadGroups ) [ number ] ;
84-
85- export const launchpadPriorityGroups = [
86- 'mergeable' ,
87- 'blocked' ,
88- 'follow-up' ,
89- 'needs-review' ,
90- ] satisfies readonly LaunchpadPriorityGroup [ ] as readonly LaunchpadGroup [ ] ;
91- export type LaunchpadPriorityGroup = Extract < LaunchpadGroup , 'mergeable' | 'blocked' | 'follow-up' | 'needs-review' > ;
92-
93- export const launchpadGroupIconMap = new Map < LaunchpadGroup , `$(${string } )`> ( [
94- [ 'current-branch' , '$(git-branch)' ] ,
95- [ 'pinned' , '$(pinned)' ] ,
96- [ 'mergeable' , '$(rocket)' ] ,
97- [ 'blocked' , '$(error)' ] , //bracket-error
98- [ 'follow-up' , '$(report)' ] ,
99- [ 'needs-review' , '$(comment-unresolved)' ] , // feedback
100- [ 'waiting-for-review' , '$(gitlens-clock)' ] ,
101- [ 'draft' , '$(git-pull-request-draft)' ] ,
102- [ 'other' , '$(ellipsis)' ] ,
103- [ 'snoozed' , '$(bell-slash)' ] ,
104- ] ) ;
105-
106- export const launchpadGroupLabelMap = new Map < LaunchpadGroup , string > ( [
107- [ 'current-branch' , 'Current Branch' ] ,
108- [ 'pinned' , 'Pinned' ] ,
109- [ 'mergeable' , 'Ready to Merge' ] ,
110- [ 'blocked' , 'Blocked' ] ,
111- [ 'follow-up' , 'Requires Follow-up' ] ,
112- [ 'needs-review' , 'Needs Your Review' ] ,
113- [ 'waiting-for-review' , 'Waiting for Review' ] ,
114- [ 'draft' , 'Draft' ] ,
115- [ 'other' , 'Other' ] ,
116- [ 'snoozed' , 'Snoozed' ] ,
117- ] ) ;
118-
119- export const launchpadCategoryToGroupMap = new Map < LaunchpadActionCategory , LaunchpadGroup > ( [
120- [ 'mergeable' , 'mergeable' ] ,
121- [ 'conflicts' , 'blocked' ] ,
122- [ 'failed-checks' , 'blocked' ] ,
123- [ 'unassigned-reviewers' , 'blocked' ] ,
124- [ 'needs-my-review' , 'needs-review' ] ,
125- [ 'code-suggestions' , 'follow-up' ] ,
126- [ 'changes-requested' , 'follow-up' ] ,
127- [ 'reviewer-commented' , 'follow-up' ] ,
128- [ 'waiting-for-review' , 'waiting-for-review' ] ,
129- [ 'draft' , 'draft' ] ,
130- [ 'other' , 'other' ] ,
131- ] ) ;
132-
133- export const sharedCategoryToLaunchpadActionCategoryMap = new Map < string , LaunchpadActionCategory > ( [
134- [ 'readyToMerge' , 'mergeable' ] ,
135- [ 'unassignedReviewers' , 'unassigned-reviewers' ] ,
136- [ 'failingCI' , 'failed-checks' ] ,
137- [ 'conflicts' , 'conflicts' ] ,
138- [ 'needsMyReview' , 'needs-my-review' ] ,
139- [ 'changesRequested' , 'changes-requested' ] ,
140- [ 'reviewerCommented' , 'reviewer-commented' ] ,
141- [ 'waitingForReview' , 'waiting-for-review' ] ,
142- [ 'draft' , 'draft' ] ,
143- [ 'other' , 'other' ] ,
144- ] ) ;
145-
146- export type LaunchpadAction =
147- | 'merge'
148- | 'open'
149- | 'soft-open'
150- | 'switch'
151- | 'switch-and-code-suggest'
152- | 'open-worktree'
153- | 'code-suggest'
154- | 'show-overview'
155- | 'open-changes'
156- | 'open-in-graph' ;
157-
158- export type LaunchpadTargetAction = {
159- action : 'open-suggestion' ;
160- target : string ;
161- } ;
162-
163- const prActionsMap = new Map < LaunchpadActionCategory , LaunchpadAction [ ] > ( [
164- [ 'mergeable' , [ 'merge' ] ] ,
165- [ 'unassigned-reviewers' , [ 'open' ] ] ,
166- [ 'failed-checks' , [ 'open' ] ] ,
167- [ 'conflicts' , [ 'open' ] ] ,
168- [ 'needs-my-review' , [ 'open' ] ] ,
169- [ 'code-suggestions' , [ 'open' ] ] ,
170- [ 'changes-requested' , [ 'open' ] ] ,
171- [ 'reviewer-commented' , [ 'open' ] ] ,
172- [ 'waiting-for-review' , [ 'open' ] ] ,
173- [ 'draft' , [ 'open' ] ] ,
174- [ 'other' , [ ] ] ,
175- ] ) ;
176-
17764export function getSuggestedActions ( category : LaunchpadActionCategory , isCurrentBranch : boolean ) : LaunchpadAction [ ] {
17865 const actions = [ ...prActionsMap . get ( category ) ! ] ;
17966 if ( isCurrentBranch ) {
0 commit comments