Skip to content

Fix campfire output: typed slice and campfire_line schema#253

Merged
jeremy merged 5 commits intomainfrom
fix-campfire-output
Mar 11, 2026
Merged

Fix campfire output: typed slice and campfire_line schema#253
jeremy merged 5 commits intomainfrom
fix-campfire-output

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 11, 2026

Stacked on #251.

Summary

  • Fix struct dump: []any{campfire}[]basecamp.Campfire{*campfire} so the typed slice hits the JSON round-trip path.
  • Add campfire_line.yaml presenter schema with [id, content, creator, created_at] columns — excludes title to prevent content/title duplication.
  • No type_key since API lines use multiple types (Chat::Lines::Text, Chat::Lines::Upload, Chat::Lines::RichText); commands use explicit WithEntity("campfire_line").
  • Wire WithEntity in messages, post, and line show commands.

Test plan

  • bin/ci passes
  • basecamp campfires — formatted table, no struct dump
  • basecamp campfire messages — no title/content duplication, multiline collapsed

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.
@jeremy jeremy requested a review from a team as a code owner March 11, 2026 03:37
Copilot AI review requested due to automatic review settings March 11, 2026 03:37
@github-actions github-actions bot added commands CLI command implementations tests Tests (unit and e2e) output Output formatting and presentation bug Something isn't working labels Mar 11, 2026
@jeremy jeremy mentioned this pull request Mar 11, 2026
3 tasks
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_line presenter schema (list/detail) to avoid title/content duplication and provide consistent columns.
  • Fix campfire list single-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.

jeremy added 2 commits March 10, 2026 21:24
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.
Copilot AI review requested due to automatic review settings March 11, 2026 04:24
@jeremy jeremy force-pushed the fix-campfire-output branch from f73b673 to b9625a7 Compare March 11, 2026 04:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/commands/campfire.go
Comment thread internal/output/output_test.go
Comment thread internal/output/output_test.go Outdated
@jeremy jeremy force-pushed the fix-campfire-output branch from b9625a7 to bbd8f34 Compare March 11, 2026 04:43
Base automatically changed from fix-multiline-table-cells to main March 11, 2026 05:01
…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
Copilot AI review requested due to automatic review settings March 11, 2026 05:06
@jeremy jeremy merged commit f28b5cb into main Mar 11, 2026
28 checks passed
@jeremy jeremy deleted the fix-campfire-output branch March 11, 2026 05:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working commands CLI command implementations output Output formatting and presentation tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants