Fix campfire output: typed slice and campfire_line schema#253
Conversation
singleLine previously returned only the first non-empty line, silently dropping the rest. Now it joins all non-empty lines with spaces so table cells show the full content compressed to one line. formatCell in the generic renderer gets the same treatment via strings.Fields for cells that contain \n or \r.
There was a problem hiding this comment.
Pull request overview
Fixes Campfire CLI human-readable output by ensuring Campfire responses flow through the schema-backed presenter path and by introducing an explicit campfire_line presenter schema for Campfire chat lines.
Changes:
- Add
campfire_linepresenter schema (list/detail) to avoid title/content duplication and provide consistent columns. - Fix
campfire listsingle-item output to use a typed slice so it’s normalized and rendered as a table instead of a struct dump. - Wire
WithEntity("campfire_line")into Campfire messages/post/line show outputs and add regression tests for schema loading + multiline collapsing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/presenter/schemas/campfire_line.yaml | New schema defining list/detail presentation for Campfire lines. |
| internal/presenter/presenter_test.go | Tests schema registration and verifies multiline content collapses in schema-backed list rendering. |
| internal/output/output_test.go | End-to-end styled output test for WithEntity("campfire_line"), including multiline collapse and absence of title column. |
| internal/commands/campfire.go | Uses typed slice for single-campfire list output and applies WithEntity("campfire_line") for line-based outputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Normalize \r\n and bare \r to \n before splitting so carriage returns don't leak into table cells. Add test for bare-CR and mixed line endings. Drop unused require import from this commit (child PRs re-add it when they add tests that need it).
- Change []any{campfire} to []basecamp.Campfire{*campfire} so the typed
slice hits the JSON round-trip path instead of falling through to
fmt.Sprintf("%v") struct dump.
- Add campfire_line.yaml presenter schema with content, creator,
created_at columns — excludes title to prevent duplication. No
type_key since API lines use multiple types (Chat::Lines::Text,
Chat::Lines::Upload, Chat::Lines::RichText).
- Wire WithEntity("campfire_line") in messages, post, and show commands.
- Add presenter and output tests for the new schema.
f73b673 to
b9625a7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b9625a7 to
bbd8f34
Compare
…er ANSI assertion
- Use []*basecamp.Campfire{campfire} to avoid struct copy
- Assert both "title" and "Title" absent from campfire_line output
- Widen ANSI check from \x1b[ to \x1b to catch OSC sequences
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Stacked on #251.
Summary
[]any{campfire}→[]basecamp.Campfire{*campfire}so the typed slice hits the JSON round-trip path.campfire_line.yamlpresenter schema with[id, content, creator, created_at]columns — excludestitleto prevent content/title duplication.type_keysince API lines use multiple types (Chat::Lines::Text,Chat::Lines::Upload,Chat::Lines::RichText); commands use explicitWithEntity("campfire_line").WithEntityin messages, post, and line show commands.Test plan
bin/cipassesbasecamp campfires— formatted table, no struct dumpbasecamp campfire messages— no title/content duplication, multiline collapsed