关于 clever-tools
Clever Tools 是用于管理 Clever Cloud 应用和服务的官方命令行技能,涵盖部署、配置、附加组件、扩缩容、日志和 SSH 访问。
主要功能
- 01部署应用
- 02管理附加组件和服务
- 03配置环境变量与域名
- 04查看日志并调整应用规模
- 05通过 SSH 访问实例
适用场景
- 01将代码部署到 Clever Cloud
- 02配置应用域名和环境变量
- 03查看日志或调整实例规模
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ clevercloud/ clever-tools --skill clever-tools安装后在 Claude Code 中输入/clever-tools确认已加载。
附带文件references/full-documentation.md
详细介绍
Clever Tools
Clever Tools 是 Clever Cloud 的官方 CLI,Clever Cloud 是一家平台即服务(PaaS)提供商。它可用于部署应用、管理附加组件(数据库、存储等)、配置环境变量和域名,以及监控服务。
当用户想要将代码部署到 Clever Cloud、管理托管的应用,或与 Clever Cloud 服务交互时,请使用此技能。
快速入门
# Login to Clever Cloud (opens browser for OAuth)
clever login
# For CI/CD, use token-based authentication
export CLEVER_TOKEN="your-token"
export CLEVER_SECRET="your-secret"
# Link an existing application to current directory
clever link <app-id>
# Or create a new application
clever create --type node myapp
# Deploy current directory
clever deploy
基本命令
部署
# Deploy current directory (git push to Clever Cloud)
clever deploy
# Deploy with specific commit or branch
clever deploy --branch main
clever deploy --commit HEAD~2
# Restart application
clever restart
# Stop application (scales to 0)
clever stop
# Check deployment status
clever status
# View deployment history
clever activity
clever activity --follow # Live updates
日志
# Stream live logs
clever logs
# View logs from last hour
clever logs --since 1h
# View logs before a specific time
clever logs --before 2024-01-15T10:00:00
# Filter by deployment
clever logs --deployment-id <id>
# Access logs (HTTP requests)
clever accesslogs
clever accesslogs --since 1h
环境变量
# List all environment variables
clever env
# Set a variable
clever env set MY_VAR "my value"
# Set multiple variables
clever env set VAR1=value1 VAR2=value2
# Remove a variable
clever env rm MY_VAR
# Import from .env file
clever env import .env
# Export for shell
clever env --format shell > .env
域名
# List domains
clever domain
# Add a custom domain
clever domain add myapp.example.com
# Remove a domain
clever domain rm myapp.example.com
# Favorite domain (used in logs, URLs)
clever domain favorite set myapp.example.com
附加组件(数据库、存储等)
# List your add-ons
clever addon
# List available add-on providers
clever addon providers
# Create a PostgreSQL database
clever addon create postgresql-addon mydb --plan dev
# Create Redis
clever addon create redis-addon myredis --plan s_mono
# Create S3-compatible storage (Cellar)
clever addon create cellar-addon mybucket
# Delete an add-on
clever addon delete <addon-id>
# Get add-on environment variables
clever addon env <addon-id>
服务(Keycloak、Matomo 等托管服务)
# Link add-on to application
clever service link-addon <addon-id>
# Unlink add-on
clever service unlink-addon <addon-id>
扩缩容
# View current scaling
clever scale
# Set instance size (flavor)
clever scale --flavor M
# Set number of instances
clever scale --instances 2
# Autoscaling
clever scale --min-instances 1 --max-instances 4
SSH 访问
# SSH into running instance
clever ssh
# Run a command
clever ssh --command "ls -la"
应用管理
# List all applications in organization
clever applications list
# List linked applications in current directory
clever applications
# Create new application
clever create --type <type> <name>
# Types: node, python, ruby, php, java, go, rust, docker, static...
# Delete application
clever delete
常用全局选项
这些选项适用于大多数命令:
--app <app-id|name> # Target specific app (when multiple linked)
--alias <alias> # Use app alias (from clever link --alias)
--org <org-id|name> # Target specific organization
-F, --format <format> # Output format: human, json, json-stream, shell
-y, --yes # Skip confirmation prompts
JSON 输出有助于编写脚本:
clever env --format json | jq '.MY_VAR'
clever applications list --format json
完整参考
如需查看所有命令、选项、可用运行时、附加组件提供商和部署区域的完整文档,请参阅 references/full-documentation.md。
评论
支持 Markdown