fix(cli): plain read-note renders the payload faithfully, no decoration

Drop the synthesized title/permalink header and the (no content)
placeholder: plain mode is the content verbatim (note body, or the literal
file with --include-frontmatter). Decoration belongs to the Rich path.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Drew Cain <groksrc@gmail.com>
This commit is contained in:
Drew Cain
2026-06-12 11:29:13 -05:00
parent cab4bf10d0
commit 6d2ff99b8f
2 changed files with 18 additions and 31 deletions
+7 -12
View File
@@ -755,19 +755,14 @@ def test_search_notes_plain_empty(mock_mcp):
return_value=READ_NOTE_RESULT,
)
def test_read_note_plain_output(mock_mcp):
"""read-note --plain emits a header line and the raw markdown body."""
"""read-note --plain emits the note body faithfully, with no decoration."""
result = _tty_runner(["tool", "read-note", "test-note", "--plain"])
assert result.exit_code == 0, f"CLI failed: {result.output}"
assert "Test Note [notes/test-note]" in result.output
# Raw markdown body, not Rich-rendered
assert "# Test Note" in result.output
assert "hello world" in result.output
# No frontmatter without the flag
assert "tags:" not in result.output
# Exactly one blank line between header and body: the payload's leading
# newline (frontmatter-strip artifact) must not stack with the renderer's.
assert "Test Note [notes/test-note]\n\n# Test Note" in result.output
# No synthesized header line -- plain mode is the payload, faithfully.
assert "[notes/test-note]" not in result.output
# The body verbatim, trimmed of the API's frontmatter-strip newline artifact.
assert result.output == "# Test Note\n\nhello world\n"
@patch(
@@ -798,11 +793,11 @@ def test_read_note_plain_include_frontmatter(mock_mcp):
return_value={"title": "", "permalink": "", "content": "", "frontmatter": {}},
)
def test_read_note_plain_empty_content(mock_mcp):
"""read-note --plain handles empty content."""
"""read-note --plain prints nothing for an empty note (no placeholder)."""
result = _tty_runner(["tool", "read-note", "empty-note", "--plain"])
assert result.exit_code == 0, f"CLI failed: {result.output}"
assert "(no content)" in result.output
assert result.output == ""
@patch(