Add hey thread comment for private thread notes

JE
1mo ago
+213-9

The gap

hey reply mails a reply. There is no CLI for the other thing a thread holds: a private internal note. Those notes show up as kind: "comment" in hey thread read, but you could only add them in the web app.

The comments write is not in hey-sdk OpenAPI. Empty or wrong form fields can create a blank comment, so this has to post a specific field.

The change

hey thread comment <thread-id> -m "..." posts a private internal note, not a mailed reply.

  • POST /topics/{topic_id}/comments?account_id={account_id} via Client.PostForm (same redirect-capturing form path as collections, snippets, and publications)
  • Body: comment[content]=<plain text> — sent exactly as typed, not converted from Markdown
  • Success is 302 Location: /imbox; the redirect is not followed
  • Account ID comes from Topics().Get so All Accounts still posts against the thread's mail account
  • After a successful post, hey thread read shows the note as kind: "comment"

--message/-m is required and cannot be blank.

Tests

internal/cmd/thread_comment_test.go checks the POST path and query, form field, Accept: */*, Content-Type: application/x-www-form-urlencoded, that Markdown-looking text is sent verbatim, that missing/empty -m and a bad thread ID make no request, and that /imbox is not followed.

TMPDIR=/tmp/t GOWORK=off make check is green. (Without the short TMPDIR, three pre-existing TUI unix-socket tests fail to bind on this machine; they are unrelated to this change.)


Summary by cubic

Adds hey thread comment <thread-id> -m "..." so private internal thread notes can be posted from the CLI. Previously these notes could be read via hey thread read but only created in the web app.

New Features

  • Posts to /topics/{id}/comments through PostForm since the comments write is not in the SDK OpenAPI.
  • Sends the message exactly as typed rather than converting Markdown, unlike other -m flags.
  • Requires non-blank -m; treats the 302 to /imbox as success and does not follow it.