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.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +424 -0
  3. package/bin/xzh.js +3 -0
  4. package/dist/cli.js +5602 -0
  5. package/dist/cli.js.map +7 -0
  6. package/dist/skills/aws/SKILL.md +70 -0
  7. package/dist/skills/datadog/SKILL.md +261 -0
  8. package/dist/skills/elasticsearch/SKILL.md +88 -0
  9. package/dist/skills/elasticsearch/install.sh +91 -0
  10. package/dist/skills/email/SKILL.md +63 -0
  11. package/dist/skills/github/SKILL.md +69 -0
  12. package/dist/skills/gitlab/SKILL.md +68 -0
  13. package/dist/skills/gitlab/install.sh +74 -0
  14. package/dist/skills/gmail/README.md +139 -0
  15. package/dist/skills/gmail/SECURITY.md +552 -0
  16. package/dist/skills/gmail/SETUP.md +258 -0
  17. package/dist/skills/gmail/activate-gmail-cli.sh +15 -0
  18. package/dist/skills/gmail/generate-hashes.sh +82 -0
  19. package/dist/skills/gmail/gmail-cli-secure.py +599 -0
  20. package/dist/skills/gmail/install.sh +313 -0
  21. package/dist/skills/gmail/requirements.txt +38 -0
  22. package/dist/skills/gmail/skill.md +225 -0
  23. package/dist/skills/jira/SKILL.md +68 -0
  24. package/dist/skills/kubernetes/SKILL.md +70 -0
  25. package/dist/skills/linear/SKILL.md +48 -0
  26. package/dist/skills/mongodb/SKILL.md +53 -0
  27. package/dist/skills/mysql/SKILL.md +71 -0
  28. package/dist/skills/mysql/install.sh +74 -0
  29. package/dist/skills/officecli/SKILL.md +429 -0
  30. package/dist/skills/playwright/SKILL.md +171 -0
  31. package/dist/skills/postgres/SKILL.md +44 -0
  32. package/dist/skills/postgres/install.sh +73 -0
  33. package/dist/skills/redis/SKILL.md +58 -0
  34. package/dist/skills/redis/install.sh +39 -0
  35. package/dist/skills/sentry/SKILL.md +59 -0
  36. package/dist/skills/telegram/SKILL.md +151 -0
  37. package/package.json +46 -0
