MCPcopy Create free account
hub / github.com/astercloud/aster / handleCommand

Function handleCommand

cmd/aster/session.go:377–413  ·  view source on GitHub ↗

handleCommand handles slash commands

(ctx context.Context, cmd string, ag *agent.Agent, sessionStore session.Service, sessionID string, useColor bool)

Source from the content-addressed store, hash-verified

375
376// handleCommand handles slash commands
377func handleCommand(ctx context.Context, cmd string, ag *agent.Agent, sessionStore session.Service, sessionID string, useColor bool) (bool, error) {
378 parts := strings.Fields(cmd)
379 if len(parts) == 0 {
380 return false, nil
381 }
382
383 switch parts[0] {
384 case "/exit", "/quit":
385 printColored(useColor, colorYellow, "👋 Goodbye!\n")
386 return true, nil
387
388 case "/clear":
389 // TODO: Clear agent history
390 printColored(useColor, colorGreen, "✓ Conversation cleared\n")
391 return true, nil
392
393 case "/help":
394 printHelp(useColor)
395 return true, nil
396
397 case "/status":
398 status := ag.Status()
399 printColored(useColor, colorCyan, "Agent Status:\n")
400 printColored(useColor, colorGray, " ID: %s\n", status.AgentID)
401 printColored(useColor, colorGray, " State: %s\n", status.State)
402 printColored(useColor, colorGray, " Steps: %d\n", status.StepCount)
403 return true, nil
404
405 case "/session":
406 printColored(useColor, colorCyan, "Session ID: %s\n", sessionID)
407 return true, nil
408
409 default:
410 // Not a known command, let agent handle it (might be a slash command)
411 return false, nil
412 }
413}
414
415// waitForCompletion waits for the agent to finish processing
416func waitForCompletion(ctx context.Context, ag *agent.Agent) {

Callers 1

runREPLFunction · 0.85

Calls 3

printColoredFunction · 0.85
printHelpFunction · 0.70
StatusMethod · 0.45

Tested by

no test coverage detected