From google-drive
Manage Google Drive files via the Google Workspace CLI (gws) — list, upload, download, create, search, and share files. Use when users ask to work with Drive files, organize folders, upload documents, or manage file permissions.
npx claudepluginhub leolionart/claude-skills --plugin google-driveThis skill uses the workspace's default tool permissions.
- List files/folders trên Drive
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Automates semantic versioning and release workflow for Claude Code plugins: bumps versions in package.json, marketplace.json, plugin.json; verifies builds; creates git tags, GitHub releases, changelogs.
gws CLI đã cài và đã xác thựchttps://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.readonly# List files gần đây
gws drive files list
# List với tùy chọn
gws drive files list \
--params '{"pageSize": 20, "orderBy": "modifiedTime desc"}'
# Lọc theo loại file
gws drive files list \
--params '{"q": "mimeType='\''application/vnd.google-apps.spreadsheet'\''", "pageSize": 10}'
# List trong folder cụ thể
gws drive files list \
--params '{"q": "'\''FOLDER_ID'\'' in parents", "pageSize": 50}'
# Tất cả files (pagination)
gws drive files list \
--params '{"pageSize": 100}' \
--page-all
# Tìm theo tên
gws drive files list \
--params '{"q": "name contains '\''report'\'' and trashed=false"}'
# Tìm files được chia sẻ gần đây
gws drive files list \
--params '{"q": "sharedWithMe=true", "orderBy": "sharedWithMeTime desc"}'
# Tìm files được chỉnh sửa gần đây (7 ngày)
gws drive files list \
--params '{"q": "modifiedTime > '\''2024-01-08T00:00:00'\''", "orderBy": "modifiedTime desc"}'
# Upload đơn giản với tự động metadata
gws drive +upload ./report.pdf
# Upload với metadata tùy chỉnh
gws drive files create \
--json '{"name": "Q1 Report 2024", "parents": ["FOLDER_ID"]}' \
--upload ./q1-report.pdf
# Upload vào folder cụ thể
gws drive +upload ./data.csv \
--parent FOLDER_ID
# Upload và convert sang Google Docs format
gws drive files create \
--json '{"name": "Document", "mimeType": "application/vnd.google-apps.document"}' \
--upload ./document.docx
# Tạo folder mới
gws drive files create \
--json '{"name": "Project Alpha", "mimeType": "application/vnd.google-apps.folder"}'
# Tạo folder lồng nhau
gws drive files create \
--json '{
"name": "Reports",
"mimeType": "application/vnd.google-apps.folder",
"parents": ["PARENT_FOLDER_ID"]
}'
# Chi tiết file
gws drive files get \
--params '{"fileId": "FILE_ID", "fields": "id,name,mimeType,size,modifiedTime,webViewLink"}'
# Chỉ lấy link chia sẻ
gws drive files get \
--params '{"fileId": "FILE_ID", "fields": "webViewLink,webContentLink"}' | jq '.webViewLink'
# Chia sẻ với user cụ thể (editor)
gws drive permissions create \
--params '{"fileId": "FILE_ID"}' \
--json '{"type": "user", "role": "writer", "emailAddress": "colleague@company.com"}'
# Chia sẻ với tất cả (viewer, có link)
gws drive permissions create \
--params '{"fileId": "FILE_ID"}' \
--json '{"type": "anyone", "role": "reader"}'
# Xem danh sách permissions
gws drive permissions list \
--params '{"fileId": "FILE_ID"}'
# Xóa permission
gws drive permissions delete \
--params '{"fileId": "FILE_ID", "permissionId": "PERMISSION_ID"}'
# Kết hợp Drive + Chat: upload file và thông báo
gws workflow +file-announce \
--file FILE_ID \
--space SPACE_NAME
gws schema drive.files.list
gws schema drive.files.create
gws schema drive.files.get
gws schema drive.permissions.create
| Loại | MIME Type |
|---|---|
| Google Docs | application/vnd.google-apps.document |
| Google Sheets | application/vnd.google-apps.spreadsheet |
| Google Slides | application/vnd.google-apps.presentation |
| Google Forms | application/vnd.google-apps.form |
| Folder | application/vnd.google-apps.folder |
application/pdf | |
| CSV | text/csv |
| Excel | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
# Các operators hữu ích trong --params q="..."
name contains 'keyword' # Tìm theo tên
fullText contains 'keyword' # Tìm trong nội dung
mimeType = 'type' # Lọc theo loại
'folder_id' in parents # Trong folder cụ thể
trashed = false # Không bị xóa
starred = true # Đã đánh dấu sao
sharedWithMe = true # Được chia sẻ với mình
modifiedTime > '2024-01-01' # Sau ngày cụ thể
owners in 'user@domain.com' # Của user cụ thể
User muốn tìm file?
→ Hỏi: từ khóa, loại file (nếu có)
→ Dùng: gws drive files list --params '{"q": "name contains '...'"}'
User muốn upload file?
→ Hỏi: đường dẫn file local, folder đích (nếu có)
→ Dùng: gws drive +upload ./file.ext
User muốn chia sẻ file?
→ Hỏi: file ID hoặc tên file, email người nhận, quyền (reader/writer/owner)
→ Tìm file ID nếu chưa có → gws drive files list
→ Dùng: gws drive permissions create
User muốn tạo folder?
→ Hỏi: tên folder, folder cha (nếu có)
→ Dùng: gws drive files create với mimeType folder
name, type, modified, size, id| Lỗi | Nguyên nhân | Cách xử lý |
|---|---|---|
| "File not found" | File ID sai hoặc không có quyền | Kiểm tra ID, xem quyền truy cập |
| "Insufficient permissions" | Thiếu scope Drive | Thêm scope drive trong OAuth |
| "Upload limit exceeded" | File quá lớn | Dùng resumable upload hoặc chia nhỏ |
| "Cannot share" | Domain policy hạn chế | Liên hệ admin workspace |
anyone trừ khi user yêu cầu rõ ràng