@@ -95,6 +95,18 @@ const DIRECT_COMMANDS: Record<string, (ctx: CommandContext) => Promise<void> | v
9595 if ( r !== null ) ctx . onEvent ( { kind : 'text_delta' , text : 'Last commit undone. Changes preserved in staging.\n' } ) ;
9696 emitDone ( ctx ) ;
9797 } ,
98+ '/help' : ( ctx ) => {
99+ ctx . onEvent ( { kind : 'text_delta' , text :
100+ `**RunCode Commands**\n\n` +
101+ ` **Coding:** /commit /review /test /fix /debug /explain /search /find /refactor /scaffold\n` +
102+ ` **Git:** /push /pr /undo /status /diff /log /branch /stash /unstash\n` +
103+ ` **Analysis:** /security /lint /optimize /todo /deps /clean /migrate /doc\n` +
104+ ` **Session:** /plan /execute /compact /retry /sessions /resume /context /tasks\n` +
105+ ` **Info:** /model /wallet /cost /mcp /doctor /version /bug /help\n` +
106+ ` **UI:** /clear /exit\n`
107+ } ) ;
108+ emitDone ( ctx ) ;
109+ } ,
98110 '/bug' : ( ctx ) => {
99111 ctx . onEvent ( { kind : 'text_delta' , text : 'Report issues at: https://github.com/BlockRunAI/runcode/issues\n' } ) ;
100112 emitDone ( ctx ) ;
@@ -121,13 +133,16 @@ const DIRECT_COMMANDS: Record<string, (ctx: CommandContext) => Promise<void> | v
121133 '/context' : async ( ctx ) => {
122134 const { estimated, apiAnchored } = getAnchoredTokenCount ( ctx . history ) ;
123135 const contextWindow = getContextWindow ( ctx . config . model ) ;
124- const usagePct = ( ( estimated / contextWindow ) * 100 ) . toFixed ( 1 ) ;
136+ const pct = ( estimated / contextWindow ) * 100 ;
137+ const usagePct = pct . toFixed ( 1 ) ;
138+ const warning = pct > 80 ? ' ⚠ Near limit — consider /compact\n' : '' ;
125139 ctx . onEvent ( { kind : 'text_delta' , text :
126140 `**Session Context**\n` +
127141 ` Model: ${ ctx . config . model } \n` +
128142 ` Mode: ${ ctx . config . permissionMode || 'default' } \n` +
129143 ` Messages: ${ ctx . history . length } \n` +
130144 ` Tokens: ~${ estimated . toLocaleString ( ) } / ${ ( contextWindow / 1000 ) . toFixed ( 0 ) } k (${ usagePct } %)${ apiAnchored ? ' ✓' : ' ~' } \n` +
145+ warning +
131146 ` Session: ${ ctx . sessionId } \n` +
132147 ` Directory: ${ ctx . config . workingDir || process . cwd ( ) } \n`
133148 } ) ;
@@ -141,6 +156,12 @@ const DIRECT_COMMANDS: Record<string, (ctx: CommandContext) => Promise<void> | v
141156 catch { checks . push ( '⚠ ripgrep not found (using native grep fallback)' ) ; }
142157 checks . push ( fs . existsSync ( path . join ( BLOCKRUN_DIR , 'wallet.json' ) ) ? '✓ wallet configured' : '⚠ no wallet — run: runcode setup' ) ;
143158 checks . push ( fs . existsSync ( path . join ( BLOCKRUN_DIR , 'runcode-config.json' ) ) ? '✓ config file exists' : '⚠ no config — using defaults' ) ;
159+ // Check MCP
160+ const { listMcpServers } = await import ( '../mcp/client.js' ) ;
161+ const mcpServers = listMcpServers ( ) ;
162+ checks . push ( mcpServers . length > 0
163+ ? `✓ MCP: ${ mcpServers . length } server(s), ${ mcpServers . reduce ( ( a , s ) => a + s . toolCount , 0 ) } tools`
164+ : '⚠ no MCP servers connected' ) ;
144165 checks . push ( `✓ model: ${ ctx . config . model } ` ) ;
145166 checks . push ( `✓ history: ${ ctx . history . length } messages, ~${ estimateHistoryTokens ( ctx . history ) . toLocaleString ( ) } tokens` ) ;
146167 checks . push ( `✓ session: ${ ctx . sessionId } ` ) ;
0 commit comments