MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / handleSlashCommand

Function handleSlashCommand

compatible-shell/src/cli.mjs:144–186  ·  view source on GitHub ↗
(line, state)

Source from the content-addressed store, hash-verified

142}
143
144async function handleSlashCommand(line, state) {
145 switch (line) {
146 case '/help':
147 printRuntimeHelp()
148 return false
149 case '/tools':
150 for (const tool of TOOL_DEFINITIONS) {
151 console.log(`- ${tool.name}: ${tool.description}`)
152 }
153 return false
154 case '/config':
155 console.log(
156 JSON.stringify(
157 {
158 workspaceDir: state.workspaceDir,
159 baseUrl: state.clientConfig.baseUrl,
160 model: state.clientConfig.model,
161 maxTokens: state.clientConfig.maxTokens,
162 maxToolRounds: state.maxToolRounds,
163 autoApproveShell: state.autoApproveShell,
164 sessionPath: state.sessionStore.sessionPath,
165 },
166 null,
167 2,
168 ),
169 )
170 return false
171 case '/clear':
172 state.messages.length = 0
173 console.log('Conversation cleared.')
174 return false
175 case '/save':
176 console.log(`Saved session to ${await persistSession(state)}`)
177 return false
178 case '/exit':
179 case '/quit':
180 return true
181 default:
182 console.log(`Unknown command: ${line}`)
183 console.log('Type /help for available commands.')
184 return false
185 }
186}
187
188async function confirmShellCommand(command, state, rl) {
189 if (state.autoApproveShell) {

Callers 1

mainFunction · 0.85

Calls 2

printRuntimeHelpFunction · 0.85
persistSessionFunction · 0.85

Tested by

no test coverage detected