feat: include node information in get and list command responses#1100
Merged
dluc merged 2 commits intomicrosoft:mainfrom Dec 1, 2025
Merged
feat: include node information in get and list command responses#1100dluc merged 2 commits intomicrosoft:mainfrom
dluc merged 2 commits intomicrosoft:mainfrom
Conversation
Add node ID to the JSON/YAML responses of both get and list commands to inform users which node was used for the operation.
Changes:
- Modified GetCommand to include node.Id in response output
- Modified ListCommand to include node.Id in each item's response
- Both commands now show: {id, node, content, mimeType, byteSize, ...}
- All 301 tests pass with 81.99% coverage
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)
Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
dluc
added a commit
to dluc/kernel-memory
that referenced
this pull request
Dec 1, 2025
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%
7 tasks
dluc
added a commit
that referenced
this pull request
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 - [x] All 301 tests pass, 0 skipped - [x] Code coverage: 80.14% (exceeds 80% threshold) - [x] Build: 0 warnings, 0 errors - [x] Formatting: Clean - [x] Manual testing: `km get` displays table with node information - [x] Manual testing: `km list` displays table with node column - [x] 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhances both the
getandlistcommands to include node information in their JSON/YAML responses, allowing users to see which node was used for retrieving the content.Before (get command):
{ "id": "sh7lxf0xxkyekj70632czg2c", "content": "Call pediatrician for flu shot appointment", "mimeType": "text/plain", "byteSize": 42, ... }After (get command):
{ "id": "sh7lxf0xxkyekj70632czg2c", "node": "personal", "content": "Call pediatrician for flu shot appointment", "mimeType": "text/plain", "byteSize": 42, ... }Before (list command):
{ "items": [ { "id": "sh7lxf0xxkyekj70632czg2c", "content": "...", ... } ], "pagination": {...} }After (list command):
{ "items": [ { "id": "sh7lxf0xxkyekj70632czg2c", "node": "personal", "content": "...", ... } ], "pagination": {...} }Changes
GetCommand.csto wrap result with node informationListCommand.csto wrap each item with node informationInitialize()methodTesting
Stats
Breaking Changes
None - this is a backward-compatible enhancement that adds information to the response while maintaining all existing fields.