@@ -18,6 +18,7 @@ export type AutocompleteRef = {
1818
1919export type AutocompleteOption = {
2020 display : string
21+ aliases ?: string [ ]
2122 disabled ?: boolean
2223 description ?: string
2324 onSelect ?: ( ) => void
@@ -207,6 +208,7 @@ export function Autocomplete(props: {
207208 } ,
208209 {
209210 display : "/compact" ,
211+ aliases : [ "/summarize" ] ,
210212 description : "compact the session" ,
211213 onSelect : ( ) => command . trigger ( "session.compact" ) ,
212214 } ,
@@ -232,6 +234,7 @@ export function Autocomplete(props: {
232234 results . push (
233235 {
234236 display : "/new" ,
237+ aliases : [ "/clear" ] ,
235238 description : "create a new session" ,
236239 onSelect : ( ) => command . trigger ( "session.new" ) ,
237240 } ,
@@ -247,6 +250,7 @@ export function Autocomplete(props: {
247250 } ,
248251 {
249252 display : "/session" ,
253+ aliases : [ "/resume" , "/continue" ] ,
250254 description : "list sessions" ,
251255 onSelect : ( ) => command . trigger ( "session.list" ) ,
252256 } ,
@@ -275,6 +279,12 @@ export function Autocomplete(props: {
275279 description : "show all commands" ,
276280 onSelect : ( ) => command . show ( ) ,
277281 } ,
282+ {
283+ display : "/exit" ,
284+ aliases : [ "/quit" , "/q" ] ,
285+ description : "exit the app" ,
286+ onSelect : ( ) => command . trigger ( "app.exit" ) ,
287+ } ,
278288 )
279289 const max = firstBy ( results , [ ( x ) => x . display . length , "desc" ] ) ?. display . length
280290 if ( ! max ) return results
@@ -293,7 +303,7 @@ export function Autocomplete(props: {
293303 const currentFilter = filter ( )
294304 if ( ! currentFilter ) return mixed . slice ( 0 , 10 )
295305 const result = fuzzysort . go ( currentFilter , mixed , {
296- keys : [ "display" , "description" ] ,
306+ keys : [ "display" , "description" , ( obj ) => obj . aliases ?. join ( " " ) ?? "" ] ,
297307 limit : 10 ,
298308 } )
299309 return result . map ( ( arr ) => arr . obj )
0 commit comments