Skip to content

feat: Gmail read and Drive comments commands#6

Merged
shahariaazam merged 1 commit intomainfrom
improvement
Nov 6, 2025
Merged

feat: Gmail read and Drive comments commands#6
shahariaazam merged 1 commit intomainfrom
improvement

Conversation

@shahariaazam
Copy link
Copy Markdown
Member

Summary

Adds two powerful new commands for reading email content and listing Google Drive comments.

New Features

1. Gmail Read Command

gscli gmail read <message-id>

Features:

  • Read full email content by message ID
  • Shows subject, from, to, date, and full body
  • Supports both plain text and HTML emails
  • Extracts body from multipart messages
  • Beautiful formatted output
  • Supports --account flag for multi-account

Example Output:

📧 Email Message

Subject: Project Update - Q4 2025
From: boss@example.com
To: me@gmail.com
Date: Nov 6, 2025, 10:30 AM
ID: 19a54d752ef22a03
Thread ID: 19a54d752ef22a03

Body:
────────────────────────────────────────────────────────────────────────────────
Hi team,

Here's the project update...

[Full email body displayed here]
────────────────────────────────────────────────────────────────────────────────

2. Google Drive Comments Command

gscli drive comments <file-id>
gscli drive comments <file-id> --include-resolved

Features:

  • List comments on Google Drive files (Docs, Sheets, Slides)
  • Shows unresolved comments by default
  • --include-resolved flag to show all comments
  • Displays author, content, creation date
  • Shows comment replies
  • Shows quoted content from document
  • Status badges: [OPEN] or [RESOLVED]
  • Supports --account flag for multi-account

Example Output:

💬 Comments on: Project Plan.docx
Found 3 comment(s)

1. John Doe [OPEN]
   Created: Nov 5, 2025, 02:30 PM
   Quoted: "We need to finalize the budget by end of week"
   Can we get this done by Friday?
   
   Replies (2):
     • Jane Smith: Yes, working on it now
     • John Doe: Thanks!

2. Alice Brown [RESOLVED]
   Created: Nov 4, 2025, 10:00 AM
   The timeline looks good

Use Cases

For AI Agents

  • Read full email content for better context understanding
  • Extract email bodies for summarization
  • Track document feedback and comments
  • Filter active discussions vs resolved issues

For Developers

  • Quick email reading from terminal
  • Review document comments without opening browser
  • Script-friendly comment tracking
  • Multi-account support for work/personal separation

Usage Examples

# Get message ID from list command
gscli gmail list --limit 5
# Copy the message ID

# Read the full email
gscli gmail read 19a54d752ef22a03

# List document comments
gscli drive comments 1abc...xyz

# Include resolved comments
gscli drive comments 1abc...xyz --include-resolved

# Use specific account
gscli gmail read 19a54d752ef22a03 --account work@company.com
gscli drive comments 1abc...xyz --account personal@gmail.com

Technical Details

Gmail Read

  • Uses Gmail API messages.get with format=full
  • Base64 decodes message body
  • Handles multipart MIME messages
  • Prefers plain text over HTML
  • Falls back to snippet if body not available

Drive Comments

  • Uses Drive API comments.list
  • Filters resolved comments by default
  • Includes comment replies in response
  • Shows quoted file content
  • Supports all Google Workspace file types

Testing

  • ✅ TypeScript compilation passes
  • ✅ Help commands updated
  • ✅ --account flag works on both commands
  • ✅ README and CHANGELOG updated

**Gmail Read Command:**
- New command: gscli gmail read <message-id>
- Read full email content including body
- Shows: subject, from, to, date, full body
- Supports plain text and HTML emails
- Extracts body from multipart messages
- Supports --account flag

**Google Drive Comments Command:**
- New command: gscli drive comments <file-id>
- List comments on Google Drive files
- Shows unresolved comments by default
- --include-resolved flag to show all comments
- Displays author, content, creation date
- Shows comment replies
- Shows quoted content from document
- Supports --account flag

**Use Cases:**
- AI agents can read full email content for context
- View and track document feedback/comments
- Filter resolved vs unresolved comments
- Multi-account support for both commands
@shahariaazam shahariaazam merged commit b035055 into main Nov 6, 2025
1 check passed
@shahariaazam shahariaazam deleted the improvement branch November 6, 2025 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant