Read comment content from stdin when using dash#467
Conversation
There was a problem hiding this comment.
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
contentArgOrStdinthat reads fromcmd.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.
There was a problem hiding this comment.
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.
|
Fixed — cubic found that |
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