diff --git a/.ai/checkpoints/topic-7-catalog-instance-commands.md b/.ai/checkpoints/topic-7-catalog-instance-commands.md index 6b9669a..d29e555 100644 --- a/.ai/checkpoints/topic-7-catalog-instance-commands.md +++ b/.ai/checkpoints/topic-7-catalog-instance-commands.md @@ -41,7 +41,7 @@ Topic 7 implements the `dcm catalog instance` command group with subcommands (`c | TC-U076 | Get without INSTANCE_ID → UsageError (exit code 2) | Pass | | TC-U077 | Delete instance — DELETE, displays success message | Pass | | TC-U078 | Delete without INSTANCE_ID → UsageError (exit code 2) | Pass | -| TC-U079 | Table output columns: UID, DISPLAY NAME, CATALOG ITEM, CREATED | Pass | +| TC-U079 | Table output columns: UID, DISPLAY NAME, CATALOG ITEM, RESOURCE ID, CREATED | Pass | | TC-U112 | Empty list — table shows headers only; JSON shows empty `results` array | Pass | | TC-U113 | Get non-existent instance — 404 RFC 7807 error formatted to stderr | Pass | | TC-U114 | Delete non-existent instance — 404 RFC 7807 error formatted to stderr | Pass | @@ -66,7 +66,7 @@ Topic 7 implements the `dcm catalog instance` command group with subcommands (`c 2. **Reuses `newCatalogClient` from helpers.go** — Per Topic 5's design, the catalog client constructor is shared across all catalog commands (service-type, item, instance). -3. **Table columns** — UID, DISPLAY NAME, CATALOG ITEM, CREATED. The catalog item ID is extracted from `spec.catalog_item_id` via the nested map access pattern. +3. **Table columns** — UID, DISPLAY NAME, CATALOG ITEM, RESOURCE ID, CREATED. The catalog item ID and resource ID are extracted from `spec.catalog_item_id` and `spec.resource_id` via the nested map access pattern. 4. **List response uses `results` field** — Consistent with the Catalog Manager's response format, same as service-type and catalog item lists. diff --git a/.ai/specs/dcm-cli.spec.md b/.ai/specs/dcm-cli.spec.md index 3408982..c643b2b 100644 --- a/.ai/specs/dcm-cli.spec.md +++ b/.ai/specs/dcm-cli.spec.md @@ -816,8 +816,8 @@ instance logs. #### Table Output Columns ``` -ID UID DISPLAY NAME CATALOG ITEM CREATED -my-instance c3d4e5f6-a7b8-9012-cdef-123456789012 My App Instance my-catalog-item 2026-03-09T10:00:00Z +ID UID DISPLAY NAME CATALOG ITEM RESOURCE ID CREATED +my-instance c3d4e5f6-a7b8-9012-cdef-123456789012 My App Instance my-catalog-item res-abc123 2026-03-09T10:00:00Z ``` #### Acceptance Criteria diff --git a/.ai/test-plans/dcm-cli-unit.test-plan.md b/.ai/test-plans/dcm-cli-unit.test-plan.md index 2a628e5..4d5e7f5 100644 --- a/.ai/test-plans/dcm-cli-unit.test-plan.md +++ b/.ai/test-plans/dcm-cli-unit.test-plan.md @@ -868,7 +868,7 @@ test classes. Instead: - **Type:** Unit - **Given:** A mock server returning an instance with all fields populated - **When:** `dcm catalog instance get my-instance` is executed with `--output table` -- **Then:** The table output includes columns: ID, UID, DISPLAY NAME, CATALOG ITEM, CREATED +- **Then:** The table output includes columns: ID, UID, DISPLAY NAME, CATALOG ITEM, RESOURCE ID, CREATED --- diff --git a/internal/commands/catalog_instance.go b/internal/commands/catalog_instance.go index c35bd32..c2c810a 100644 --- a/internal/commands/catalog_instance.go +++ b/internal/commands/catalog_instance.go @@ -13,20 +13,23 @@ import ( ) var catalogInstanceTableDef = &output.TableDef{ - Headers: []string{"UID", "DISPLAY NAME", "CATALOG ITEM", "CREATED"}, + Headers: []string{"UID", "DISPLAY NAME", "CATALOG ITEM", "RESOURCE ID", "CREATED"}, RowFunc: func(resource any) []string { m, ok := resource.(map[string]any) if !ok { - return []string{"", "", "", ""} + return []string{"", "", "", "", ""} } var catalogItemID string + var resourceID string if spec, ok := m["spec"].(map[string]any); ok { catalogItemID = stringifyValue(spec, "catalog_item_id") + resourceID = stringifyValue(spec, "resource_id") } return []string{ stringifyValue(m, "uid"), stringifyValue(m, "display_name"), catalogItemID, + resourceID, stringifyValue(m, "create_time"), } }, diff --git a/internal/commands/catalog_instance_test.go b/internal/commands/catalog_instance_test.go index cbd4d07..dbb62ed 100644 --- a/internal/commands/catalog_instance_test.go +++ b/internal/commands/catalog_instance_test.go @@ -22,6 +22,7 @@ func sampleInstanceResponse() map[string]any { "create_time": "2026-03-09T10:00:00Z", "spec": map[string]any{ "catalog_item_id": "my-catalog-item", + "resource_id": "res-abc123", }, } } @@ -286,10 +287,12 @@ var _ = Describe("Catalog Instance Commands", func() { Expect(out).To(ContainSubstring("UID")) Expect(out).To(ContainSubstring("DISPLAY NAME")) Expect(out).To(ContainSubstring("CATALOG ITEM")) + Expect(out).To(ContainSubstring("RESOURCE ID")) Expect(out).To(ContainSubstring("CREATED")) Expect(out).To(ContainSubstring("c3d4e5f6-a7b8-9012-cdef-123456789012")) Expect(out).To(ContainSubstring("My App Instance")) Expect(out).To(ContainSubstring("my-catalog-item")) + Expect(out).To(ContainSubstring("res-abc123")) Expect(out).To(ContainSubstring("2026-03-09T10:00:00Z")) }) })