GTC CLI 概览
GTC CLI(gtc)是 Greentic 平台的主要命令行界面。它提供以下命令:
- 创建和管理 bundles
- 设置 providers
- 运行 runtime 服务器
- 构建并验证 packs/flows
cargo install greentic-cligit clone https://github.com/greenticai/greentic.gitcd greentic/greenticcargo build --releaseexport PATH="$PATH:$(pwd)/target/release"验证安装:
gtc --versionCLI 架构
Section titled “CLI 架构”gtc 二进制文件会组合来自多个 repo 的子命令:
| 命令 | 来源 Repo | 用途 |
|---|---|---|
gtc wizard | greentic-dev | Bundle 创建向导 |
gtc setup | greentic-setup | Provider 设置/配置 |
gtc start | greentic-start | Runtime 服务器 |
gtc pack | greentic-pack | Pack 构建 |
gtc flow | greentic-flow | Flow 验证 |
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 服务器 |
pack | Pack 管理(构建、验证、发布) |
flow | Flow 管理(validate、doctor) |
创建并运行一个新项目
Section titled “创建并运行一个新项目”# 1. Create bundle from wizardgtc wizard --answers wizard-answers.yaml
# 2. Setup providers (interactive)gtc setup ./my-bundle
# 3. Start the runtimegtc start ./my-bundle# Validate flowsgtc flow doctor ./my-bundle/apps/my-app/flows/
# Build a packgtc pack build ./my-pack/
# Start with verbose logginggtc start ./my-bundle --verbose
# Start with ngrok tunnelgtc start ./my-bundle --ngrok on# Setup with answers file (non-interactive)gtc setup --answers production-answers.json ./my-bundle
# Start without tunnelsgtc start ./my-bundle --cloudflared off --ngrok offGTC 可以使用配置文件(greentic.toml):
[runtime]host = "0.0.0.0"port = 8080
[nats]enabled = trueurl = "nats://localhost:4222"
[logging]level = "info"format = "json"
[telemetry]enabled = trueotlp_endpoint = "http://localhost:4317"| 变量 | 说明 | 默认值 |
|---|---|---|
GREENTIC_LOG_LEVEL | 日志详细程度 | info |
GREENTIC_CONFIG | 配置文件路径 | greentic.toml |
GREENTIC_NATS_URL | NATS 服务器 URL | nats://localhost:4222 |
GREENTIC_REDIS_URL | Redis URL | redis://localhost:6379 |
| 代码 | 含义 |
|---|---|
0 | 成功 |
1 | 通用错误 |
2 | 配置错误 |
3 | Runtime 错误 |
4 | 验证错误 |
# General helpgtc --help
# Command-specific helpgtc wizard --helpgtc setup --helpgtc start --help- gtc wizard - 创建 bundle
- gtc setup - 设置 provider
- gtc start - Runtime 服务器
- Building Packs - Pack 管理