savethis
v0.3.1
Published
CLI tool to download and organize Gmail attachments with AI document summarization
Maintainers
Readme
Saveth.is CLI
Download, organize, and analyze Gmail attachments with AI document summarization.
Website: https://saveth.is
Documentation: https://saveth.is/cli
Development
# Install dependencies
bun install
# Run directly
bun src/index.ts accounts add
bun src/index.ts accounts
bun src/index.ts gmail export --query "has:attachment"
bun src/index.ts gmail ask "What documents do I have about project X?"
bun src/index.ts document summarize contract.pdf
# Build
bun run buildQuick Start
# Install
npm install -g savethis
# Set your Google Generative AI API key (for AI analysis)
savethis config:set googleApiKey your-api-key-here
# Authenticate with your first Gmail account
savethis accounts add
# List all authenticated accounts
savethis accounts
# Download, index, and analyze attachments in one step
savethis gmail export --query "has:attachment" --output ./my-docs
# Generate Gmail search query with AI
savethis gmail query
# Chat with your email data using AI
savethis gmail ask "What documents did I receive last week?"
# Summarize any document with AI
savethis document summarize contract.pdf
# Export database to markdown
savethis export markdown --output export.mdFeatures
- Download and search Gmail attachments across accounts
- Extract text from any file format (PDF, Office, images)
- Skip duplicates and only process new content
- Full-text search of documents
- AI chat interface for natural language queries
- Document summarization with AI
- Gmail query generation with AI
- Export database to markdown for AI analysis
- Persistent settings and authentication
Supported File Formats
- Documents: PDF, DOCX, TXT, RTF, Markdown
- Images: JPG, PNG, WebP, GIF (with automatic OCR)
- Spreadsheets: XLSX, CSV, TSV
- Presentations: PPTX, PPT
- Code: Any text-based code files
Gmail Commands
Generate Search Query
# Generate Gmail search query with AI
savethis gmail query
# Example: "important emails with attachments from last week"
# Generates: "is:important has:attachment newer_than:2w older_than:1w"Learn more about the AI-powered Gmail Query Generator.
Download and Index
# Download from all accounts with default settings
savethis gmail export
# Download with a specific query
savethis gmail export --query "has:attachment from:[email protected]"
# Download to a specific folder
savethis gmail export --output ./my-documents
# Download from a specific account
savethis gmail export --account [email protected]AI Chat Interface
# Start an AI chat session about your emails and documents
savethis gmail ask
# Ask a specific question directly
savethis gmail ask "What PDFs did I receive from John last month?"
savethis gmail ask "Find my tax documents from 2023"
savethis gmail ask "Summarize my medical expenses"
savethis gmail ask "What contracts expire this year?"
savethis gmail ask "How much did I spend on software?"
# Specify a folder to use
savethis gmail ask --folder ./my-documents "How much did I spend on food last month?"Document Summarization
# Summarize any document with AI
savethis document summarize contract.pdf
# See OCR results and summary
savethis document summarize receipt.jpg --show-extraction
# Control extraction display
savethis document summarize report.docx --max-extraction 100
# Use different AI models
savethis document summarize code.js --model gemini-proLearn more about AI-Powered Document Summarization.
Export Commands
# Export database to markdown
savethis export markdownThe markdown export creates a single file containing all emails and attachments, perfect for uploading to AI tools like Google AI Studio.
Configuration
The CLI uses a configuration file stored in ~/.savethis/config.json. You can manage your configuration with these commands:
# View current configuration
savethis config
# Set a configuration value
savethis config:set googleApiKey your-api-key-here
savethis config:set outputDir ~/Downloads/email-attachments
savethis config:set model gemini-1.5-flash
# Get a specific configuration value
savethis config:get googleApiKeyAvailable configuration options:
googleApiKey: Your Google Generative AI API keyoutputDir: Default directory for saving attachmentsmodel: Default AI model for analysis
Account Management
# List all authenticated accounts
savethis accounts
# Add a new Gmail account
savethis accounts add
# Remove an account
savethis accounts remove [email protected]Privacy & Security
- All data stays on your computer
- Uses your own API keys
- No cloud storage of your documents
- Open source and transparent
Troubleshooting
If you see "Gmail API has not been used in project..." error, visit the URL in the error message to enable the Gmail API.
For issues with the AI chat interface, ensure you have set a valid Google API key using savethis config:set googleApiKey.
