Ikhtisar GTC CLI
Pendahuluan
Section titled “Pendahuluan”GTC CLI (gtc) adalah antarmuka baris perintah utama untuk platform Greentic. CLI ini menyediakan perintah untuk:
- Membuat dan mengelola bundle
- Menyiapkan provider
- Menjalankan server runtime
- Membangun dan memvalidasi pack/flow
Instalasi
Section titled “Instalasi”cargo install greentic-cligit clone https://github.com/greenticai/greentic.gitcd greentic/greenticcargo build --releaseexport PATH="$PATH:$(pwd)/target/release"Verifikasi instalasi:
gtc --versionArsitektur CLI
Section titled “Arsitektur CLI”Binary gtc menyusun subcommand dari beberapa repo:
| Perintah | Repo Sumber | Tujuan |
|---|---|---|
gtc wizard | greentic-dev | Wizard pembuatan bundle |
gtc setup | greentic-setup | Setup/konfigurasi provider |
gtc start | greentic-start | Server runtime |
gtc pack | greentic-pack | Pembangunan pack |
gtc flow | greentic-flow | Validasi flow |
Referensi Perintah
Section titled “Referensi Perintah”Opsi Global
Section titled “Opsi Global”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 versionPerintah
Section titled “Perintah”| Perintah | Deskripsi |
|---|---|
wizard | Membuat bundle baru dari jawaban wizard |
setup | Mengonfigurasi provider di dalam bundle |
start | Menjalankan server runtime |
pack | Manajemen pack (build, verify, publish) |
flow | Manajemen flow (validate, doctor) |
Alur Kerja yang Umum
Section titled “Alur Kerja yang Umum”Membuat dan Menjalankan Proyek Baru
Section titled “Membuat dan Menjalankan Proyek Baru”# 1. Create bundle from wizardgtc wizard --answers wizard-answers.yaml
# 2. Setup providers (interactive)gtc setup ./my-bundle
# 3. Start the runtimegtc start ./my-bundleAlur Kerja Pengembangan
Section titled “Alur Kerja Pengembangan”# 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 onDeployment Produksi
Section titled “Deployment Produksi”# Setup with answers file (non-interactive)gtc setup --answers production-answers.json ./my-bundle
# Start without tunnelsgtc start ./my-bundle --cloudflared off --ngrok offFile Konfigurasi
Section titled “File Konfigurasi”GTC dapat menggunakan file konfigurasi (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"Variabel Lingkungan
Section titled “Variabel Lingkungan”| Variabel | Deskripsi | Default |
|---|---|---|
GREENTIC_LOG_LEVEL | Verbositas log | info |
GREENTIC_CONFIG | Path file konfigurasi | greentic.toml |
GREENTIC_NATS_URL | URL server NATS | nats://localhost:4222 |
GREENTIC_REDIS_URL | URL Redis | redis://localhost:6379 |
Exit Code
Section titled “Exit Code”| Kode | Arti |
|---|---|
0 | Berhasil |
1 | Kesalahan umum |
2 | Kesalahan konfigurasi |
3 | Kesalahan runtime |
4 | Kesalahan validasi |
Mendapatkan Bantuan
Section titled “Mendapatkan Bantuan”# General helpgtc --help
# Command-specific helpgtc wizard --helpgtc setup --helpgtc start --helpLangkah Berikutnya
Section titled “Langkah Berikutnya”- gtc wizard - Pembuatan bundle
- gtc setup - Setup provider
- gtc start - Server runtime
- Membangun Pack - Manajemen pack