File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
cli/cmd/tui/component/prompt Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -546,16 +546,22 @@ export function Prompt(props: PromptProps) {
546546 } else if (
547547 inputText . startsWith ( "/" ) &&
548548 iife ( ( ) => {
549- const command = inputText . split ( " " ) [ 0 ] . slice ( 1 )
550- console . log ( command )
549+ const firstLine = inputText . split ( "\n " ) [ 0 ]
550+ const command = firstLine . split ( " " ) [ 0 ] . slice ( 1 )
551551 return sync . data . command . some ( ( x ) => x . name === command )
552552 } )
553553 ) {
554- let [ command , ...args ] = inputText . split ( " " )
554+ // Parse command from first line, preserve multi-line content in arguments
555+ const firstLineEnd = inputText . indexOf ( "\n" )
556+ const firstLine = firstLineEnd === - 1 ? inputText : inputText . slice ( 0 , firstLineEnd )
557+ const [ command , ...firstLineArgs ] = firstLine . split ( " " )
558+ const restOfInput = firstLineEnd === - 1 ? "" : inputText . slice ( firstLineEnd + 1 )
559+ const args = firstLineArgs . join ( " " ) + ( restOfInput ? "\n" + restOfInput : "" )
560+
555561 sdk . client . session . command ( {
556562 sessionID,
557563 command : command . slice ( 1 ) ,
558- arguments : args . join ( " " ) ,
564+ arguments : args ,
559565 agent : local . agent . current ( ) . name ,
560566 model : `${ selectedModel . providerID } /${ selectedModel . modelID } ` ,
561567 messageID,
Original file line number Diff line number Diff line change @@ -1627,8 +1627,15 @@ NOTE: At any point in time through this workflow you should feel free to ask the
16271627 if ( position === last ) return args . slice ( argIndex ) . join ( " " )
16281628 return args [ argIndex ]
16291629 } )
1630+ const usesArgumentsPlaceholder = templateCommand . includes ( "$ARGUMENTS" )
16301631 let template = withArgs . replaceAll ( "$ARGUMENTS" , input . arguments )
16311632
1633+ // If command doesn't explicitly handle arguments (no $N or $ARGUMENTS placeholders)
1634+ // but user provided arguments, append them to the template
1635+ if ( placeholders . length === 0 && ! usesArgumentsPlaceholder && input . arguments . trim ( ) ) {
1636+ template = template + "\n\n" + input . arguments
1637+ }
1638+
16321639 const shell = ConfigMarkdown . shell ( template )
16331640 if ( shell . length > 0 ) {
16341641 const results = await Promise . all (
You can’t perform that action at this time.
0 commit comments