跳转到内容

GTC CLI 概览

GTC CLIgtc)是 Greentic 平台的主要命令行界面。它提供以下命令:

  • 创建和管理 bundles
  • 设置 providers
  • 运行 runtime 服务器
  • 构建并验证 packs/flows
Terminal window
cargo install greentic-cli

验证安装:

Terminal window
gtc --version

gtc 二进制文件会组合来自多个 repo 的子命令:

命令来源 Repo用途
gtc wizardgreentic-devBundle 创建向导
gtc setupgreentic-setupProvider 设置/配置
gtc startgreentic-startRuntime 服务器
gtc packgreentic-packPack 构建
gtc flowgreentic-flowFlow 验证
Terminal window
gtc [OPTIONS] <COMMAND>
Options:
-v, --verbose Enable verbose output
-q, --quiet Suppress non-essential output
--config <PATH> Path to config file
-h, --help Print help
-V, --version Print version
命令说明
wizard根据向导答案创建新的 bundle
setup配置 bundle 中的 providers
start启动 runtime 服务器
packPack 管理(构建、验证、发布)
flowFlow 管理(validate、doctor)
Terminal window
# 1. Create bundle from wizard
gtc wizard --answers wizard-answers.yaml
# 2. Setup providers (interactive)
gtc setup ./my-bundle
# 3. Start the runtime
gtc start ./my-bundle
Terminal window
# Validate flows
gtc flow doctor ./my-bundle/apps/my-app/flows/
# Build a pack
gtc pack build ./my-pack/
# Start with verbose logging
gtc start ./my-bundle --verbose
# Start with ngrok tunnel
gtc start ./my-bundle --ngrok on
Terminal window
# Setup with answers file (non-interactive)
gtc setup --answers production-answers.json ./my-bundle
# Start without tunnels
gtc start ./my-bundle --cloudflared off --ngrok off

GTC 可以使用配置文件(greentic.toml):

greentic.toml
[runtime]
host = "0.0.0.0"
port = 8080
[nats]
enabled = true
url = "nats://localhost:4222"
[logging]
level = "info"
format = "json"
[telemetry]
enabled = true
otlp_endpoint = "http://localhost:4317"
变量说明默认值
GREENTIC_LOG_LEVEL日志详细程度info
GREENTIC_CONFIG配置文件路径greentic.toml
GREENTIC_NATS_URLNATS 服务器 URLnats://localhost:4222
GREENTIC_REDIS_URLRedis URLredis://localhost:6379
代码含义
0成功
1通用错误
2配置错误
3Runtime 错误
4验证错误
Terminal window
# General help
gtc --help
# Command-specific help
gtc wizard --help
gtc setup --help
gtc start --help