File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
packages/navie/src/commands Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,15 @@ const RelevantTest = z.object({
3838 . describe ( 'An ordered list of terminal command(s) necessary to execute to install AppMap' ) ,
3939 testCommands : z
4040 . array (
41- z . object ( {
42- command : z . string ( ) . describe ( 'The command to execute' ) ,
43- description : z . string ( ) . optional ( ) . describe ( 'A description of the command' ) ,
44- } )
41+ z
42+ . union ( [
43+ z . object ( {
44+ command : z . string ( ) . describe ( 'The command to execute' ) ,
45+ description : z . string ( ) . optional ( ) . describe ( 'A description of the command' ) ,
46+ } ) ,
47+ z . string ( ) . describe ( 'A command to execute' ) ,
48+ ] )
49+ . describe ( 'The command to execute' )
4550 )
4651 . optional ( )
4752 . describe ( 'The ordered list of terminal command(s) that can be executed to run the test' ) ,
205210 testCommands ?. length
206211 ? `I've identified the following commands that you may need to run to execute the test:
207212<commands>
208- ${ testCommands ?. map ( ( command ) => `- \` ${ command . command } \`: ${ command . description } ` ) . join ( '\n' ) }
213+ ${ testCommands ?. map ( ( command ) => `- ${ commandDescription ( command ) } ` ) . join ( '\n' ) }
209214</commands>
210215`
211216 : ''
@@ -250,3 +255,10 @@ Do not include:
250255 }
251256 }
252257}
258+
259+ function commandDescription ( command : string | { command : string ; description ?: string } ) : string {
260+ if ( typeof command === 'string' ) {
261+ return `\`${ command } \`` ;
262+ }
263+ return `\`${ command . command } \`: ${ command . description ?? '' } ` ;
264+ }
You can’t perform that action at this time.
0 commit comments