diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-16 02:55:45 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-16 02:55:45 +0200 |
| commit | 12090f25a3677291863dbb80277bdad3eaec0324 (patch) | |
| tree | aa1876002dc5a47cb5130abc38821b07a50bb3f8 | |
| parent | 8ec8ee16e23081018e32dea122ecd9a3b8d8b2c7 (diff) | |
Release v0.23.1v0.23.1
| -rw-r--r-- | internal/hexaicli/run.go | 19 | ||||
| -rw-r--r-- | internal/hexaicli/run_test.go | 20 | ||||
| -rw-r--r-- | internal/version.go | 2 |
3 files changed, 26 insertions, 15 deletions
diff --git a/internal/hexaicli/run.go b/internal/hexaicli/run.go index 4cd94b4..d485e0c 100644 --- a/internal/hexaicli/run.go +++ b/internal/hexaicli/run.go @@ -122,8 +122,8 @@ func Run(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io. return runTPSSimulation(ctx, spec, input, stdout) } - // Load configuration with a logger so file-based config is respected. - logger := log.New(stderr, "hexai ", log.LstdFlags|log.Lmsgprefix) + // Load configuration silently; config-load messages are noise in the CLI. + logger := log.New(io.Discard, "", 0) configPath := configPathFromContext(ctx) cfg := appconfig.LoadWithOptions(logger, appconfig.LoadOptions{ConfigPath: configPath}) if cfg.StatsWindowMinutes > 0 { @@ -367,10 +367,13 @@ func writeCLIJobSummaries(stderr io.Writer, results []*cliJobResult) error { return firstErr } +// writeCLIJobSummary writes the per-job summary (stats or cache-hit note) to +// stderr. It always starts on a new line so that streaming output that does +// not end with a newline is not run together with the meta text. func writeCLIJobSummary(stderr io.Writer, res *cliJobResult) error { summary := strings.TrimLeft(res.summary, "\n") if summary != "" { - if _, err := io.WriteString(stderr, summary); err != nil { + if _, err := fmt.Fprintf(stderr, "\n%s", summary); err != nil { return err } } @@ -619,15 +622,15 @@ func printProviderInfo(errw io.Writer, client llm.Client, model string) { printProviderLabel(errw, client.Name(), chooseCLIModel(model, client.DefaultModel())) } +// printProviderLabel writes a compact "provider:model: " label to errw using +// the same ANSI styling as other meta output. No divider line is emitted so +// the label stays out of the way of the actual response text. func printProviderLabel(errw io.Writer, provider, model string) { if strings.TrimSpace(model) == "" { return } - printer := termprint.NewColumnPrinter(errw, []string{provider}, []string{model}) - if printer == nil { - return - } - printer.PrintHeader() + label := strings.TrimSpace(provider) + ":" + strings.TrimSpace(model) + ":" + _, _ = fmt.Fprintf(errw, logging.AnsiBase+"%s"+logging.AnsiReset+"\n", label) } func chooseCLIModel(model, fallback string) string { diff --git a/internal/hexaicli/run_test.go b/internal/hexaicli/run_test.go index 8059c25..be7bf6b 100644 --- a/internal/hexaicli/run_test.go +++ b/internal/hexaicli/run_test.go @@ -154,8 +154,12 @@ model = "gpt-x" func TestPrintProviderInfo(t *testing.T) { var b bytes.Buffer printProviderInfo(&b, &fakeClient{name: "x", model: "y"}, "y") - if !strings.Contains(b.String(), "x:y") || !strings.Contains(b.String(), "─") { - t.Fatalf("missing provider header: %q", b.String()) + // Expect compact "x:y:" label with no divider line. + if !strings.Contains(b.String(), "x:y:") { + t.Fatalf("missing provider label: %q", b.String()) + } + if strings.Contains(b.String(), "─") { + t.Fatalf("unexpected divider in single-provider header: %q", b.String()) } if strings.Contains(b.String(), "provider=") { t.Fatalf("unexpected legacy provider line: %q", b.String()) @@ -179,11 +183,15 @@ func TestRun_SingleProviderHeaderUsesStderr(t *testing.T) { if got := stdout.String(); got != "OUT" { t.Fatalf("stdout = %q, want %q", got, "OUT") } - if !strings.Contains(stderr.String(), "openai:gpt-4.1") || !strings.Contains(stderr.String(), "─") { - t.Fatalf("stderr missing provider header: %q", stderr.String()) + // Single-provider header is now a compact "openai:gpt-4.1:" label with no divider. + if !strings.Contains(stderr.String(), "openai:gpt-4.1:") { + t.Fatalf("stderr missing provider label: %q", stderr.String()) } - if strings.Contains(stdout.String(), "openai:gpt-4.1") || strings.Contains(stdout.String(), "─") { - t.Fatalf("stdout should not contain provider header: %q", stdout.String()) + if strings.Contains(stderr.String(), "─") { + t.Fatalf("unexpected divider in single-provider stderr: %q", stderr.String()) + } + if strings.Contains(stdout.String(), "openai:gpt-4.1") { + t.Fatalf("stdout should not contain provider label: %q", stdout.String()) } } diff --git a/internal/version.go b/internal/version.go index 74f331e..19e2f9c 100644 --- a/internal/version.go +++ b/internal/version.go @@ -1,4 +1,4 @@ // Summary: Hexai semantic version identifier used by CLI and LSP binaries. package internal -const Version = "0.23.0" +const Version = "0.23.1" |
