From 40fd42809659d88880a9a839923a81025a2e070d Mon Sep 17 00:00:00 2001 From: Connor Moss Date: Thu, 12 Nov 2026 10:49:06 -0500 Subject: [PATCH] fix: print a2a version as JSON under -o jsonl version checked for -o json only, so -o jsonl printed the text form. Use IsJSON like the other commands. --- internal/cli/cli_test.go | 30 ++++++++++++++++-------------- internal/cli/version.go | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/internal/cli/cli_test.go b/internal/cli/cli_test.go index 9af68ba..e87ae96 100644 --- a/internal/cli/cli_test.go +++ b/internal/cli/cli_test.go @@ -243,20 +243,22 @@ func TestVersion(t *testing.T) { } }) - t.Run("json output", func(t *testing.T) { - t.Parallel() - out := mustRunCMD(t, "version", "-o", "json") - var info versionInfo - if err := json.Unmarshal([]byte(out), &info); err != nil { - t.Fatalf("json.Unmarshal(version output) error = %v", err) - } - if info.Version == "" { - t.Fatalf("a2a version info.Version = %q, want non-empty", info.Version) - } - if info.GoVersion == "" { - t.Fatalf("a2a version info.GoVersion = %q, want non-empty", info.GoVersion) - } - }) + for _, mode := range []string{"json", "jsonl"} { + t.Run(mode+" output", func(t *testing.T) { + t.Parallel() + out := mustRunCMD(t, "version", "-o", mode) + var info versionInfo + if err := json.Unmarshal([]byte(out), &info); err != nil { + t.Fatalf("json.Unmarshal(version output) error = %v", err) + } + if info.Version == "" { + t.Fatalf("a2a version info.Version = %q, want non-empty", info.Version) + } + if info.GoVersion == "" { + t.Fatalf("a2a version info.GoVersion = %q, want non-empty", info.GoVersion) + } + }) + } } func TestSkill(t *testing.T) { diff --git a/internal/cli/version.go b/internal/cli/version.go index c6b15b3..89f674c 100644 --- a/internal/cli/version.go +++ b/internal/cli/version.go @@ -45,7 +45,7 @@ func newVersionCmd(cfg *globalConfig) *cobra.Command { Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { info := buildVersionInfo() - if cfg.output == "json" { + if cfg.IsJSON() { return cfg.PrintJSON(info) } _, err := fmt.Fprintf(