Manage reusable email snippets from the CLI and TUI - #269
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds reusable email snippet management to the CLI and insertion through a TUI compose picker.
Changes:
- Adds snippet list/create/update/delete commands and output formats.
- Adds Ctrl+T snippet insertion for compose, reply, and forward forms.
- Adds documentation, command-surface updates, and extensive tests.
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.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.surface |
Records the new command surface. |
README.md |
Documents snippet commands and TUI usage. |
internal/cmd/help.go |
Adds snippets to curated help. |
internal/cmd/help_test.go |
Updates help expectations. |
internal/cmd/root.go |
Registers snippet commands. |
internal/cmd/snippet.go |
Implements snippet CLI operations. |
internal/cmd/snippet_test.go |
Tests CLI behavior and formats. |
internal/tui/compose.go |
Integrates the picker into compose forms. |
internal/tui/compose_test.go |
Extends the compose test server. |
internal/tui/mail.go |
Handles snippet-loading responses. |
internal/tui/snippets.go |
Implements picker state and rendering. |
internal/tui/snippets_test.go |
Tests picker behavior and safety. |
tests/smoke/snippets_test.go |
Covers the real-server lifecycle. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Give people and coding agents a complete way to manage HEY’s reusable email snippets from the CLI and deliberately insert them while composing in the TUI. The picker mirrors HEY web: it never chooses a default, and the TUI inserts the selected snippet’s plain text at the current body cursor without replacing the draft.
Review readiness: ✅ Yes
Risk: 🟡 Medium — this adds a child picker to the shared new-message, reply, and forward form while preserving account-bound send behavior and draft state.
Decision: Confirm that Ctrl+T and plain-text insertion are the right terminal equivalents of HEY web’s rich-text picker.
✅ Change — snippets can be managed by scripts and explicitly inserted while composing
Before
After
The TUI keeps the picker inside the compose form, so opening, filtering, cancellation, failed loading, and repeated insertion retain the original draft and cursor state. Reply and forward reads use the same account-bound SDK client as their eventual send.
✅ Evidence — CLI lifecycle and TUI insertion pass against the real Haystack development server
The full strict smoke suite was also exercised. The new snippet tests passed; unrelated fixture/environment gates failed for attachment sending, cookie-backed
auth token, absence of a seen Imbox posting, and dev-build version checks.✅ Scope — snippet management and deliberate compose insertion only
Included:
hey snippetswith styled, JSON, quiet, jq, Markdown, IDs, and count output.hey snippet create,update, anddeleteusinghey-sdkv0.12.0.Deferred intentionally:
➖ Delivery — no migration, configuration, dependency, or deployment ordering
The released SDK already supplies every snippet operation. There are no schema changes, feature flags, new runtime dependencies, backfills, or data migrations. Existing snippets appear immediately. Failures remain inline in the picker and leave the draft intact; rollback is a normal revert.
Please confirm:
contentas plain text is the honest behavior for the existing terminal textarea, while CLI JSON preservescontent_htmlfor consumers that need HEY’s rich representation.Compatibility: no snippet is selected automatically, existing compose shortcuts and sends remain unchanged, and existing snippets require no migration.
✅ Review path — command contract, picker lifecycle, then proof and public surface
internal/cmd/snippet.go— CLI hierarchy, validation, output, and mutation contract.internal/tui/snippets.goandinternal/tui/compose.go— child picker state, cursor insertion, loading, and account-bound reads.internal/cmd/snippet_test.go,internal/tui/snippets_test.go, andtests/smoke/snippets_test.go— behavioral and real-server proof.README.md,internal/cmd/help.go, and.surface— documentation and discoverability.Origin and supporting links: Basecamp card · separate clips card · HEY SDK v0.12.0