| 1 | package cli |
| 2 | |
| 3 | import ( |
| 4 | "flag" |
| 5 | "fmt" |
| 6 | "os" |
| 7 | |
| 8 | "reasonix/internal/boot" |
| 9 | ) |
| 10 | |
| 11 | func doctorRuntimeCommand(args []string) int { |
| 12 | fs := flag.NewFlagSet("doctor runtime", flag.ContinueOnError) |
| 13 | jsonOut := fs.Bool("json", false, "print runtime diagnostics as JSON") |
| 14 | if code, ok := parseCommandFlags(fs, args); !ok { |
| 15 | return code |
| 16 | } |
| 17 | // Process-wide gate/metrics report (no live BuildResult in CLI doctor). |
| 18 | report := boot.CollectRuntimeDoctor(nil) |
| 19 | if *jsonOut { |
| 20 | raw, err := boot.RenderRuntimeDoctorJSON(report) |
| 21 | if err != nil { |
| 22 | fmt.Fprintln(os.Stderr, err) |
| 23 | return 1 |
| 24 | } |
| 25 | fmt.Println(string(raw)) |
| 26 | return 0 |
| 27 | } |
| 28 | fmt.Print(boot.RenderRuntimeDoctorText(report)) |
| 29 | return 0 |
| 30 | } |
| 31 |