xuanzhu 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +424 -0
- package/bin/xzh.js +3 -0
- package/dist/cli.js +5602 -0
- package/dist/cli.js.map +7 -0
- package/dist/skills/aws/SKILL.md +70 -0
- package/dist/skills/datadog/SKILL.md +261 -0
- package/dist/skills/elasticsearch/SKILL.md +88 -0
- package/dist/skills/elasticsearch/install.sh +91 -0
- package/dist/skills/email/SKILL.md +63 -0
- package/dist/skills/github/SKILL.md +69 -0
- package/dist/skills/gitlab/SKILL.md +68 -0
- package/dist/skills/gitlab/install.sh +74 -0
- package/dist/skills/gmail/README.md +139 -0
- package/dist/skills/gmail/SECURITY.md +552 -0
- package/dist/skills/gmail/SETUP.md +258 -0
- package/dist/skills/gmail/activate-gmail-cli.sh +15 -0
- package/dist/skills/gmail/generate-hashes.sh +82 -0
- package/dist/skills/gmail/gmail-cli-secure.py +599 -0
- package/dist/skills/gmail/install.sh +313 -0
- package/dist/skills/gmail/requirements.txt +38 -0
- package/dist/skills/gmail/skill.md +225 -0
- package/dist/skills/jira/SKILL.md +68 -0
- package/dist/skills/kubernetes/SKILL.md +70 -0
- package/dist/skills/linear/SKILL.md +48 -0
- package/dist/skills/mongodb/SKILL.md +53 -0
- package/dist/skills/mysql/SKILL.md +71 -0
- package/dist/skills/mysql/install.sh +74 -0
- package/dist/skills/officecli/SKILL.md +429 -0
- package/dist/skills/playwright/SKILL.md +171 -0
- package/dist/skills/postgres/SKILL.md +44 -0
- package/dist/skills/postgres/install.sh +73 -0
- package/dist/skills/redis/SKILL.md +58 -0
- package/dist/skills/redis/install.sh +39 -0
- package/dist/skills/sentry/SKILL.md +59 -0
- package/dist/skills/telegram/SKILL.md +151 -0
- package/package.json +46 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Gmail CLI Installation Script - SECURE VERSION
|
|
3
|
+
# This script implements security best practices:
|
|
4
|
+
# - Virtual environment isolation
|
|
5
|
+
# - Pinned dependencies with hash verification
|
|
6
|
+
# - Secure file permissions
|
|
7
|
+
# - Integrity checking
|
|
8
|
+
|
|
9
|
+
set -euo pipefail # Exit on error, undefined variables, pipe failures
|
|
10
|
+
|
|
11
|
+
echo "🔒 Gmail CLI Secure Installation"
|
|
12
|
+
echo "================================"
|
|
13
|
+
echo ""
|
|
14
|
+
|
|
15
|
+
# Get script directory
|
|
16
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
18
|
+
VENV_DIR="$PROJECT_ROOT/.venv-gmail-cli"
|
|
19
|
+
BIN_DIR="$PROJECT_ROOT/.codebuddy/bin"
|
|
20
|
+
GMAIL_CLI_PATH="$BIN_DIR/gmail-cli"
|
|
21
|
+
REQUIREMENTS_LOCKED="$SCRIPT_DIR/requirements-locked.txt"
|
|
22
|
+
REQUIREMENTS_FILE="$SCRIPT_DIR/requirements.txt"
|
|
23
|
+
|
|
24
|
+
# Use locked requirements if available (has hashes for verification)
|
|
25
|
+
if [ -f "$REQUIREMENTS_LOCKED" ]; then
|
|
26
|
+
REQUIREMENTS_FILE="$REQUIREMENTS_LOCKED"
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Colors for output
|
|
30
|
+
RED='\033[0;31m'
|
|
31
|
+
GREEN='\033[0;32m'
|
|
32
|
+
YELLOW='\033[1;33m'
|
|
33
|
+
NC='\033[0m' # No Color
|
|
34
|
+
|
|
35
|
+
# Logging functions
|
|
36
|
+
log_info() { echo -e "${GREEN}✓${NC} $1"; }
|
|
37
|
+
log_warn() { echo -e "${YELLOW}⚠️${NC} $1"; }
|
|
38
|
+
log_error() { echo -e "${RED}❌${NC} $1"; }
|
|
39
|
+
|
|
40
|
+
# Check if Python 3.7+ is installed
|
|
41
|
+
echo "🔍 Checking prerequisites..."
|
|
42
|
+
if ! command -v python3 &> /dev/null; then
|
|
43
|
+
log_error "Python 3 is not installed."
|
|
44
|
+
echo "Please install Python 3.7 or higher first."
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
|
|
49
|
+
PYTHON_MAJOR=$(python3 -c 'import sys; print(sys.version_info[0])')
|
|
50
|
+
PYTHON_MINOR=$(python3 -c 'import sys; print(sys.version_info[1])')
|
|
51
|
+
|
|
52
|
+
if [ "$PYTHON_MAJOR" -lt 3 ] || { [ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -lt 7 ]; }; then
|
|
53
|
+
log_error "Python 3.7+ required. Found: $PYTHON_VERSION"
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
log_info "Python $PYTHON_VERSION found"
|
|
58
|
+
|
|
59
|
+
# Check if pip is installed
|
|
60
|
+
if ! python3 -m pip --version &> /dev/null; then
|
|
61
|
+
log_error "pip is not installed."
|
|
62
|
+
echo "Please install pip: python3 -m ensurepip --upgrade"
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
log_info "pip found: $(python3 -m pip --version)"
|
|
67
|
+
echo ""
|
|
68
|
+
|
|
69
|
+
# Create virtual environment for isolation
|
|
70
|
+
echo "📦 Setting up isolated Python environment..."
|
|
71
|
+
if [ -d "$VENV_DIR" ]; then
|
|
72
|
+
log_warn "Virtual environment already exists at: $VENV_DIR"
|
|
73
|
+
read -p "Remove and recreate? (y/N): " -n 1 -r
|
|
74
|
+
echo
|
|
75
|
+
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
76
|
+
rm -rf "$VENV_DIR"
|
|
77
|
+
else
|
|
78
|
+
echo "Using existing virtual environment"
|
|
79
|
+
fi
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
if [ ! -d "$VENV_DIR" ]; then
|
|
83
|
+
python3 -m venv "$VENV_DIR"
|
|
84
|
+
log_info "Virtual environment created"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# Activate virtual environment
|
|
88
|
+
source "$VENV_DIR/bin/activate"
|
|
89
|
+
log_info "Virtual environment activated"
|
|
90
|
+
echo ""
|
|
91
|
+
|
|
92
|
+
# Upgrade pip, setuptools, wheel
|
|
93
|
+
echo "🔄 Upgrading pip and setuptools..."
|
|
94
|
+
python -m pip install --upgrade pip setuptools wheel --quiet
|
|
95
|
+
log_info "pip upgraded to: $(pip --version)"
|
|
96
|
+
echo ""
|
|
97
|
+
|
|
98
|
+
# Install dependencies with hash verification
|
|
99
|
+
echo "🔐 Installing dependencies with integrity verification..."
|
|
100
|
+
|
|
101
|
+
# Function to try hash-verified installation
|
|
102
|
+
install_with_hashes() {
|
|
103
|
+
local req_file="$1"
|
|
104
|
+
# Check if requirements file has actual hash entries (not example placeholders)
|
|
105
|
+
if grep -q "^[^#].*--hash=sha256:[a-f0-9]\{64\}" "$req_file" 2>/dev/null; then
|
|
106
|
+
log_info "Found hash entries in requirements.txt, attempting verified installation"
|
|
107
|
+
if pip install --require-hashes -r "$req_file" 2>/dev/null; then
|
|
108
|
+
return 0
|
|
109
|
+
else
|
|
110
|
+
log_warn "Hash verification failed. Hashes may be outdated."
|
|
111
|
+
return 1
|
|
112
|
+
fi
|
|
113
|
+
fi
|
|
114
|
+
return 1
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
# Function to install without hashes (fallback)
|
|
118
|
+
install_without_hashes() {
|
|
119
|
+
local req_file="$1"
|
|
120
|
+
log_warn "Installing without hash verification"
|
|
121
|
+
log_warn "For production, run: ./generate-hashes.sh to add integrity verification"
|
|
122
|
+
|
|
123
|
+
# Strip comments and hashes, then install
|
|
124
|
+
pip install -r <(grep -v "^#" "$req_file" | grep -v "^\s*$" | sed 's/ *\\$//' | sed 's/--hash=sha256:[a-f0-9]*//')
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if [ -f "$REQUIREMENTS_FILE" ]; then
|
|
128
|
+
log_info "Using requirements.txt from: $REQUIREMENTS_FILE"
|
|
129
|
+
|
|
130
|
+
# Try hash-verified installation first, fall back to unverified
|
|
131
|
+
if ! install_with_hashes "$REQUIREMENTS_FILE"; then
|
|
132
|
+
install_without_hashes "$REQUIREMENTS_FILE"
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
if [ $? -eq 0 ]; then
|
|
136
|
+
log_info "Dependencies installed successfully"
|
|
137
|
+
else
|
|
138
|
+
log_error "Failed to install dependencies"
|
|
139
|
+
exit 1
|
|
140
|
+
fi
|
|
141
|
+
else
|
|
142
|
+
log_warn "requirements.txt not found, installing packages directly"
|
|
143
|
+
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib cryptography
|
|
144
|
+
fi
|
|
145
|
+
echo ""
|
|
146
|
+
|
|
147
|
+
# Install security audit tool
|
|
148
|
+
echo "🛡️ Installing security tools..."
|
|
149
|
+
pip install pip-audit --quiet
|
|
150
|
+
log_info "pip-audit installed (use 'pip-audit' to check for vulnerabilities)"
|
|
151
|
+
echo ""
|
|
152
|
+
|
|
153
|
+
# Run security audit
|
|
154
|
+
echo "🔍 Running security audit on installed packages..."
|
|
155
|
+
if pip-audit --desc 2>&1 | grep -q "No known vulnerabilities found"; then
|
|
156
|
+
log_info "No known vulnerabilities found in dependencies"
|
|
157
|
+
else
|
|
158
|
+
log_warn "Security audit completed. Review output above for any vulnerabilities."
|
|
159
|
+
fi
|
|
160
|
+
echo ""
|
|
161
|
+
|
|
162
|
+
# Setup secure credential directory
|
|
163
|
+
echo "🔒 Setting up secure credential storage..."
|
|
164
|
+
GMAIL_CLI_DIR="$HOME/.gmail-cli"
|
|
165
|
+
|
|
166
|
+
if [ ! -d "$GMAIL_CLI_DIR" ]; then
|
|
167
|
+
mkdir -p "$GMAIL_CLI_DIR"
|
|
168
|
+
chmod 700 "$GMAIL_CLI_DIR"
|
|
169
|
+
log_info "Created secure directory: $GMAIL_CLI_DIR (permissions: 700)"
|
|
170
|
+
else
|
|
171
|
+
# Check and fix permissions on existing directory
|
|
172
|
+
CURRENT_PERMS=$(stat -c %a "$GMAIL_CLI_DIR" 2>/dev/null || stat -f %A "$GMAIL_CLI_DIR" 2>/dev/null)
|
|
173
|
+
if [ "$CURRENT_PERMS" != "700" ]; then
|
|
174
|
+
log_warn "Fixing insecure permissions on $GMAIL_CLI_DIR"
|
|
175
|
+
chmod 700 "$GMAIL_CLI_DIR"
|
|
176
|
+
log_info "Permissions updated to 700 (owner-only access)"
|
|
177
|
+
else
|
|
178
|
+
log_info "Credential directory already secured: $GMAIL_CLI_DIR"
|
|
179
|
+
fi
|
|
180
|
+
fi
|
|
181
|
+
|
|
182
|
+
# Check and fix permissions on sensitive files if they exist
|
|
183
|
+
for file in "credentials.json" "token.pickle"; do
|
|
184
|
+
FILEPATH="$GMAIL_CLI_DIR/$file"
|
|
185
|
+
if [ -f "$FILEPATH" ]; then
|
|
186
|
+
CURRENT_PERMS=$(stat -c %a "$FILEPATH" 2>/dev/null || stat -f %A "$FILEPATH" 2>/dev/null)
|
|
187
|
+
if [ "$CURRENT_PERMS" != "600" ]; then
|
|
188
|
+
log_warn "Fixing insecure permissions on $file"
|
|
189
|
+
chmod 600 "$FILEPATH"
|
|
190
|
+
log_info "Permissions updated to 600"
|
|
191
|
+
fi
|
|
192
|
+
fi
|
|
193
|
+
done
|
|
194
|
+
echo ""
|
|
195
|
+
|
|
196
|
+
# Create bin directory if it doesn't exist
|
|
197
|
+
echo "📂 Preparing binary directory..."
|
|
198
|
+
mkdir -p "$BIN_DIR"
|
|
199
|
+
log_info "Binary directory ready: $BIN_DIR"
|
|
200
|
+
echo ""
|
|
201
|
+
|
|
202
|
+
# Check if gmail-cli binary exists
|
|
203
|
+
echo "🔍 Checking for gmail-cli binary..."
|
|
204
|
+
if [ -f "$GMAIL_CLI_PATH" ]; then
|
|
205
|
+
log_info "gmail-cli binary found at: $GMAIL_CLI_PATH"
|
|
206
|
+
|
|
207
|
+
# Check if it's executable
|
|
208
|
+
if [ ! -x "$GMAIL_CLI_PATH" ]; then
|
|
209
|
+
log_warn "Binary is not executable, fixing permissions..."
|
|
210
|
+
chmod 700 "$GMAIL_CLI_PATH"
|
|
211
|
+
log_info "Made binary executable (permissions: 700)"
|
|
212
|
+
fi
|
|
213
|
+
else
|
|
214
|
+
log_warn "gmail-cli binary NOT found at: $GMAIL_CLI_PATH"
|
|
215
|
+
echo ""
|
|
216
|
+
echo "⚠️ SECURITY WARNING: Binary Missing"
|
|
217
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
218
|
+
echo "The gmail-cli Python script needs to be created."
|
|
219
|
+
echo ""
|
|
220
|
+
echo "IMPORTANT: Only use trusted sources for the binary!"
|
|
221
|
+
echo ""
|
|
222
|
+
echo "To create the binary:"
|
|
223
|
+
echo " 1. Review the example secure implementation in:"
|
|
224
|
+
echo " $SCRIPT_DIR/gmail-cli-secure.py"
|
|
225
|
+
echo " 2. Customize for your needs"
|
|
226
|
+
echo " 3. Copy to: $GMAIL_CLI_PATH"
|
|
227
|
+
echo " 4. Make executable: chmod 700 $GMAIL_CLI_PATH"
|
|
228
|
+
echo ""
|
|
229
|
+
echo "DO NOT download binaries from untrusted sources!"
|
|
230
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
231
|
+
fi
|
|
232
|
+
echo ""
|
|
233
|
+
|
|
234
|
+
# Create activation script
|
|
235
|
+
ACTIVATE_SCRIPT="$SCRIPT_DIR/activate-gmail-cli.sh"
|
|
236
|
+
cat > "$ACTIVATE_SCRIPT" << 'EOF'
|
|
237
|
+
#!/bin/bash
|
|
238
|
+
# Activate Gmail CLI virtual environment
|
|
239
|
+
|
|
240
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
241
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
242
|
+
VENV_DIR="$PROJECT_ROOT/.venv-gmail-cli"
|
|
243
|
+
|
|
244
|
+
if [ -f "$VENV_DIR/bin/activate" ]; then
|
|
245
|
+
source "$VENV_DIR/bin/activate"
|
|
246
|
+
echo "✓ Gmail CLI virtual environment activated"
|
|
247
|
+
echo "Deactivate with: deactivate"
|
|
248
|
+
else
|
|
249
|
+
echo "❌ Virtual environment not found. Run install.sh first."
|
|
250
|
+
exit 1
|
|
251
|
+
fi
|
|
252
|
+
EOF
|
|
253
|
+
chmod +x "$ACTIVATE_SCRIPT"
|
|
254
|
+
log_info "Created activation script: $ACTIVATE_SCRIPT"
|
|
255
|
+
echo ""
|
|
256
|
+
|
|
257
|
+
# Create wrapper script that uses the virtual environment
|
|
258
|
+
WRAPPER_SCRIPT="$BIN_DIR/gmail-cli-wrapper"
|
|
259
|
+
cat > "$WRAPPER_SCRIPT" << EOF
|
|
260
|
+
#!/bin/bash
|
|
261
|
+
# Gmail CLI Wrapper - Uses isolated virtual environment
|
|
262
|
+
VENV_DIR="$VENV_DIR"
|
|
263
|
+
GMAIL_CLI="$GMAIL_CLI_PATH"
|
|
264
|
+
|
|
265
|
+
if [ ! -f "\$VENV_DIR/bin/activate" ]; then
|
|
266
|
+
echo "❌ Virtual environment not found. Run install.sh first."
|
|
267
|
+
exit 1
|
|
268
|
+
fi
|
|
269
|
+
|
|
270
|
+
source "\$VENV_DIR/bin/activate"
|
|
271
|
+
exec python "\$GMAIL_CLI" "\$@"
|
|
272
|
+
EOF
|
|
273
|
+
chmod 700 "$WRAPPER_SCRIPT"
|
|
274
|
+
log_info "Created wrapper script: $WRAPPER_SCRIPT"
|
|
275
|
+
echo ""
|
|
276
|
+
|
|
277
|
+
# Final summary
|
|
278
|
+
echo "✅ Installation Complete!"
|
|
279
|
+
echo "========================"
|
|
280
|
+
echo ""
|
|
281
|
+
echo "📋 Next Steps:"
|
|
282
|
+
echo ""
|
|
283
|
+
echo "1. 🔐 Set up OAuth2 credentials:"
|
|
284
|
+
echo " - Follow instructions in: $SCRIPT_DIR/SETUP.md"
|
|
285
|
+
echo " - Save credentials to: $GMAIL_CLI_DIR/credentials.json"
|
|
286
|
+
echo " - Ensure permissions: chmod 600 ~/.gmail-cli/credentials.json"
|
|
287
|
+
echo ""
|
|
288
|
+
echo "2. 🔨 Create the gmail-cli binary:"
|
|
289
|
+
echo " - Review example: $SCRIPT_DIR/gmail-cli-secure.py"
|
|
290
|
+
echo " - Copy to: $GMAIL_CLI_PATH"
|
|
291
|
+
echo " - Make executable: chmod 700 $GMAIL_CLI_PATH"
|
|
292
|
+
echo ""
|
|
293
|
+
echo "3. 🔑 Authenticate:"
|
|
294
|
+
echo " - Run: $WRAPPER_SCRIPT auth"
|
|
295
|
+
echo ""
|
|
296
|
+
echo "4. ✉️ Start using Gmail CLI:"
|
|
297
|
+
echo " - List emails: $WRAPPER_SCRIPT list --max 10"
|
|
298
|
+
echo " - Send email: $WRAPPER_SCRIPT send --to user@example.com --subject Test --body Hello"
|
|
299
|
+
echo ""
|
|
300
|
+
echo "📚 Documentation:"
|
|
301
|
+
echo " - Setup Guide: $SCRIPT_DIR/SETUP.md"
|
|
302
|
+
echo " - Security Guide: $SCRIPT_DIR/SECURITY.md"
|
|
303
|
+
echo " - Usage Examples: $SCRIPT_DIR/skill.md"
|
|
304
|
+
echo ""
|
|
305
|
+
echo "🛡️ Security Recommendations:"
|
|
306
|
+
echo " - Review SECURITY.md for best practices"
|
|
307
|
+
echo " - Run 'pip-audit' regularly to check for vulnerabilities"
|
|
308
|
+
echo " - Never commit credentials.json or token.pickle to git"
|
|
309
|
+
echo " - Enable full-disk encryption on your device"
|
|
310
|
+
echo ""
|
|
311
|
+
echo "Virtual environment: $VENV_DIR"
|
|
312
|
+
echo "Activate manually: source $ACTIVATE_SCRIPT"
|
|
313
|
+
echo ""
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Gmail CLI Python Dependencies
|
|
2
|
+
# Pinned versions for security and reproducibility
|
|
3
|
+
#
|
|
4
|
+
# SECURITY NOTE:
|
|
5
|
+
# For production deployments with hash verification:
|
|
6
|
+
# 1. Run: ./generate-hashes.sh
|
|
7
|
+
# 2. Use the generated requirements-locked.txt
|
|
8
|
+
# 3. Install with: pip install --require-hashes -r requirements-locked.txt
|
|
9
|
+
#
|
|
10
|
+
# The install.sh script will automatically use hash verification
|
|
11
|
+
# if requirements-locked.txt exists and contains valid hashes.
|
|
12
|
+
|
|
13
|
+
# Google API Client - Core library for Gmail API
|
|
14
|
+
# Provides the API client for accessing Gmail services
|
|
15
|
+
google-api-python-client==2.108.0
|
|
16
|
+
|
|
17
|
+
# Google Auth HTTPLib2 - HTTP transport for Google APIs
|
|
18
|
+
# Required for making authenticated HTTP requests
|
|
19
|
+
google-auth-httplib2==0.1.1
|
|
20
|
+
|
|
21
|
+
# Google Auth OAuthLib - OAuth2 authentication
|
|
22
|
+
# Handles OAuth2 flow for user authorization
|
|
23
|
+
google-auth-oauthlib==1.1.0
|
|
24
|
+
|
|
25
|
+
# Google Auth - Core authentication library
|
|
26
|
+
# Base authentication functionality (explicit pin though installed as dependency)
|
|
27
|
+
google-auth==2.23.4
|
|
28
|
+
|
|
29
|
+
# Cryptography - Security operations
|
|
30
|
+
# Used for secure credential storage and encryption
|
|
31
|
+
# NOTE: Version 42.0.0+ contains security fixes for CVE-2023-49083 and others
|
|
32
|
+
cryptography>=42.0.0
|
|
33
|
+
|
|
34
|
+
# Security Best Practices:
|
|
35
|
+
# - Run 'pip-audit' to check for known vulnerabilities
|
|
36
|
+
# - Update dependencies regularly and regenerate hashes
|
|
37
|
+
# - Use virtual environments for isolation
|
|
38
|
+
# - For maximum security, use requirements-locked.txt with hash verification
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gmail
|
|
3
|
+
description: Read, send, and manage Gmail emails via the gmail-cli tool.
|
|
4
|
+
metadata:
|
|
5
|
+
displayName: Gmail
|
|
6
|
+
icon: mail
|
|
7
|
+
category: communication
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
dependencies:
|
|
10
|
+
cli: gmail-cli
|
|
11
|
+
checkCommand: gmail-cli --version
|
|
12
|
+
bundledInstall: skills/gmail/install.sh
|
|
13
|
+
install:
|
|
14
|
+
darwin:
|
|
15
|
+
pip: gmail-cli
|
|
16
|
+
linux:
|
|
17
|
+
pip: gmail-cli
|
|
18
|
+
windows:
|
|
19
|
+
pip: gmail-cli
|
|
20
|
+
config:
|
|
21
|
+
- name: GMAIL_CREDENTIALS_PATH
|
|
22
|
+
label: Credentials Path
|
|
23
|
+
type: string
|
|
24
|
+
required: false
|
|
25
|
+
placeholder: ~/.gmail-cli/credentials.json
|
|
26
|
+
auth:
|
|
27
|
+
type: oauth
|
|
28
|
+
setupCommand: gmail-cli auth
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
# gmail-cli
|
|
32
|
+
|
|
33
|
+
Use `./.codebuddy/bin/gmail-cli-wrapper` to interact with Gmail.
|
|
34
|
+
This tool allows you to read, send, and manage Gmail messages directly from the chat.
|
|
35
|
+
|
|
36
|
+
> **Note**: The wrapper script ensures commands run within an isolated Python virtual environment for security.
|
|
37
|
+
|
|
38
|
+
## ⚠️ Security Warning
|
|
39
|
+
|
|
40
|
+
**CRITICAL**: This tool accesses your Gmail account. Follow security best practices:
|
|
41
|
+
|
|
42
|
+
- ✅ **ALWAYS** set file permissions: `chmod 700 ~/.gmail-cli && chmod 600 ~/.gmail-cli/*`
|
|
43
|
+
- ✅ **NEVER** commit `credentials.json` or `token.pickle` to git
|
|
44
|
+
- ✅ Use the secure installation script: `bash .codebuddy/skills/gmail/install.sh`
|
|
45
|
+
- ✅ Review `SECURITY.md` for comprehensive security guidance
|
|
46
|
+
- ⚠️ Extra caution on shared systems - other users may access your credentials if permissions are wrong!
|
|
47
|
+
|
|
48
|
+
## Setup
|
|
49
|
+
|
|
50
|
+
**Recommended**: Use the secure installation script:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cd .codebuddy/skills/gmail
|
|
54
|
+
bash install.sh
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This script will:
|
|
58
|
+
|
|
59
|
+
- Create isolated Python virtual environment
|
|
60
|
+
- Install dependencies with security audit
|
|
61
|
+
- Set secure file permissions (700/600)
|
|
62
|
+
- Guide you through OAuth2 setup
|
|
63
|
+
|
|
64
|
+
**Manual Setup** (if needed):
|
|
65
|
+
|
|
66
|
+
Before using, you must authenticate with Google OAuth2. Run the following command in the terminal:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
./.codebuddy/bin/gmail-cli-wrapper auth
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This will:
|
|
73
|
+
|
|
74
|
+
1. Open a browser window for Google OAuth2 authentication
|
|
75
|
+
2. Request permissions to access your Gmail account
|
|
76
|
+
3. Store credentials locally for future use
|
|
77
|
+
|
|
78
|
+
**Important**: You need to set up OAuth2 credentials first. See `SETUP.md` for detailed instructions.
|
|
79
|
+
|
|
80
|
+
## Common Commands
|
|
81
|
+
|
|
82
|
+
### Authentication
|
|
83
|
+
|
|
84
|
+
- Authenticate: `./.codebuddy/bin/gmail-cli-wrapper auth`
|
|
85
|
+
- Reset authentication: `./.codebuddy/bin/gmail-cli-wrapper auth --reset`
|
|
86
|
+
|
|
87
|
+
### Reading Emails
|
|
88
|
+
|
|
89
|
+
- List recent emails: `./.codebuddy/bin/gmail-cli-wrapper list --max 10`
|
|
90
|
+
- List unread emails: `./.codebuddy/bin/gmail-cli-wrapper list --unread`
|
|
91
|
+
- Search emails: `./.codebuddy/bin/gmail-cli-wrapper list --query "subject:meeting"`
|
|
92
|
+
- Read specific email: `./.codebuddy/bin/gmail-cli-wrapper read <message-id>`
|
|
93
|
+
|
|
94
|
+
### Sending Emails
|
|
95
|
+
|
|
96
|
+
- Send email: `./.codebuddy/bin/gmail-cli-wrapper send --to "user@example.com" --subject "Hello" --body "Message text"`
|
|
97
|
+
- Send with CC: `./.codebuddy/bin/gmail-cli-wrapper send --to "user@example.com" --cc "other@example.com" --subject "Hello" --body "Message"`
|
|
98
|
+
- Send with attachment: `./.codebuddy/bin/gmail-cli-wrapper send --to "user@example.com" --subject "Files" --body "See attached" --attach /path/to/file.pdf`
|
|
99
|
+
- Multiple attachments: `./.codebuddy/bin/gmail-cli-wrapper send --to "user@example.com" --subject "Files" --body "Documents" --attach file1.pdf file2.docx`
|
|
100
|
+
|
|
101
|
+
## Search Query Examples
|
|
102
|
+
|
|
103
|
+
Gmail CLI supports advanced search queries similar to Gmail's web interface:
|
|
104
|
+
|
|
105
|
+
- `"from:john@example.com"` - Emails from a specific sender
|
|
106
|
+
- `"subject:invoice"` - Emails with "invoice" in subject
|
|
107
|
+
- `"has:attachment"` - Emails with attachments
|
|
108
|
+
- `"is:unread"` - Unread emails
|
|
109
|
+
- `"after:2024/01/01"` - Emails after a specific date
|
|
110
|
+
- `"to:me cc:boss@company.com"` - Emails to you with CC to boss
|
|
111
|
+
- `"newer_than:2d"` - Emails from last 2 days
|
|
112
|
+
|
|
113
|
+
Example:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
./.codebuddy/bin/gmail-cli-wrapper list --query "from:client@company.com subject:invoice has:attachment"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Configuration
|
|
120
|
+
|
|
121
|
+
Configuration and credentials are stored in:
|
|
122
|
+
|
|
123
|
+
- `~/.gmail-cli/credentials.json` - OAuth2 credentials (from Google Cloud Console)
|
|
124
|
+
- `~/.gmail-cli/token.pickle` - Access token (auto-generated and auto-refreshed)
|
|
125
|
+
|
|
126
|
+
## Prerequisites
|
|
127
|
+
|
|
128
|
+
Before using this tool, you need to:
|
|
129
|
+
|
|
130
|
+
1. Install Python 3.7+
|
|
131
|
+
2. Install required packages: `pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib`
|
|
132
|
+
3. Set up OAuth2 credentials from Google Cloud Console (see SETUP.md)
|
|
133
|
+
|
|
134
|
+
## 🔒 Security Best Practices
|
|
135
|
+
|
|
136
|
+
### File Permissions (MANDATORY)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Secure the credential directory
|
|
140
|
+
chmod 700 ~/.gmail-cli
|
|
141
|
+
|
|
142
|
+
# Secure credential files
|
|
143
|
+
chmod 600 ~/.gmail-cli/credentials.json
|
|
144
|
+
chmod 600 ~/.gmail-cli/token.pickle
|
|
145
|
+
|
|
146
|
+
# Verify permissions
|
|
147
|
+
ls -la ~/.gmail-cli/
|
|
148
|
+
# Should show: drwx------ for directory, -rw------- for files
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Input Validation
|
|
152
|
+
|
|
153
|
+
The secure implementation (`gmail-cli-secure.py`) validates all inputs:
|
|
154
|
+
|
|
155
|
+
- ✅ Email addresses checked against RFC 5322 format
|
|
156
|
+
- ✅ File paths validated to prevent path traversal
|
|
157
|
+
- ✅ Sensitive files blocked from attachments
|
|
158
|
+
- ✅ Text fields sanitized to prevent injection attacks
|
|
159
|
+
|
|
160
|
+
### Safe Usage Example
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# ✅ SAFE: Properly quoted and validated
|
|
164
|
+
EMAIL="user@example.com"
|
|
165
|
+
SUBJECT="Monthly Report"
|
|
166
|
+
BODY="Please review"
|
|
167
|
+
FILE="/path/to/document.pdf"
|
|
168
|
+
|
|
169
|
+
# Validate before using
|
|
170
|
+
[[ -f "$FILE" ]] || exit 1
|
|
171
|
+
|
|
172
|
+
./.codebuddy/bin/gmail-cli-wrapper send --to "$EMAIL" --subject "$SUBJECT" \
|
|
173
|
+
--body "$BODY" --attach "$FILE"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### ❌ Unsafe Practices
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# DON'T DO THIS: Never use untrusted input directly
|
|
180
|
+
read -p "Enter recipient: " RECIPIENT
|
|
181
|
+
./.codebuddy/bin/gmail-cli-wrapper send --to "$RECIPIENT" --subject "Test"
|
|
182
|
+
|
|
183
|
+
# DON'T DO THIS: Sending sensitive files
|
|
184
|
+
./.codebuddy/bin/gmail-cli-wrapper send --to "user@example.com" \
|
|
185
|
+
--subject "Keys" --attach ~/.ssh/id_rsa # ❌ DANGER!
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Notes
|
|
189
|
+
|
|
190
|
+
- **OAuth2 Required**: You must complete OAuth2 authentication before using the tool
|
|
191
|
+
- **Google Account Access**: Requires a Google account with Gmail enabled
|
|
192
|
+
- **API Permissions**: Recommended scopes: `gmail.readonly` + `gmail.send` (NOT `gmail.modify`)
|
|
193
|
+
- **Rate Limits**: Subject to Gmail API rate limits (usually sufficient for normal use)
|
|
194
|
+
- **Security**: Tokens are stored locally in `~/.gmail-cli/`; must have 600 permissions
|
|
195
|
+
- **First Time Setup**: Setup requires creating a Google Cloud project and OAuth2 credentials (see SETUP.md)
|
|
196
|
+
- **Token Rotation**: Revoke tokens every 30-90 days or after device loss
|
|
197
|
+
- **Shared Systems**: Extra caution on shared computers - use restrictive permissions!
|
|
198
|
+
|
|
199
|
+
## Troubleshooting
|
|
200
|
+
|
|
201
|
+
- **Authentication fails**: Try `./.codebuddy/bin/gmail-cli-wrapper auth --reset` to re-authenticate
|
|
202
|
+
- **Package errors**: Install packages with `pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib`
|
|
203
|
+
- **Credentials not found**: Make sure `~/.gmail-cli/credentials.json` exists (see SETUP.md)
|
|
204
|
+
- **Permission denied**: Ensure the wrapper has execute permissions: `chmod +x ./.codebuddy/bin/gmail-cli-wrapper`
|
|
205
|
+
|
|
206
|
+
## 📚 Documentation
|
|
207
|
+
|
|
208
|
+
- **SECURITY.md** - 🔒 **READ THIS FIRST** - Comprehensive security guide
|
|
209
|
+
- **SETUP.md** - Detailed setup instructions with Google Cloud Console configuration
|
|
210
|
+
- **README.md** - Quick start guide and feature overview
|
|
211
|
+
- **gmail-cli-secure.py** - Reference implementation with input validation
|
|
212
|
+
- **email/skill.md** - Alternative SMTP-based email sending (simpler but less features)
|
|
213
|
+
|
|
214
|
+
## 🛡️ Security Checklist
|
|
215
|
+
|
|
216
|
+
Before using Gmail CLI, verify:
|
|
217
|
+
|
|
218
|
+
- [ ] Installed using `install.sh` script (virtual environment + security audit)
|
|
219
|
+
- [ ] `~/.gmail-cli/` has 700 permissions
|
|
220
|
+
- [ ] `credentials.json` has 600 permissions
|
|
221
|
+
- [ ] `token.pickle` has 600 permissions
|
|
222
|
+
- [ ] `.gitignore` configured to exclude sensitive files
|
|
223
|
+
- [ ] Using minimal OAuth2 scopes (readonly + send, NOT modify)
|
|
224
|
+
- [ ] Read SECURITY.md for best practices
|
|
225
|
+
- [ ] Understand how to revoke tokens if compromised
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: jira
|
|
3
|
+
description: Manage Jira issues, sprints, and epics via the jira-cli tool.
|
|
4
|
+
metadata:
|
|
5
|
+
displayName: Jira
|
|
6
|
+
icon: jira
|
|
7
|
+
category: project-management
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
dependencies:
|
|
10
|
+
cli: jira
|
|
11
|
+
checkCommand: jira version
|
|
12
|
+
install:
|
|
13
|
+
darwin:
|
|
14
|
+
brew: ankitpokhrel/jira-cli/jira-cli
|
|
15
|
+
script: curl -fsSL https://raw.githubusercontent.com/ankitpokhrel/jira-cli/master/scripts/install.sh | sh
|
|
16
|
+
linux:
|
|
17
|
+
script: curl -fsSL https://raw.githubusercontent.com/ankitpokhrel/jira-cli/master/scripts/install.sh | sh
|
|
18
|
+
windows:
|
|
19
|
+
scoop: jira-cli
|
|
20
|
+
config:
|
|
21
|
+
- name: JIRA_API_TOKEN
|
|
22
|
+
label: API Token
|
|
23
|
+
type: secret
|
|
24
|
+
required: true
|
|
25
|
+
helpUrl: https://id.atlassian.com/manage-profile/security/api-tokens
|
|
26
|
+
- name: JIRA_BASE_URL
|
|
27
|
+
label: Jira Base URL
|
|
28
|
+
type: string
|
|
29
|
+
required: true
|
|
30
|
+
placeholder: https://yourcompany.atlassian.net
|
|
31
|
+
auth:
|
|
32
|
+
type: api-key
|
|
33
|
+
setupCommand: jira init
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
# jira-cli
|
|
37
|
+
|
|
38
|
+
Use `./.codebuddy/bin/jira` to interact with Jira.
|
|
39
|
+
This tool allows you to view, create, and update Jira issues directly from the chat.
|
|
40
|
+
|
|
41
|
+
## Setup
|
|
42
|
+
|
|
43
|
+
Before using, you must authenticate. Run the following command in the terminal:
|
|
44
|
+
`./.codebuddy/bin/jira init`
|
|
45
|
+
|
|
46
|
+
## Common Commands
|
|
47
|
+
|
|
48
|
+
### Issues
|
|
49
|
+
|
|
50
|
+
- List issues: `./.codebuddy/bin/jira issue list`
|
|
51
|
+
- View issue: `./.codebuddy/bin/jira issue view <ISSUE-KEY>`
|
|
52
|
+
- Create issue: `./.codebuddy/bin/jira issue create`
|
|
53
|
+
- Comment: `./.codebuddy/bin/jira issue comment add <ISSUE-KEY> "Comment text"`
|
|
54
|
+
- Assign: `./.codebuddy/bin/jira issue assign <ISSUE-KEY> <USER>`
|
|
55
|
+
|
|
56
|
+
### Sprints & Boards
|
|
57
|
+
|
|
58
|
+
- List boards: `./.codebuddy/bin/jira board list`
|
|
59
|
+
- List sprints: `./.codebuddy/bin/jira sprint list --board <BOARD-ID>`
|
|
60
|
+
|
|
61
|
+
### JQL
|
|
62
|
+
|
|
63
|
+
- Search with JQL: `./.codebuddy/bin/jira issue list --jql "project = PROJ AND status = 'In Progress'"`
|
|
64
|
+
|
|
65
|
+
## Notes
|
|
66
|
+
|
|
67
|
+
- Ensure you have an API token ready from Atlassian (https://id.atlassian.com/manage-profile/security/api-tokens).
|
|
68
|
+
- Configuration is stored in `~/.jira/.config.yml`.
|