@@ -16,6 +16,7 @@ import {
1616 QuickCommand ,
1717 StepResultBreak ,
1818} from '../../commands/quickCommand' ;
19+ import { getSteps } from '../../commands/quickWizard.utils' ;
1920import { proBadge } from '../../constants' ;
2021import type { IntegrationId } from '../../constants.integrations' ;
2122import { HostingIntegrationId } from '../../constants.integrations' ;
@@ -24,6 +25,7 @@ import type { Container } from '../../container';
2425import type { SearchedIssue } from '../../git/models/issue' ;
2526import type { QuickPickItemOfT } from '../../quickpicks/items/common' ;
2627import { createQuickPickItemOfT } from '../../quickpicks/items/common' ;
28+ import type { DirectiveQuickPickItem } from '../../quickpicks/items/directive' ;
2729import { createDirectiveQuickPickItem , Directive } from '../../quickpicks/items/directive' ;
2830import { getScopedCounter } from '../../system/counter' ;
2931import { fromNow } from '../../system/date' ;
@@ -143,7 +145,19 @@ export class StartWorkCommand extends QuickCommand<State> {
143145 if ( typeof state . action === 'string' ) {
144146 switch ( state . action ) {
145147 case 'start' :
146- startWork ( state . item . item ) ;
148+ yield * getSteps (
149+ this . container ,
150+ {
151+ command : 'branch' ,
152+ state : {
153+ subcommand : 'create' ,
154+ repo : undefined ,
155+ name : `${ state . item . item . issue . id } -${ state . item . item . issue . title } ` ,
156+ suggestNameOnly : true ,
157+ } ,
158+ } ,
159+ this . pickedVia ,
160+ ) ;
147161 break ;
148162 }
149163 }
@@ -331,8 +345,10 @@ export class StartWorkCommand extends QuickCommand<State> {
331345 items : items ,
332346 onDidClickItemButton : ( _quickpick , button , { item } ) => {
333347 if ( button === StartWorkQuickInputButton ) {
334- startWork ( item . item ) ;
348+ this . startWork ( state , item ) ;
349+ return true ;
335350 }
351+ return false ;
336352 } ,
337353 } ) ;
338354
@@ -344,6 +360,13 @@ export class StartWorkCommand extends QuickCommand<State> {
344360 return { ...element . item } ;
345361 }
346362
363+ private startWork ( state : PartialStepState < State > , item ?: StartWorkItem ) {
364+ state . action = 'start' ;
365+ if ( item != null ) {
366+ state . item = item ;
367+ }
368+ }
369+
347370 private async getConnectedIntegrations ( ) : Promise < Map < IntegrationId , boolean > > {
348371 const connected = new Map < IntegrationId , boolean > ( ) ;
349372 await Promise . allSettled (
@@ -365,7 +388,3 @@ async function updateContextItems(container: Container, context: Context) {
365388 } ) ) ?? [ ] ,
366389 } ;
367390}
368-
369- function startWork ( _issue : SearchedIssue ) {
370- // TODO: Hack here
371- }
0 commit comments