@@ -0,0 +1,74 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # GitLab CLI (glab) Installation Script
5
+ # Installs glab from official sources (Homebrew or GitLab Releases)
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
9
+ BIN_DIR="$PROJECT_ROOT/.codebuddy/bin"
10
+ TEMP_DIR=$(mktemp -d)
11
+
12
+ mkdir -p "$BIN_DIR"
13
+
14
+ echo "🔍 Checking for glab..."
15
+
16
+ # Method 1: Homebrew (Preferred for macOS)
17
+ if command -v brew >/dev/null 2>&1; then
18
+ echo "🍺 Homebrew detected. Installing/Updating glab..."
19
+ brew install glab || brew upgrade glab
20
+
21
+ BREW_PREFIX=$(brew --prefix)
22
+
23
+ # Symlink to bin
24
+ echo "🔗 Linking to $BIN_DIR/glab..."
25
+ ln -sf "$BREW_PREFIX/bin/glab" "$BIN_DIR/glab"
26
+
27
+ echo "✅ glab installed via Homebrew!"
28
+ "$BIN_DIR/glab" --version
29
+ exit 0
30
+ fi
31
+
32
+ # Method 2: Manual Download (Fallback)
33
+ echo "⬇️ Downloading glab from official releases..."
34
+ OS=$(uname -s | tr '[:upper:]' '[:lower:]')
35
+ ARCH=$(uname -m)
36
+
37
+ # Map architecture names
38
+ if [ "$ARCH" == "x86_64" ]; then
39
+ ARCH="x86_64"
40
+ elif [ "$ARCH" == "arm64" ]; then
41
+ ARCH="arm64"
42
+ fi
43
+
44
+ # Latest release logic could be complex without jq/gh.
45
+ # Using a fixed recent version for reliability if brew is missing.
46
+ # TODO: Update this version periodically. Check releases at:
47
+ # https://gitlab.com/gitlab-org/cli/-/releases
48
+ GLAB_VERSION="1.46.1"
49
+ FILENAME="glab_${GLAB_VERSION}_${OS}_${ARCH}.tar.gz"
50
+ DOWNLOAD_URL="https://gitlab.com/gitlab-org/cli/-/releases/v${GLAB_VERSION}/downloads/${FILENAME}"
51
+
52
+ cd "$TEMP_DIR"
53
+ echo "Downloading $DOWNLOAD_URL..."
54
+ curl -L -o glab.tar.gz "$DOWNLOAD_URL"
55
+
56
+ echo "📦 Extracting..."
57
+ tar xzf glab.tar.gz
58
+
59
+ echo "📂 Installing to $BIN_DIR..."
60
+ # The tarball structure usually has bin/glab
61
+ if [ -f "bin/glab" ]; then
62
+ cp bin/glab "$BIN_DIR/"
63
+ else
64
+ # Sometimes it's in root
65
+ cp glab "$BIN_DIR/"
66
+ fi
67
+
68
+ chmod +x "$BIN_DIR/glab"
69
+
70
+ echo "✅ glab installed manually!"
71
+ "$BIN_DIR/glab" --version
72
+
73
+ # Cleanup
74
+ rm -rf "$TEMP_DIR"
@@ -0,0 +1,139 @@
1
+ # Gmail CLI Skill
2
+
3
+ A secure command-line interface for interacting with Gmail - read, send, and manage emails directly from the terminal.
4
+
5
+ ## ⚠️ Security Notice
6
+
7
+ **This tool accesses your Gmail account. Security is critical!**
8
+
9
+ - 🔒 **READ FIRST**: `SECURITY.md` for comprehensive security guidance
10
+ - ✅ **USE**: The secure installation script (`install.sh`)
11
+ - ⚠️ **NEVER**: Commit credentials or tokens to version control
12
+ - 🛡️ **ALWAYS**: Set proper file permissions (700/600)
13
+
14
+ ## 📁 Files
15
+
16
+ - **SECURITY.md** - 🔒 **MUST READ** - Security best practices and guidelines
17
+ - **skill.md** - Main skill documentation with usage examples and commands
18
+ - **SETUP.md** - Detailed setup instructions for OAuth2 and Google Cloud Console
19
+ - **install.sh** - Automated secure installation script
20
+ - **requirements.txt** - Pinned Python dependencies with hash verification
21
+ - **.gitignore** - Protects against committing sensitive files
22
+ - **gmail-cli-secure.py** - Reference implementation with input validation
23
+ - **Binary**: `.codebuddy/bin/gmail-cli` - Python script for Gmail operations (to be created)
24
+
25
+ ## 🚀 Quick Start (Secure Installation)
26
+
27
+ ### ✅ Recommended: Automated Secure Installation
28
+
29
+ ```bash
30
+ cd .codebuddy/skills/gmail
31
+ bash install.sh
32
+ ```
33
+
34
+ **This script provides:**
35
+ - ✅ Virtual environment isolation (not global installation)
36
+ - ✅ Pinned dependencies with hash verification
37
+ - ✅ Secure file permissions (700/600)
38
+ - ✅ Security audit with `pip-audit`
39
+ - ✅ Credential directory protection
40
+
41
+ ### ⚠️ Manual Installation (Advanced Users)
42
+
43
+ **Only use manual installation if you understand the security implications!**
44
+
45
+ 1. **Create isolated environment:**
46
+ ```bash
47
+ python3 -m venv .venv-gmail-cli
48
+ source .venv-gmail-cli/bin/activate
49
+ ```
50
+
51
+ 2. **Install Python dependencies with security checks:**
52
+ ```bash
53
+ pip install --upgrade pip
54
+ pip install -r requirements.txt # Uses pinned versions
55
+ pip install pip-audit && pip-audit # Check for vulnerabilities
56
+ ```
57
+
58
+ 3. **Set up Google OAuth2 credentials** (see SETUP.md for details):
59
+ - Create a Google Cloud project
60
+ - Enable Gmail API
61
+ - Create OAuth2 credentials (Desktop app)
62
+ - **IMPORTANT**: Save credentials with secure permissions:
63
+ ```bash
64
+ mkdir -p ~/.gmail-cli
65
+ chmod 700 ~/.gmail-cli
66
+ mv ~/Downloads/credentials.json ~/.gmail-cli/
67
+ chmod 600 ~/.gmail-cli/credentials.json
68
+ ```
69
+
70
+ 4. **Create the gmail-cli binary:**
71
+ ```bash
72
+ # Use the secure reference implementation
73
+ cp gmail-cli-secure.py ../.codebuddy/bin/gmail-cli
74
+ chmod 700 ../.codebuddy/bin/gmail-cli
75
+ ```
76
+
77
+ 5. **Authenticate:**
78
+ ```bash
79
+ ./.codebuddy/bin/gmail-cli auth
80
+ ```
81
+
82
+ 6. **Verify security:**
83
+ ```bash
84
+ # Check permissions
85
+ ls -la ~/.gmail-cli/
86
+ # Should show: drwx------ (700) for directory
87
+ # Should show: -rw------- (600) for files
88
+ ```
89
+
90
+ 7. **Start using:**
91
+ ```bash
92
+ # List emails
93
+ ./.codebuddy/bin/gmail-cli list --max 10
94
+
95
+ # Send email
96
+ ./.codebuddy/bin/gmail-cli send --to "user@example.com" --subject "Hello" --body "Test"
97
+ ```
98
+
99
+ ## 📖 Documentation
100
+
101
+ - **SECURITY.md** - 🔒 **START HERE** - Security best practices, threat model, incident response
102
+ - **skill.md** - Complete command reference and usage examples
103
+ - **SETUP.md** - Detailed OAuth2 setup instructions with Google Cloud Console
104
+ - **gmail-cli-secure.py** - Reference implementation with input validation
105
+
106
+ ## 🔧 Features
107
+
108
+ ### Core Features
109
+ - ✅ OAuth2 authentication (secure, no passwords)
110
+ - ✅ List and search emails (Gmail query syntax)
111
+ - ✅ Read email content
112
+ - ✅ Send emails with attachments
113
+ - ✅ Advanced search queries
114
+ - ✅ Auto-refreshing tokens
115
+
116
+ ### 🔒 Security Features
117
+ - ✅ Input validation (email addresses, file paths, text fields)
118
+ - ✅ Minimal OAuth2 scopes (readonly + send, not modify)
119
+ - ✅ Secure file permissions enforcement (700/600)
120
+ - ✅ Virtual environment isolation
121
+ - ✅ Dependency hash verification
122
+ - ✅ Security auditing with pip-audit
123
+ - ✅ Token management and revocation
124
+ - ✅ Path traversal protection
125
+ - ✅ Injection attack prevention
126
+
127
+ ## 🆚 Comparison with Email Skill
128
+
129
+ | Feature | Gmail CLI | Email Skill |
130
+ |---------|-----------|-------------|
131
+ | Authentication | OAuth2 (more secure) | SMTP credentials |
132
+ | Read emails | ✅ Yes | ❌ No |
133
+ | Search emails | ✅ Yes | ❌ No |
134
+ | Send emails | ✅ Yes | ✅ Yes |
135
+ | Attachments | ✅ Yes | ✅ Yes |
136
+ | Setup complexity | Higher (requires Google Cloud) | Lower (just SMTP) |
137
+
138
+ Use **Gmail CLI** when you need full Gmail integration.
139
+ Use **Email skill** for simple email sending via SMTP.