Commit f8def41
authored
Comment flags on all show commands + bug fixes (#394)
* Fix renderer comments suppression causing data loss
renderObject unconditionally skipped the "comments" key, then
topLevelComments tried to reconstruct it as []map[string]any.
When comments was a different shape (string, int, []string) —
as happens with `basecamp api get` — reconstruction returned nil
and data was silently dropped.
Only skip "comments" in the field loop when topLevelComments
returns non-nil. Both styled and markdown renderers.
* Fix false-positive attachment regression tests
TestStyledRenderObjectPreservesUnknownAttachmentFields asserted
custom_attachments_report survived — but that key doesn't end
with _attachments, so it passed under the old code too.
previewable_attachments was in the test data but never asserted.
Assert previewable_attachments values appear in output (both
styled and markdown). Remove the misleading assertion.
* Redesign commentFlags for three-flag model
Three mutually exclusive flags: --comments / --no-comments /
--all-comments. addCommentFlags(cmd, defaultOn) controls whether
comments are fetched by default (show) or require opt-in (typed
show commands).
New fetchCommentsForRecording derives count from API response
metadata, not the parent's comments_count. fetchRecordingComments
becomes a thin wrapper that falls back to the parent's count when
Meta.TotalCount is unavailable.
* Always fetch comments in show; gate non-commentable types
Drop the comments_count gate — basecamp show now always attempts
comment fetching for commentable types. Skip the fetch for people
and boosts which don't support comments.
Update tests: expect the extra comments request, add
X-Total-Count header support to mock transport, rename
TestShowCommentsMissingField to TestShowSkipsCommentsForNonCommentableTypes.
* Add --comments / --no-comments / --all-comments to typed show commands
Wire fetchCommentsForRecording into all commentable show commands:
todos, messages, cards, files, todolists, schedule (both paths),
checkins (question + answer), forwards, chat line.
defaultOn=false means typed commands require --comments or
--all-comments to opt in. Attachment notices are merged via
applyNotices. Comments on comments are excluded (flat model).
* Update .surface and SKILL.md for comment flags
Regenerate CLI surface snapshot with new --comments,
--no-comments, --all-comments flags on typed show commands.
Acknowledge comments show flag removal in .surface-breaking.
Update skill with typed show command examples.
* Fix empty comments array leaking as field; rename tests
Use isCommentsArray to decide whether to suppress the raw
comments field, not len(comments) > 0. topLevelComments returns
nil for empty arrays (toMapSlice on []any{}), so empty comments
arrays were rendered as regular fields instead of being suppressed.
Rename attachment tests to reflect updated fixture focus.
* Exclude comment type from automatic comment fetch
Add comment/comments CLI aliases and Comment API type to
isCommentableShowType's non-commentable list. Comments are flat —
attempting to fetch comments-on-comments wastes a request and can
produce misleading diagnostics.
* Wire comment flags into checkins parent shortcut commands
Register --comments/--no-comments/--all-comments on the parent
question and answer commands so both entry points (shortcut and
explicit show) accept the same flags.
* Regenerate .surface; remove stale .surface-breaking entries
Fresh surface snapshot reflects comment type exclusion and
checkins parent flag wiring. Remove the comments show flag
removal entries from .surface-breaking — the flags were never
in the regenerated baseline.
* Extract commentEnrichment.apply helper; collapse enrichment tail
Every typed show command repeated the same withComments / applyNotices /
breadcrumbs sequence. The new apply() method on commentEnrichment returns
enriched data and composed opts in one call. All 11 call sites now use it.
Includes tests for apply() (nil, populated, breadcrumb composition) and
isCommentableShowType (CLI aliases, generic lookups, API types).
* Render comments after entity presenter in styled and markdown output
The schema-driven presenter only renders fields declared in YAML schemas,
so comments injected via withComments were silently dropped in styled and
markdown output. Extract comments from NormalizeData(resp.Data) — never
from DisplayData — and append a comments section after the presenter body.
Includes tests for entity+comments rendering (plain entity and DisplayData
split path, both formats) and isCommentsArray coverage.
* Address review feedback: rename test, add truncation notice fallback
Rename TestShowNoCommentsWhenCountZero to TestShowFetchesCommentsEvenWhenCountZero
to match the actual assertion (comments ARE fetched even with count 0).
When Meta.TotalCount is missing from the API response but the parent's
comments_count indicates truncation occurred, recompute the truncation
notice so the user sees a warning and the --all-comments breadcrumb.1 parent 87432e3 commit f8def41
19 files changed
Lines changed: 672 additions & 125 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
761 | 761 | | |
762 | 762 | | |
763 | 763 | | |
| 764 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
| |||
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| 292 | + | |
| 293 | + | |
291 | 294 | | |
292 | 295 | | |
293 | 296 | | |
| |||
300 | 303 | | |
301 | 304 | | |
302 | 305 | | |
| 306 | + | |
303 | 307 | | |
304 | 308 | | |
305 | 309 | | |
| |||
317 | 321 | | |
318 | 322 | | |
319 | 323 | | |
320 | | - | |
| 324 | + | |
321 | 325 | | |
322 | 326 | | |
323 | | - | |
| 327 | + | |
324 | 328 | | |
325 | 329 | | |
326 | | - | |
327 | 330 | | |
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
331 | 337 | | |
332 | 338 | | |
333 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
627 | 627 | | |
628 | 628 | | |
629 | 629 | | |
| 630 | + | |
| 631 | + | |
630 | 632 | | |
631 | 633 | | |
632 | 634 | | |
| |||
697 | 699 | | |
698 | 700 | | |
699 | 701 | | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
700 | 705 | | |
701 | 706 | | |
702 | | - | |
| 707 | + | |
| 708 | + | |
703 | 709 | | |
704 | 710 | | |
705 | 711 | | |
| |||
716 | 722 | | |
717 | 723 | | |
718 | 724 | | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
719 | 728 | | |
720 | 729 | | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
721 | 733 | | |
722 | 734 | | |
723 | 735 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
163 | 166 | | |
164 | 167 | | |
165 | 168 | | |
| |||
172 | 175 | | |
173 | 176 | | |
174 | 177 | | |
175 | | - | |
| 178 | + | |
176 | 179 | | |
177 | 180 | | |
178 | 181 | | |
| |||
181 | 184 | | |
182 | 185 | | |
183 | 186 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
188 | 196 | | |
189 | 197 | | |
190 | | - | |
| 198 | + | |
191 | 199 | | |
192 | 200 | | |
193 | 201 | | |
| |||
230 | 238 | | |
231 | 239 | | |
232 | 240 | | |
| 241 | + | |
| 242 | + | |
233 | 243 | | |
234 | 244 | | |
235 | | - | |
| 245 | + | |
| 246 | + | |
236 | 247 | | |
237 | 248 | | |
238 | 249 | | |
| |||
247 | 258 | | |
248 | 259 | | |
249 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
250 | 264 | | |
251 | 265 | | |
252 | 266 | | |
| |||
620 | 634 | | |
621 | 635 | | |
622 | 636 | | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
630 | 647 | | |
631 | 648 | | |
632 | 649 | | |
| |||
639 | 656 | | |
640 | 657 | | |
641 | 658 | | |
642 | | - | |
| 659 | + | |
643 | 660 | | |
644 | 661 | | |
645 | 662 | | |
| |||
648 | 665 | | |
649 | 666 | | |
650 | 667 | | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | 668 | | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
655 | 677 | | |
656 | 678 | | |
657 | | - | |
| 679 | + | |
658 | 680 | | |
659 | 681 | | |
660 | 682 | | |
| |||
705 | 727 | | |
706 | 728 | | |
707 | 729 | | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
708 | 733 | | |
709 | 734 | | |
710 | 735 | | |
711 | 736 | | |
712 | 737 | | |
713 | 738 | | |
714 | 739 | | |
715 | | - | |
| 740 | + | |
| 741 | + | |
716 | 742 | | |
717 | 743 | | |
718 | 744 | | |
| |||
727 | 753 | | |
728 | 754 | | |
729 | 755 | | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
730 | 759 | | |
731 | 760 | | |
732 | 761 | | |
| |||
0 commit comments