feat(gmail): add +read helper for clean text extraction#502
feat(gmail): add +read helper for clean text extraction#502dumko2001 wants to merge 12 commits intogoogleworkspace:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 7932abf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Gmail CLI with a new Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new +read helper for the gmail command, which is a useful addition for extracting email content. The implementation looks good. However, the PR also includes a significant and unexplained downgrade of the ratatui dependency from version 0.30.0 to 0.29.0. This change seems out of scope and should be addressed, either by providing a clear justification or by moving it to a separate pull request.
|
Thanks for the catch! The ratatui downgrade was accidental (likely a rebase/merge artifact). I've restored it to 0.30.0 to match main. I also fixed an unused import warning in setup_tui.rs while I was at it. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a +read helper for the Gmail CLI, which is a useful addition for extracting email content. The implementation is mostly solid, but I've found a couple of areas for improvement. There's a redundant CLI flag (--body-only) that could be removed to simplify the user interface. Additionally, the logic for handling HTML body content could be made more robust.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a +read helper for the Gmail service, which is a useful addition for extracting email content. The implementation is clean and follows existing patterns. However, a high-severity robustness issue has been identified where the use of println! can lead to a panic if the output pipe is closed. A fix has been recommended to handle I/O errors gracefully, which will improve the robustness of the new helper.
c051c0c to
554e7a8
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new +read helper for the Gmail command, which simplifies extracting email body content in either plain text or HTML format, with an option for JSON output. It also adds a global --draft-only flag as a safety measure to prevent accidental email sending. The implementation is clean and the new features are well-tested. I've identified one high-severity issue related to whitespace handling in the HTML body selection logic that could lead to incorrect output. Otherwise, the code quality is high.
|
/gemini review |
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request introduces a new +read helper for Gmail, enabling clean text extraction from messages, which is particularly useful for AI agents. The changes include updating Cargo.toml with new dependencies and features for clap, adding the +read subcommand and its handler, and modifying the resolve_method_from_matches function to return the method path. The draft-only mode logic has also been added to prevent accidental email sending. Overall, the new functionality is well-implemented and tested.
There was a problem hiding this comment.
Code Review
The pull request introduces a new +read helper for Gmail, allowing for clean text extraction from email content, which is particularly useful for AI agents. The changes include adding a new subcommand, updating dependencies, and implementing the core logic for message parsing and output. A new draft-only mode has also been added to prevent accidental email sending. Overall, the new feature is well-implemented and includes appropriate error handling and argument parsing.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a +read helper for the Gmail service, which allows extracting and displaying the content of an email. The implementation is well-structured and follows existing patterns. However, I've identified a security concern: the helper prints raw email content (headers and body) to the terminal, which can lead to terminal injection attacks if the email contains malicious escape sequences. My review includes a high-severity comment with a suggestion to sanitize the output before printing to mitigate this risk.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a +read helper for the Gmail command, which is a valuable addition for extracting email content. The implementation is solid, including security considerations like terminal output sanitization. My main feedback is to refactor the error handling in the new read.rs file to be more concise and maintainable by leveraging anyhow::Context, which will improve the overall code quality.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a +read helper for the Gmail command, which is a great addition for easily extracting and consuming email content. The implementation is clean and considers security aspects like terminal injection by sanitizing output. I've found one high-severity issue related to how headers are displayed, where newlines are not stripped, potentially allowing for output spoofing. My review includes a code suggestion to address this. Otherwise, the changes are solid and well-implemented.
|
/gemini review |
Description
Add a Gmail
+readhelper to abstract MIME tree walking and base64 decoding for readable text extraction. This is specifically designed for AI agents to easily consume email content without handling raw MIME structures.Dry Run Output:
{ "thread_id": "thread-123", "message_id_header": "<123@example.com>", "references": "", "from": "sender@example.com", "reply_to": "", "to": "you@example.com", "cc": "", "subject": "Original subject", "date": "Thu, 1 Jan 2026 00:00:00 +0000", "body_text": "Original message body", "body_html": "<p>Original message body</p>" }Checklist:
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings.pnpx changeset) to document my changes.