Add comprehensive Claude Code monitoring and realtime streaming to the K8s dashboard. Includes API endpoints for health, stats, summary, inventory, and live event streaming. Frontend provides overview, usage, inventory, debug, and live feed views.
25 lines
396 B
Go
25 lines
396 B
Go
package claude
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func TailLastNLines(path string, n int) ([]string, error) {
|
|
content, err := os.ReadFile(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
lines := strings.Split(string(content), "\n")
|
|
|
|
var result []string
|
|
for i := len(lines) - 1; i >= 0 && len(result) < n; i-- {
|
|
if lines[i] != "" {
|
|
result = append(result, lines[i])
|
|
}
|
|
}
|
|
|
|
return result, nil
|
|
}
|