@@ -10,7 +10,8 @@ const { v4: uuidv4 } = require('uuid');
1010
1111const { checkUserAuth, getUserData } = require ( './userData' ) ;
1212
13- async function askForActions ( actionsData , parsedYaml ) {
13+ async function askForActions ( parsedYaml ) {
14+ const actionsData = [ ] ;
1415 console . log ( chalk . yellow ( `\n------------------------------Action Steps-----------------------------------------\n` ) ) ;
1516 console . log ( chalk . green ( "Actions are the functionality that your Agent provides to the user. These are like functionality shortcuts that the user can invoke using \\ command.\n" ) ) ;
1617
@@ -72,7 +73,8 @@ async function askForActions(actionsData, parsedYaml) {
7273 return actionsData ;
7374 }
7475
75- async function askForInstructions ( sdlc , parsedYaml ) {
76+ async function askForInstructions ( parsedYaml ) {
77+ const sdlc = [ ] ;
7678 let addMoreInstructions = true ;
7779 console . log ( chalk . yellow ( `\n------------------------------SDLC Steps-----------------------------------------\n` ) ) ;
7880 console . log ( chalk . green ( "SDLC Steps are the software development steps that your Agent will handle like code generation, deployment, testing etc. \n These are used by Universal Agent Router to route the user request to the correct Agent Invocation.\n Also add sample Instructions that the user should give to invoke that SLDC Step functionality.\n" ) ) ;
@@ -206,9 +208,10 @@ function createProject(projectName, installPath, selectedTemplate, answers, pars
206208 console . log ( `Created ${ projectName } at ${ projectDir } ` ) ;
207209}
208210
209- function getPrompts ( projectName , quickEnabled , parsedYaml ) {
211+ async function getBasicAnswers ( projectName , quickEnabled , parsedYaml ) {
210212
211213 const prompts = [ ] ;
214+ const answers = [ ] ;
212215
213216 const currentPath = process . cwd ( ) ;
214217
@@ -305,48 +308,41 @@ function getPrompts(projectName, quickEnabled, parsedYaml){
305308 return true ;
306309 }
307310 } ) ;
308- }
311+ answers = await inquirer . prompt ( prompts ) ;
312+ }
313+ else {
314+
315+ }
309316
310317
311318
312319
313- return prompts ;
320+ return answers ;
314321}
315322
316323const createagent = async ( options ) => {
317324 console . log ( options )
318- let projectName = options . name || process . argv [ 3 ] ;
319- const quickEnabled = options . quick || false ;
320-
321- const agentymlpath = path . join ( __dirname , '..' , 'template/basic' , 'codeboltagent.yaml' ) ;
322- let agentYamlData = fs . readFileSync ( agentymlpath , 'utf8' ) ;
323- const parsedYaml = yaml . load ( agentYamlData ) ;
324- const prompts = getPrompts ( projectName , quickEnabled , parsedYaml )
325-
326-
327-
328325 console . log ( chalk . blue (
329326 " _____ _ _ _ _ \n" +
330327 " / __ \\ | | | | | | | \n" +
331328 " | / \\/ ___ __| | ___| |__ ___ | | |_ \n" +
332329 " | | / _ \\ / _` |/ _ \\ '_ \\ / _ \\| | __| \n" +
333330 " | \\__/\\ (_) | (_| | __/ |_) | (_) | | |_ \n" +
334331 " \\____/\\___/ \\__,_|\\___|_.__/ \\___/|_|\\__| \n" ) ) ;
335-
336- inquirer . prompt ( prompts ) . then ( async answers => {
337- let sdlc = [ ] ;
338- let actionsData = [ ] ;
339-
340- let sdlcInstruction = await askForInstructions ( sdlc , parsedYaml )
341- let actions = await askForActions ( actionsData , parsedYaml )
342332
343- projectName = answers . projectName . trim ( ) ;
344- const installPath = answers . installPath . trim ( ) === '.' ? process . cwd ( ) : path . resolve ( process . cwd ( ) , answers . installPath . trim ( ) ) ;
345- const selectedTemplate = answers . template ;
346- answers . sdlc_steps_managed = sdlcInstruction
347- answers . actions = actions
348- createProject ( projectName , installPath , selectedTemplate , answers , parsedYaml ) ;
349- } ) ;
333+ let projectName = options . name || process . argv [ 3 ] ;
334+ const quickEnabled = options . quick || false ;
335+
336+ const agentymlpath = path . join ( __dirname , '..' , 'template/basic' , 'codeboltagent.yaml' ) ;
337+ let agentYamlData = fs . readFileSync ( agentymlpath , 'utf8' ) ;
338+ const parsedYaml = yaml . load ( agentYamlData ) ;
339+ const answers = await getBasicAnswers ( projectName , quickEnabled , parsedYaml )
340+ projectName = answers . projectName . trim ( ) ;
341+ const installPath = answers . installPath . trim ( ) === '.' ? process . cwd ( ) : path . resolve ( process . cwd ( ) , answers . installPath . trim ( ) ) ;
342+ const selectedTemplate = answers . template ;
343+ answers . sdlc_steps_managed = ! quickEnabled ? await askForInstructions ( parsedYaml ) : [ ] ;
344+ answers . actions = ! quickEnabled ? await askForActions ( parsedYaml ) : [ ] ;
345+ createProject ( projectName , installPath , selectedTemplate , answers , parsedYaml ) ;
350346} ;
351347
352348
0 commit comments