@@ -5,8 +5,8 @@ describe("Built-in Commands", () => {
55 it ( "should return all built-in commands" , async ( ) => {
66 const commands = await getBuiltInCommands ( )
77
8- expect ( commands ) . toHaveLength ( 1 )
9- expect ( commands . map ( ( cmd ) => cmd . name ) ) . toEqual ( expect . arrayContaining ( [ "init" ] ) )
8+ expect ( commands ) . toHaveLength ( 2 )
9+ expect ( commands . map ( ( cmd ) => cmd . name ) ) . toEqual ( expect . arrayContaining ( [ "init" , "stats" ] ) )
1010
1111 // Verify all commands have required properties
1212 commands . forEach ( ( command ) => {
@@ -63,10 +63,10 @@ describe("Built-in Commands", () => {
6363 it ( "should return all built-in command names" , async ( ) => {
6464 const names = await getBuiltInCommandNames ( )
6565
66- expect ( names ) . toHaveLength ( 1 )
67- expect ( names ) . toEqual ( expect . arrayContaining ( [ "init" ] ) )
66+ expect ( names ) . toHaveLength ( 2 )
67+ expect ( names ) . toEqual ( expect . arrayContaining ( [ "init" , "stats" ] ) )
6868 // Order doesn't matter since it's based on filesystem order
69- expect ( names . sort ( ) ) . toEqual ( [ "init" ] )
69+ expect ( names . sort ( ) ) . toEqual ( [ "init" , "stats" ] )
7070 } )
7171
7272 it ( "should return array of strings" , async ( ) => {
@@ -99,5 +99,21 @@ describe("Built-in Commands", () => {
9999 expect ( content ) . toContain ( "rules-ask" )
100100 expect ( content ) . toContain ( "rules-architect" )
101101 } )
102+
103+ it ( "stats command should expose the /stats token for ChatView interception" , async ( ) => {
104+ const command = await getBuiltInCommand ( "stats" )
105+
106+ expect ( command ) . toBeDefined ( )
107+ expect ( command ! . name ) . toBe ( "stats" )
108+ expect ( command ! . source ) . toBe ( "built-in" )
109+ expect ( command ! . filePath ) . toBe ( "<built-in:stats>" )
110+ // Content must be the literal "/stats" so that ChatView's
111+ // exact-match interception (text === "/stats") fires when the
112+ // user picks this autocomplete entry.
113+ expect ( command ! . content ) . toBe ( "/stats" )
114+ expect ( command ! . description ) . toBe (
115+ "Open the local usage statistics panel (token usage by model, provider, mode, and time range)" ,
116+ )
117+ } )
102118 } )
103119} )
0 commit comments