@@ -161,15 +161,19 @@ export async function generateSteps(existingConfiguration: Partial<GenerateState
161
161
return inputClientClassName ;
162
162
case 'plugin' :
163
163
return inputPluginName ;
164
- case 'apimanifest ' :
165
- return inputManifestName ;
164
+ case 'other ' :
165
+ return chooseOtherGenerationType ;
166
166
default :
167
167
throw new Error ( 'unknown generation type' ) ;
168
168
}
169
169
}
170
170
async function inputGenerationType ( input : MultiStepInput , state : Partial < GenerateState > ) {
171
171
if ( ! isDeepLinkGenerationTypeProvided ) {
172
- const items = [ l10n . t ( 'Generate an API client' ) , l10n . t ( 'Generate a plugin' ) , l10n . t ( 'Generate an API manifest' ) ] ;
172
+ const items = [
173
+ l10n . t ( 'Client' ) ,
174
+ l10n . t ( 'Copilot plugin' ) ,
175
+ l10n . t ( 'Other' )
176
+ ] ;
173
177
const option = await input . showQuickPick ( {
174
178
title : l10n . t ( 'What do you want to generate?' ) ,
175
179
step : step ++ ,
@@ -179,14 +183,14 @@ export async function generateSteps(existingConfiguration: Partial<GenerateState
179
183
validate : validateIsNotEmpty ,
180
184
shouldResume : shouldResume
181
185
} ) ;
182
- if ( option . label === l10n . t ( 'Generate an API client ' ) ) {
186
+ if ( option . label === l10n . t ( 'Client ' ) ) {
183
187
state . generationType = "client" ;
184
188
}
185
- else if ( option . label === l10n . t ( 'Generate a plugin' ) ) {
189
+ else if ( option . label === l10n . t ( 'Copilot plugin' ) ) {
186
190
state . generationType = "plugin" ;
187
191
}
188
- else if ( option . label === l10n . t ( 'Generate an API manifest ' ) ) {
189
- state . generationType = "apimanifest " ;
192
+ else if ( option . label === l10n . t ( 'Other ' ) ) {
193
+ state . generationType = "other " ;
190
194
}
191
195
}
192
196
let nextStep = getNextStepForGenerationType ( state . generationType ?. toString ( ) || '' ) ;
@@ -287,32 +291,37 @@ export async function generateSteps(existingConfiguration: Partial<GenerateState
287
291
state . pluginName = await input . showInputBox ( {
288
292
title : `${ l10n . t ( 'Create a new plugin' ) } - ${ l10n . t ( 'plugin name' ) } ` ,
289
293
step : step ++ ,
290
- totalSteps : 4 ,
294
+ totalSteps : 3 ,
291
295
value : state . pluginName ?? '' ,
292
296
placeholder : 'MyPlugin' ,
293
297
prompt : l10n . t ( 'Choose a name for the plugin' ) ,
294
298
validate : validateIsNotEmpty ,
295
299
shouldResume : shouldResume
296
300
} ) ;
297
301
}
302
+ state . pluginTypes = [ 'ApiPlugin' ] ;
298
303
updateWorkspaceFolder ( state . pluginName ) ;
299
- return ( input : MultiStepInput ) => inputPluginType ( input , state ) ;
304
+ return ( input : MultiStepInput ) => inputPluginOutputPath ( input , state ) ;
300
305
}
301
- async function inputPluginType ( input : MultiStepInput , state : Partial < GenerateState > ) {
306
+ async function chooseOtherGenerationType ( input : MultiStepInput , state : Partial < GenerateState > ) {
302
307
if ( ! isDeepLinkPluginTypeProvided ) {
303
- const items = [ 'API Plugin ' , 'Open AI' ] . map ( x => ( { label : x } ) as QuickPickItem ) ;
308
+ const items = [ 'API Manifest ' , 'Open AI Plugin ' ] . map ( x => ( { label : x } ) as QuickPickItem ) ;
304
309
const pluginTypes = await input . showQuickPick ( {
305
- title : l10n . t ( 'Choose a plugin type' ) ,
310
+ title : l10n . t ( 'Choose a type' ) ,
306
311
step : step ++ ,
307
312
totalSteps : 4 ,
308
313
placeholder : l10n . t ( 'Select an option' ) ,
309
314
items : items ,
310
315
validate : validateIsNotEmpty ,
311
316
shouldResume : shouldResume
312
317
} ) ;
313
- pluginTypes . label === 'API Plugin' ? state . pluginTypes = [ 'ApiPlugin' ] : state . pluginTypes = [ 'OpenAI' ] ;
318
+ pluginTypes . label === 'API Manifest' ? state . pluginTypes = [ 'ApiManifest' ] : state . pluginTypes = [ 'OpenAI' ] ;
319
+
314
320
}
315
- return ( input : MultiStepInput ) => inputPluginOutputPath ( input , state ) ;
321
+
322
+ Array . isArray ( state . pluginTypes ) && state . pluginTypes . includes ( 'ApiManifest' ) ?
323
+ state . generationType = 'apimanifest' : state . generationType = 'plugin' ;
324
+ return ( input : MultiStepInput ) => inputOtherGenerationTypeName ( input , state ) ;
316
325
}
317
326
async function inputPluginOutputPath ( input : MultiStepInput , state : Partial < GenerateState > ) {
318
327
while ( ! isDeepLinkOutputPathProvided ) {
@@ -351,28 +360,31 @@ export async function generateSteps(existingConfiguration: Partial<GenerateState
351
360
break ;
352
361
}
353
362
}
354
- async function inputManifestName ( input : MultiStepInput , state : Partial < GenerateState > ) {
363
+ async function inputOtherGenerationTypeName ( input : MultiStepInput , state : Partial < GenerateState > ) {
355
364
if ( ! isDeepLinkPluginNameProvided ) {
365
+ const isManifest = state . pluginTypes && Array . isArray ( state . pluginTypes ) && state . pluginTypes . includes ( 'ApiManifest' ) ;
356
366
state . pluginName = await input . showInputBox ( {
357
- title : `${ l10n . t ( 'Create a new manifest' ) } - ${ l10n . t ( 'manifest name' ) } ` ,
367
+ title : `${ isManifest ? l10n . t ( 'Create a new manifest' ) : l10n . t ( 'Create a new OpenAI plugin' ) } - ${ l10n . t ( 'output name' ) } ` ,
358
368
step : step ++ ,
359
- totalSteps : 3 ,
369
+ totalSteps : 4 ,
360
370
value : state . pluginName ?? '' ,
361
- placeholder : 'MyManifest' ,
362
- prompt : l10n . t ( 'Choose a name for the manifest' ) ,
371
+ placeholder : ` ${ isManifest ? 'MyManifest' : 'MyOpenAIPlugin' } ` ,
372
+ prompt : ` ${ isManifest ? l10n . t ( 'Choose a name for the manifest' ) : l10n . t ( 'Choose a name for the OpenAI plugin' ) } ` ,
363
373
validate : validateIsNotEmpty ,
364
374
shouldResume : shouldResume
365
375
} ) ;
366
376
}
367
377
updateWorkspaceFolder ( state . pluginName ) ;
368
- return ( input : MultiStepInput ) => inputManifestOutputPath ( input , state ) ;
378
+ return ( input : MultiStepInput ) => inputOtherGenerationTypeOutputPath ( input , state ) ;
369
379
}
370
- async function inputManifestOutputPath ( input : MultiStepInput , state : Partial < GenerateState > ) {
380
+ async function inputOtherGenerationTypeOutputPath ( input : MultiStepInput , state : Partial < GenerateState > ) {
371
381
while ( true ) {
382
+ const isManifest = state . pluginTypes && Array . isArray ( state . pluginTypes ) && state . pluginTypes . includes ( 'ApiManifest' ) ;
383
+
372
384
const selectedOption = await input . showQuickPick ( {
373
- title : `${ l10n . t ( 'Create a new manifest' ) } - ${ l10n . t ( 'output directory' ) } ` ,
385
+ title : `${ isManifest ? l10n . t ( 'Create a new manifest' ) : l10n . t ( 'Create a new OpenAI plugin ') } - ${ l10n . t ( 'output directory' ) } ` ,
374
386
step : step ++ ,
375
- totalSteps : 3 ,
387
+ totalSteps : 4 ,
376
388
placeholder : l10n . t ( 'Enter an output path relative to the root of the project' ) ,
377
389
items : inputOptions ,
378
390
shouldResume : shouldResume
0 commit comments