@@ -28,7 +28,10 @@ export const CommandExecution = forwardRef<HTMLDivElement, CommandExecutionProps
2828
2929 const [ status , setStatus ] = useState < CommandExecutionStatus | null > ( null )
3030
31- const lines = useMemo ( ( ) => output . split ( "\n" ) . filter ( ( line ) => line . trim ( ) !== "" ) , [ output ] )
31+ const lines = useMemo (
32+ ( ) => [ `$ ${ command } ` , ...output . split ( "\n" ) . filter ( ( line ) => line . trim ( ) !== "" ) ] ,
33+ [ command , output ] ,
34+ )
3235
3336 const onMessage = useCallback (
3437 ( event : MessageEvent ) => {
@@ -61,14 +64,14 @@ export const CommandExecution = forwardRef<HTMLDivElement, CommandExecutionProps
6164
6265 return (
6366 < div ref = { ref } className = "w-full p-2 rounded-xs bg-vscode-editor-background" >
64- < div className = "flex flex-row justify-between" >
65- < Line > { command } </ Line >
66- < div >
67+ < div className = "flex flex-row items-center justify-between gap-2 px-1 " >
68+ < Line className = "text-sm whitespace-nowrap overflow-hidden text-ellipsis" > { command } </ Line >
69+ < div className = "flex flex-row items-center gap-1" >
6770 { status ?. status === "running" && (
68- < div className = "flex flex-row items-center gap-2 shrink-0 font-mono text-sm " >
71+ < div className = "flex flex-row items-center gap-2 font-mono text-xs " >
6972 < div className = "rounded-full size-1.5 bg-lime-400" />
7073 < div > Running</ div >
71- { status . pid && < div > (PID: { status . pid } )</ div > }
74+ { status . pid && < div className = "whitespace-nowrap" > (PID: { status . pid } )</ div > }
7275 < Button
7376 variant = "ghost"
7477 size = "icon"
@@ -80,26 +83,30 @@ export const CommandExecution = forwardRef<HTMLDivElement, CommandExecutionProps
8083 </ div >
8184 ) }
8285 { status ?. status === "exited" && (
83- < div className = "flex flex-row items-center gap-2 shrink-0 font-mono text-sm" >
84- < div className = "rounded-full size-1.5 bg-red-400" />
85- < div > Exited ({ status . exitCode } )</ div >
86+ < div className = "flex flex-row items-center gap-2 font-mono text-xs" >
87+ < div
88+ className = { cn (
89+ "rounded-full size-1.5" ,
90+ status . exitCode === 0 ? "bg-lime-400" : "bg-red-400" ,
91+ ) }
92+ />
93+ < div className = "whitespace-nowrap" > Exited ({ status . exitCode } )</ div >
8694 </ div >
8795 ) }
8896 { lines . length > 0 && (
89- < div className = "flex flex-row items-center justify-end gap-2" >
90- < Button variant = "ghost" size = "sm" onClick = { ( ) => setIsExpanded ( ! isExpanded ) } >
91- < div > Output</ div >
92- < ChevronDown
93- className = { cn ( "size-4 transition-transform duration-300" , {
94- "rotate-180" : isExpanded ,
95- } ) }
96- />
97- </ Button >
98- </ div >
97+ < Button variant = "ghost" size = "icon" onClick = { ( ) => setIsExpanded ( ! isExpanded ) } >
98+ < ChevronDown
99+ className = { cn ( "size-4 transition-transform duration-300" , {
100+ "rotate-180" : isExpanded ,
101+ } ) }
102+ />
103+ </ Button >
99104 ) }
100105 </ div >
101106 </ div >
102- < div className = { cn ( "h-[200px] mt-1 pt-1 border-t border-border/25" , { hidden : ! isExpanded } ) } >
107+ < div
108+ className = { cn ( "mt-1 pt-1 border-t border-border/25" , { hidden : ! isExpanded } ) }
109+ style = { { height : Math . min ( ( lines . length + 1 ) * 16 , 200 ) } } >
103110 { lines . length > 0 && (
104111 < Virtuoso
105112 className = "h-full"
0 commit comments