MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / cmdDebugShow

Function cmdDebugShow

commands.go:378–412  ·  view source on GitHub ↗

cmdDebugShow dumps a single event's full payload to scrollback. With no argument it shows the most recent event that has a payload.

(idStr string)

Source from the content-addressed store, hash-verified

376// cmdDebugShow dumps a single event's full payload to scrollback. With no
377// argument it shows the most recent event that has a payload.
378func cmdDebugShow(idStr string) {
379 var (
380 e debug.Event
381 ok bool
382 )
383 if idStr == "" {
384 e, ok = debug.Latest()
385 if !ok {
386 fmt.Println(ui.Dimmed("debug log is empty"))
387 return
388 }
389 } else {
390 id, err := strconv.ParseUint(idStr, 10, 64)
391 if err != nil {
392 fmt.Printf("not a valid id: %s\n", idStr)
393 return
394 }
395 e, ok = debug.FindByID(id)
396 if !ok {
397 fmt.Printf("no event with id #%d (it may have aged out of the ring)\n", id)
398 return
399 }
400 }
401 header := fmt.Sprintf("#%d %s %s %s",
402 e.ID, e.Time.Format("15:04:05.000"), e.Source, e.Message)
403 fmt.Println(ui.Cyan(header))
404 if e.Payload == "" {
405 fmt.Println(ui.Dimmed("(no payload)"))
406 return
407 }
408 // Reuse the modal's JSON-aware highlighter so /debug show in scrollback
409 // reads as nicely as the modal does. No wrap (width=0) — let the
410 // scrollback viewport do its own thing.
411 fmt.Println(ui.HighlightPayload(e.Payload, 0))
412}
413
414func cmdExit(_ string) {
415 os.Exit(0)

Callers 1

cmdDebugFunction · 0.85

Calls 5

LatestFunction · 0.92
DimmedFunction · 0.92
FindByIDFunction · 0.92
CyanFunction · 0.92
HighlightPayloadFunction · 0.92

Tested by

no test coverage detected