add metrics to repl

This commit is contained in:
Robin Olsen
2026-03-02 23:09:59 +01:00
parent 5ebe95b62f
commit 5942d0d8ab

View File

@@ -100,10 +100,15 @@ func (r *REPL) Run(ctx context.Context, config app.Config) error {
// If the user types "exit" or "quit", break the loop and exit the REPL.
if input == "exit" || input == "quit" {
r.logAction("repl exit requested")
fmt.Println("Goodbye!")
break
}
if input != "" {
r.logAction("repl command: " + input)
}
// Add the input to the history for future navigation.
history = append(history, input)
@@ -144,3 +149,12 @@ func (r *REPL) SetChannels(feedbackChan chan task.ValidationFeedback, quitChan c
r.feedbackChan = feedbackChan
r.quitChan = quitChan
}
func (r *REPL) logAction(action string) {
if r.app != nil {
r.app.LogAction(models.EncodeActionEvent(models.ActionEvent{
Source: "repl",
Action: action,
}))
}
}