Skip to content

Read comment content from stdin when using dash#467

Open
robzolkos wants to merge 2 commits into
mainfrom
fix/comments-stdin-content
Open

Read comment content from stdin when using dash#467
robzolkos wants to merge 2 commits into
mainfrom
fix/comments-stdin-content

Conversation

@robzolkos
Copy link
Copy Markdown
Collaborator

@robzolkos robzolkos commented May 14, 2026

Fix comment creation and updates so using - reads the comment body from stdin instead of posting a literal dash. This supports the heredoc workflow reported from the Agent Accessibility card and prevents silent wrong-comment posts.

Related: #414 covers implicit piped stdin when comment creation omits positional content; this PR covers the explicit - stdin convention and also applies it to comment updates. The two changes complement each other but will need a small reconciliation if both land.

Ref: https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9890985489

Copilot AI review requested due to automatic review settings May 14, 2026 12:45
@github-actions github-actions Bot added commands CLI command implementations tests Tests (unit and e2e) labels May 14, 2026
@github-actions github-actions Bot added the bug Something isn't working label May 14, 2026
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

Adds support for reading comment content from stdin when - is passed as the content argument to basecamp comment and basecamp comments update, enabling heredoc/pipe workflows and preventing accidental posts of a literal dash.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Changes:

  • Introduces helper contentArgOrStdin that reads from cmd.InOrStdin() when args is a single -.
  • Wires the helper into both the create (basecamp comment) and update (basecamp comments update) commands; updates help text with stdin examples.
  • Adds tests verifying stdin content is sent in the request body (not a literal dash) for both commands.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/commands/comment.go Adds contentArgOrStdin helper, uses it in create/update RunE, and extends help examples.
internal/commands/comment_test.go Adds mock transport + tests asserting stdin content is sent for create and update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/commands/comment.go">

<violation number="1" location="internal/commands/comment.go:327">
P2: `create` reads stdin for `-` before enforcing the `--edit` conflict, so `--edit` + `-` can hang waiting on stdin instead of failing fast.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread internal/commands/comment.go
@robzolkos
Copy link
Copy Markdown
Collaborator Author

Fixed — cubic found that --edit + - could read stdin before failing; the create command now rejects positional content with --edit before stdin handling.

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 tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants