conso-cli
v0.1.3
Published
Console Platform CLI — query projects, pipelines, services, resources and more
Downloads
281
Readme
conso-cli
Console Platform CLI — query and manage projects, pipelines, services, resources and more
Quick Start
# Login
npx conso-cli login --garage <token> --fdc <token> --default <token>
# Query
npx conso-cli services
npx conso-cli pods -e production
npx conso-cli resources
# Write (with confirmation)
npx conso-cli env-set FOO=bar -e testing
npx conso-cli fdc publish my-config @config.json -e onlineFeatures
- 30+ commands — pipelines, deploys, logs, services, pods, env vars, FDC configs, resources, alerts, jobs, and more
- Multi-token auth — separate tokens for infra-garage, fdc-console, with automatic routing
- Safety first — write operations require confirmation; production env requires typing "yes"
- Project guard — switching project on write ops triggers explicit confirmation
- Flexible output — JSON (default), table, or JSONL format for all read commands
- Agent-friendly —
--yesflag for non-interactive automation, JSON output for parsing
Installation
Requirements: Node.js >= 22.0.0
npx conso-cli <command> # Use directly via npx
npm install -g conso-cli # Or global installAuthentication
Get your API Tokens from Console:
- garage token —
console.zhenguanyu.com→ infra-garage → Settings → API Token - fdc token —
console.zhenguanyu.com→ fdc-console → Settings → API Token - default token — your project → Settings → API Token
Then configure:
# Option 1: login command (saved to ~/.conso-cli/config.json)
conso-cli login --garage <token> --fdc <token> --default <token>
# Option 2: environment variables
export CONSOLE_TOKEN_GARAGE=<token>
export CONSOLE_TOKEN_FDC=<token>
export CONSOLE_TOKEN_DEFAULT=<token>
# Set default project (default: rush-app)
export CONSOLE_PROJECT=my-project
# Optional: Jenkins consoleText/status/stop APIs
export CONSOLE_LDAP=<ldap>
export CONSOLE_TOKEN=<jenkins-api-token>Commands
Query
| Command | Description |
|---------|-------------|
| whoami | Show current authenticated user |
| meta | Show project metadata |
| members | List project members |
| services | List project services and running status |
| pods | Show running pod instances |
| logs | Query service runtime logs from Console SLS |
| pod-logs <podName> | Show raw container logs from Plume/Kubernetes |
| pod-events <podName> | Show Kubernetes events for a pod |
| pod-describe <podName> | Show pod status plus Kubernetes events |
| urls | Print Console/Jenkins/Plume browser handoff URLs |
| health | Summarize service status, pods, and route information |
| ingress | Show service route / ingress configuration |
| replicas | Show service replica status |
| resources | List project resources (Redis, MySQL, MQ, OSS) |
| env-vars | List service environment variables |
| pipelines | List pipeline builds |
| pipeline-history | List deployment history |
| pipeline-status | Show pipeline stage status and Jenkins mapping |
| pipeline-log | Show pipeline deployment task logs or Jenkins build log |
| pipeline-settings | Show pipeline settings |
| deployments | Show current service deployments (piplinx) |
| events | List operation history |
| alerts | Show alert channel configuration |
| score | Show project quality score |
| governance | List service governance (RPC services) |
| jobs | List scheduled jobs |
| fdc list | List FDC configs |
| fdc get [name] | Get FDC config key-value pairs |
| fdc status | Show FDC config status summary |
Write (require confirmation)
| Command | Description |
|---------|-------------|
| env-set <KEY=VALUE...> | Set environment variable(s) on a service |
| env-del <keys...> | Delete environment variable(s) from a service |
| service-create <name> | Create a service by cloning metadata/env targets |
| service-delete <name> | Delete a service |
| pipeline-build | Trigger a Console pipeline build |
| pipeline-deploy <pipelineId> | Trigger a pipeline deployment |
| deploy <pipelineId> | Alias for pipeline-deploy |
| redeploy | Redeploy the current service deployment for a stage |
| pipeline-stop | Abort a Console deployment or stop a Jenkins build |
| deployment-abort <deploymentId> | Abort a Console/Saber deployment by ID |
| fdc create <name> <config> | Create a new FDC config |
| fdc publish <name> <config> | Update and publish an FDC config |
| exec <command> | Execute command in a pod via kubeshell |
| login | Configure API tokens |
Usage Examples
Services & Pods
conso-cli services # List all services
conso-cli services -o table # Table format
conso-cli pods -s my-service -e production # Production pods
conso-cli pods --all -e testing -o table # All project pods with service column
conso-cli replicas -s my-service -e testing # Replica status
conso-cli health -s my-service -e testing # Status + pods + route summary
conso-cli ingress -s my-service -e testing # Route / ingress config
conso-cli pod-logs my-pod -s my-service -e testing --tail 200
conso-cli pod-events my-pod -s my-service -e testing
conso-cli pod-describe my-pod -s my-service -e testing
conso-cli urls -p my-project -s my-service --pod my-pod --idc rz-b
conso-cli service-create my-service-worker -p my-project --from-service my-service
conso-cli service-create my-service-api -p my-project --envs testing,productionservice-create clones business env vars but strips Console-managed runtime
vars such as service registration/discovery switches from the new target.
Environment Variables
conso-cli env-vars -e testing # List env vars
conso-cli env-vars -s my-service -e production # Specific service
conso-cli env-set FOO=bar BAZ=qux -e testing # Set multiple vars
conso-cli env-del FOO BAZ -e testing # Delete varsPipelines & Deployments
conso-cli pipelines -n 5 # Last 5 builds
conso-cli pipelines -s my-service # Pipeline list + service deployment mapping
conso-cli pipeline-history -s my-service # Service deployment history
conso-cli pipeline-status 4570257 --stage build
conso-cli pipeline-log 4570257 --stage testing --tail 80 -o table
conso-cli urls -p my-project --pipeline 4570257 --stage build -o table
conso-cli deployments # Current service deploymentsBuild & Deploy
conso-cli pipeline-build -p my-project -b master
conso-cli pipeline-deploy 4570257 -p my-project --stage testing -s my-service
conso-cli redeploy -p my-project -s my-service --stage testing
conso-cli pipeline-stop -p my-project --stage testing --deployment-id 3659949
conso-cli deployment-abort 3659949 -p my-project --stage testingredeploy reuses the current pipeline candidate for a service/stage. After
changing service metadata or container target settings, verify whether Saber
requires its UI "重新部署" flow for those metadata changes to take effect.
Pipeline deployment logs and service runtime logs are separate:
conso-cli pipeline-log 4570257 --stage testing --tail 100 # deployment task logs
conso-cli logs -s my-service -e testing --minutes 15 # service runtime logs
conso-cli pod-logs my-pod -s my-service --tail 200 # raw K8s container logsSDK
import { ConsoleClient, JenkinsClient } from 'conso-cli/sdk';
const client = new ConsoleClient();
const status = await client.pipelineDetail(4989341, 'rush-agent-version');
const created = await client.createService({
project: 'template-nextjs-fullstack',
name: 'template-nextjs-fullstack-worker',
fromService: 'template-nextjs-fullstack',
envs: ['testing'],
});ConsoleClient can also be constructed with explicit tokens for server-side
apps:
const client = new ConsoleClient({
tokens: {
garage: process.env.CONSOLE_TOKEN_GARAGE,
fdc: process.env.CONSOLE_TOKEN_FDC,
default: process.env.CONSOLE_TOKEN_DEFAULT,
},
});Resources
conso-cli resources # Summary of all types
conso-cli resources -t redis # List Redis instances
conso-cli resources -t mysql # List MySQL instancesDynamic Config (FDC)
conso-cli fdc list # List all configs
conso-cli fdc get my-config # Get config KV pairs
conso-cli fdc create my-config '{"key":"val"}' -e test # Create config
conso-cli fdc publish my-config @config.json -e online # Publish from file
conso-cli fdc status # Config statusCross-project
conso-cli services -p other-project # Query another project (no confirmation)
conso-cli env-set FOO=bar -p other-project # Write to another project (requires confirmation)Common Options
| Option | Description |
|--------|-------------|
| -p, --project <name> | Target project (default: configured project or rush-app) |
| -e, --env <env> | Environment: production, testing (default varies by command) |
| -s, --service <name> | Service name (default: same as project) |
| -o, --output <fmt> | Output format: json, table, jsonl |
| -n, --limit <n> | Page size |
| -y, --yes | Skip confirmation (for automation) |
Safety
conso-cli operates on production infrastructure. Safety is enforced at multiple levels:
- Write confirmation — all write operations prompt for confirmation before executing
- Production guard — writing to production/online environments requires typing full "yes" (not just "y")
- Project switch guard — writing to a project different from your default triggers an extra confirmation
- Non-interactive block — write operations in piped/non-TTY mode are blocked unless
--yesis passed - Pipeline write guard — build, deploy, redeploy, abort, and Jenkins stop commands require confirmation
- Dangerous command detection —
execalways requires confirmation
License
MIT
