List system views through thread list - #161
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds new “topic view” commands to the HEY CLI for listing system mailbox topics (Sent, Spam, Trash), along with tests and documentation updates.
Changes:
- Introduce
hey sent,hey spam, andhey trashedcommands with paging and styled/JSON output support. - Add unit + smoke tests covering JSON/styled output and invalid paging.
- Update docs/help/coverage/surface metadata to include the new commands.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/smoke/topic_views_test.go | Smoke tests for the new topic view commands and paging. |
| skills/hey/SKILL.md | Adds triggers + usage docs for hey sent/spam/trashed and paging. |
| internal/cmd/topic_views_test.go | Unit tests around HTTP request shape, output formats, empty results, and invalid page handling. |
| internal/cmd/topic_views.go | Implements the new commands and shared rendering/summary logic. |
| internal/cmd/root.go | Registers the new commands in the root CLI. |
| internal/cmd/help.go | Adds commands to curated help categories and examples. |
| README.md | Documents new commands in the quick-start examples. |
| API-COVERAGE.md | Marks the new endpoints as covered. |
| .surface | Adds the new commands/flags to surfaced CLI list. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Suppressed comments (4)
skills/hey/SKILL.md:92
- The new table/flow entries use inconsistent capitalization and phrasing (e.g., “List Spam” vs “List sent email”), which makes the docs look uneven and slightly harder to scan. Consider standardizing to sentence case and consistent nouns (e.g., “List sent topics”, “List spam topics”, “List trash topics”).
| List sent email | `hey sent --json` |
| List Spam | `hey spam --json` |
| List Trash | `hey trashed --json` |
skills/hey/SKILL.md:130
- The new table/flow entries use inconsistent capitalization and phrasing (e.g., “List Spam” vs “List sent email”), which makes the docs look uneven and slightly harder to scan. Consider standardizing to sentence case and consistent nouns (e.g., “List sent topics”, “List spam topics”, “List trash topics”).
├── List sent email? → hey sent --json
├── List Spam? → hey spam --json
├── List Trash? → hey trashed --json
tests/smoke/topic_views_test.go:24
- This smoke test doesn’t assert anything about the result (it discards the response), so it only verifies that the command doesn’t error. To better cover pagination behavior, assert at least that the response is OK (and ideally that it returns a list of topics / a non-empty summary) after requesting
--page 2.
func TestTopicViewPage(t *testing.T) {
_ = heyJSON(t, "sent", "--page", "2")
}
internal/cmd/topic_views_test.go:63
- The helper decides whether to decode an
output.Responseby searching the rawargsstring for--json, which is brittle (e.g., future tests combining--jsonwith output-modifying flags like--quiet,--ids-only,--count, etc., could produce non-envelope output and make this helper fail). Consider makingrunTopicViewtake an explicitexpectEnvelope bool(or similar), or decide based on the actual selected output format instead of substring matching.
if strings.Contains(strings.Join(args, " "), "--json") && buf.Len() > 0 {
if err := json.Unmarshal(buf.Bytes(), &resp); err != nil {
t.Fatalf("decode response: %v\n%s", err, buf.String())
}
}
395e58d to
25de3f4
Compare
|
I also picked up the later review notes in this refresh. The docs now use consistent sentence case, the smoke checks assert a summary and array-shaped data, and the read-only Spam command is now |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (1)
internal/cmd/topic_views.go:136
- The styled path writes API-supplied subjects and sender names directly to the terminal. These are untrusted email fields, so embedded control/escape characters can manipulate terminal output; sanitize both values with
terminalSafeTextbefore truncating/rendering them.
truncate(topic.Name, 48),
topicViewSender(topic),
|
This fills a real gap. On
Keep the tests and the SKILL.md section; they carry over. Once this lands, |
7398727 to
2bfd149
Compare
|
Rebased onto current The command carries explicit Validation: |
What changed
Replaces the four old top-level system-view commands with one read-only listing:
hey thread list --in senthey thread list --in spamhey thread list --in trashhey thread list --in everythingThe command supports
--limit, opaque--page,--all, and the standard listing output flags. Every JSON row carriestopic_idexplicitly; bothidandtopic_idare thread IDs forhey thread read, not box item IDs for organization actions. Styled and Markdown output sanitize server-provided titles, subjects, and sender names.The typed topic-list helpers in SDK v0.29.0 discard the geared-pagination
Linkheader. This command therefore reads the same four fixed routes through the SDK document client, decodesgenerated.TopicListResponse, and retains only the opaque next-page cursor. Authentication, account scoping, caching, response limits, and hooks remain in the SDK.Validation
GOWORK=off TMPDIR=/tmp mise exec -- make check