@@ -392,14 +392,21 @@ export const listAvailableInputs = (
392392 return detectPromptInputs ( pane )
393393}
394394
395- export const buildLaunchCommand = (
396- binPath : string ,
397- userdir : string ,
398- world : string ,
399- seed = "" ,
400- availableKeysJson = "" ,
401- aiHelperOutput = "" ,
402- ) : string => {
395+ type BuildLaunchCommandOptions = {
396+ binPath : string
397+ userdir : string
398+ world : string
399+ seed ?: string
400+ availableKeysJson ?: string
401+ availableMacrosJson ?: string
402+ aiHelperOutput ?: string
403+ }
404+
405+ export const buildLaunchCommand = ( options : BuildLaunchCommandOptions ) : string => {
406+ const seed = options . seed ?? ""
407+ const availableKeysJson = options . availableKeysJson ?? ""
408+ const availableMacrosJson = options . availableMacrosJson ?? ""
409+ const aiHelperOutput = options . aiHelperOutput ?? ""
403410 const parts = [
404411 "TERM=xterm-256color" ,
405412 "COLORTERM=truecolor" ,
@@ -408,16 +415,19 @@ export const buildLaunchCommand = (
408415 ...( availableKeysJson . length > 0
409416 ? [ `CATA_AVAILABLE_KEYS_JSON=${ shellEscape ( availableKeysJson ) } ` ]
410417 : [ ] ) ,
418+ ...( availableMacrosJson . length > 0
419+ ? [ `CATA_AVAILABLE_MACROS_JSON=${ shellEscape ( availableMacrosJson ) } ` ]
420+ : [ ] ) ,
411421 ...( aiHelperOutput . length > 0 ? [ `AI_HELPER_OUTPUT=${ shellEscape ( aiHelperOutput ) } ` ] : [ ] ) ,
412- shellEscape ( binPath ) ,
422+ shellEscape ( options . binPath ) ,
413423 "--basepath" ,
414424 shellEscape ( REPO_ROOT ) ,
415425 "--userdir" ,
416- shellEscape ( userdir ) ,
426+ shellEscape ( options . userdir ) ,
417427 ]
418428
419- if ( world . length > 0 ) {
420- parts . push ( "--world" , shellEscape ( world ) )
429+ if ( options . world . length > 0 ) {
430+ parts . push ( "--world" , shellEscape ( options . world ) )
421431 }
422432
423433 if ( seed . length > 0 ) {
@@ -435,23 +445,25 @@ export const writeCodeBlockCapture = async (
435445 await Deno . writeTextFile ( outputPath , body )
436446}
437447
438- export const writeIndex = async (
439- outputPath : string ,
440- sessionName : string ,
441- captures : CaptureEntry [ ] ,
442- status : RunStatus ,
443- castFile ?: string ,
444- failureMessage ?: string ,
445- ) : Promise < void > => {
448+ type WriteIndexOptions = {
449+ outputPath : string
450+ sessionName : string
451+ captures : CaptureEntry [ ]
452+ status : RunStatus
453+ castFile ?: string
454+ failureMessage ?: string
455+ }
456+
457+ export const writeIndex = async ( options : WriteIndexOptions ) : Promise < void > => {
446458 const lines = [
447459 "# PR Verify Artifact" ,
448460 "" ,
449- `Session: ${ sessionName } ` ,
450- `Status: ${ status } ` ,
461+ `Session: ${ options . sessionName } ` ,
462+ `Status: ${ options . status } ` ,
451463 "" ,
452464 "## Captures" ,
453465 "" ,
454- ...captures . map ( ( capture , index ) => {
466+ ...options . captures . map ( ( capture , index ) => {
455467 const title = capture . caption . length > 0 ? capture . caption : capture . id
456468 const screenshotSuffix = capture . screenshot_file
457469 ? `, screenshot: \`${ capture . screenshot_file } \``
@@ -463,19 +475,19 @@ export const writeIndex = async (
463475 "" ,
464476 ]
465477
466- if ( castFile !== undefined ) {
467- lines . push ( `Cast recording: \`${ castFile } \`` )
478+ if ( options . castFile !== undefined ) {
479+ lines . push ( `Cast recording: \`${ options . castFile } \`` )
468480 lines . push ( "" )
469481 }
470482
471- if ( failureMessage !== undefined ) {
483+ if ( options . failureMessage !== undefined ) {
472484 lines . push ( "## Failure" )
473485 lines . push ( "" )
474486 lines . push ( "```text" )
475- lines . push ( failureMessage )
487+ lines . push ( options . failureMessage )
476488 lines . push ( "```" )
477489 lines . push ( "" )
478490 }
479491
480- await Deno . writeTextFile ( outputPath , lines . join ( "\n" ) )
492+ await Deno . writeTextFile ( options . outputPath , lines . join ( "\n" ) )
481493}
0 commit comments