Skip to content

Conversation

@dluc
Copy link
Collaborator

@dluc dluc commented Dec 1, 2025

Summary

Fixes broken human format output in km get and km list commands caused by #1100, which wrapped ContentDto objects in anonymous types that broke HumanOutputFormatter's type checking. This PR restores the table display functionality and improves the human format by:

  • Creating a proper ContentDtoWithNode wrapper class instead of using anonymous objects
  • Repositioning node field before ID for better visibility
  • Simplifying human format output by moving technical details (mimeType, size, dates) to verbose mode only

Before: Human format was broken (displayed as JSON instead of tables)
After: Clean tables showing only essential information: Node, ID, Content, Title, Description, Tags

Changes

  • New file: src/Core/Storage/Models/ContentDtoWithNode.cs - Proper wrapper class for content with node information
  • Modified: src/Main/CLI/Commands/GetCommand.cs - Uses ContentDtoWithNode.FromContentDto() instead of anonymous object
  • Modified: src/Main/CLI/Commands/ListCommand.cs - Uses ContentDtoWithNode.FromContentDto() for list items
  • Modified: src/Main/CLI/OutputFormatters/HumanOutputFormatter.cs - Added FormatContentWithNode() and FormatContentWithNodeList() methods

Human Format Display

km get (normal mode):

  • Node
  • ID
  • Content
  • Title (if present)
  • Description (if present)
  • Tags (if present)

km get (verbose mode adds):

  • MimeType, Size, ContentCreatedAt, RecordCreatedAt, RecordUpdatedAt, Metadata

km list (normal mode):
| Node | ID | Content Preview |

Test Plan

  • All 301 tests pass, 0 skipped
  • Code coverage: 80.14% (exceeds 80% threshold)
  • Build: 0 warnings, 0 errors
  • Formatting: Clean
  • Manual testing: km get displays table with node information
  • Manual testing: km list displays table with node column
  • JSON/YAML formats still include all fields including node

Stats

  • Files changed: 5
  • Lines added: 179
  • Lines removed: 36
  • New classes: 1 (ContentDtoWithNode)

Breaking Changes

None - this is a bug fix that restores expected functionality and improves UX

Fixes broken human format output caused by microsoft#1100 which wrapped ContentDto
in anonymous objects, breaking HumanOutputFormatter's type checking. Also
simplifies human format by hiding technical details (mimeType, size, dates)
in normal mode, showing only essential information.

Changes:
- Created ContentDtoWithNode wrapper class instead of anonymous objects
- Updated HumanOutputFormatter to handle ContentDtoWithNode
- Moved node field before ID in both get and list displays
- Moved mimeType, size, and dates to verbose mode only
- Human format now shows: Node, ID, Content (+ Title, Description, Tags if present)

All 301 tests pass, 0 skipped, coverage 80.14%
@dluc dluc merged commit c376e9a into microsoft:main Dec 1, 2025
3 checks passed
@dluc dluc deleted the fixhumanlist branch December 1, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant