From bff7909bb7f0cf698353b6a0db64ea15ce778cd9 Mon Sep 17 00:00:00 2001 From: beausterling Date: Tue, 11 Aug 2026 23:35:09 -0700 Subject: [PATCH] fix: preserve group fields in compact output --- .printing-press-patches.json | 18 ++++++++++++++++++ internal/cli/helpers.go | 2 ++ internal/cli/helpers_test.go | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 .printing-press-patches.json create mode 100644 internal/cli/helpers_test.go diff --git a/.printing-press-patches.json b/.printing-press-patches.json new file mode 100644 index 0000000..122270e --- /dev/null +++ b/.printing-press-patches.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "applied_at": "2026-08-11", + "base_run_id": "metadata-not-present", + "base_printing_press_version": "metadata-not-present", + "patches": [ + { + "id": "compact-me-groups-fields", + "summary": "Preserve group identity fields in compact me groups output.", + "reason": "The command emits title-cased fields, causing --agent compact output to return empty objects.", + "files": [ + "internal/cli/helpers.go", + "internal/cli/helpers_test.go" + ], + "validated_outcome": "Compact output retains Hash, Name, and Slug while omitting verbose fields." + } + ] +} \ No newline at end of file diff --git a/internal/cli/helpers.go b/internal/cli/helpers.go index 2ed8c85..a37b690 100644 --- a/internal/cli/helpers.go +++ b/internal/cli/helpers.go @@ -591,6 +591,8 @@ func compactFields(data json.RawMessage) json.RawMessage { func compactListFields(items []map[string]any) json.RawMessage { keepFields := map[string]bool{ "id": true, "name": true, "title": true, "identifier": true, + // PATCH: Preserve the title-cased identity fields emitted by `me groups`. + "Hash": true, "Name": true, "Slug": true, "status": true, "state": true, "type": true, "priority": true, "url": true, "email": true, "key": true, "created_at": true, "updated_at": true, "createdAt": true, "updatedAt": true, diff --git a/internal/cli/helpers_test.go b/internal/cli/helpers_test.go new file mode 100644 index 0000000..98a362f --- /dev/null +++ b/internal/cli/helpers_test.go @@ -0,0 +1,33 @@ +package cli + +import ( + "encoding/json" + "testing" +) + +func TestCompactListFieldsPreservesMeGroupIdentity(t *testing.T) { + input := []map[string]any{ + { + "Hash": "97d0633486794bc8a486f31f2ff4be2d", + "Name": "GenHQ - Creative AI Education", + "Slug": "genhq", + "description": "verbose field that compact output should omit", + }, + } + + var got []map[string]any + if err := json.Unmarshal(compactListFields(input), &got); err != nil { + t.Fatalf("decode compact output: %v", err) + } + if len(got) != 1 { + t.Fatalf("expected one group, got %d", len(got)) + } + for _, field := range []string{"Hash", "Name", "Slug"} { + if got[0][field] == "" { + t.Errorf("expected %s to survive compact output, got %#v", field, got[0]) + } + } + if _, ok := got[0]["description"]; ok { + t.Errorf("description should be omitted from compact output: %#v", got[0]) + } +}