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 |
286fed0 to
56acd0c
Compare
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Tip: cubic used a learning from your PR history. Let your coding agent read cubic learnings directly with the cubic MCP.
Re-trigger cubic
b16c738 to
eb04433
Compare
eb04433 to
8eba978
Compare
8eba978 to
d44ad1d
Compare
Summary
Fix comment creation and updates so using
-reads the comment body from stdin instead of posting a literal dash. This supports heredoc/pipe workflows and prevents silent wrong-comment posts.Relationship to #414
#414 is merged. This PR is now rebased onto
mainand complements #414: #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.Live verification
Tested against the Rob Zolkos account in the Verdant Coffee Roasters project,
Fusilli todolist, using a locally built branch with #414 and this PR.
printf ... | basecamp comment <todo_id> -created a comment with the piped content, not a literal-.printf ... | basecamp comments update <comment_id> -updated the comment with the piped content.printf ... | basecamp comments create <todo_id>still works for Add stdin support for comment content #414's implicit stdin path.printf ... | basecamp comment <todo_id> - --editfails fast withcannot combine --edit and positional content.basecamp comments update <comment_id> -fails with<content> requiredand does not send an API update.Ref: https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9890985489