feat(email): add attachment support for send and reply#59
Conversation
Add --attach flag (repeatable) to email send and reply commands. The CLI reads local files, detects MIME type from extension, and base64-encodes content before passing to the MCP tool. Inbox and search results now display attachment metadata (filename, type, size) inline. https://claude.ai/code/session_013ZfRLDGZ9mawSATTJ8ToQg
There was a problem hiding this comment.
AI Code Review
Recommendation: APPROVE (comment only — approval blocked by repo policy)
Summary
Adds a repeatable --attach flag to email send and email reply commands, reads local files with MIME-type detection and base64 encoding, and surfaces attachment metadata in inbox/search listings. Documentation in SKILL.md is thorough and accurate.
Actionable Feedback (2 items)
- email.ts:loadAttachments - No pre-read file size check. A large file will be fully loaded into memory before the server rejects it. Consider fs.statSync(resolved).size and fail fast if it exceeds the documented 7.5 MB raw limit.
- email.ts:checkInbox and searchEmails - The attachment display block is identical in both functions. Extracting it to a small helper would reduce duplication.
Code Quality
Clean implementation. loadAttachments correctly uses path.resolve and path.basename. The static MIME map covers common types with a sensible application/octet-stream fallback. getAllArgValues was already present in index.ts for similar repeated flags, so the wiring is consistent.
Security
No concerns. path.resolve normalises the user-supplied path before reading, preventing path-traversal issues. File content is base64-encoded before leaving the process.
Positive Notes
- Error handling on readFileSync is correct: catches, formats the message, and exits with code 1.
- SKILL.md documentation is complete: usage examples, MCP tool parameter table, and the 10 MB size-limit caveat are all present.
- The attachment count indicator in inbox/search gives a nice at-a-glance signal without being noisy.
Add --attach flag (repeatable) to email send and reply commands. The CLI
reads local files, detects MIME type from extension, and base64-encodes
content before passing to the MCP tool. Inbox and search results now
display attachment metadata (filename, type, size) inline.
https://claude.ai/code/session_013ZfRLDGZ9mawSATTJ8ToQg