Dokumen ini menjelaskan semua fitur yang tersedia di OpsTerm, lengkap dengan contoh penggunaan dan penjelasan.
| # | Fitur | CLI Command | Kategori |
|---|---|---|---|
| 1 | ๐ค AI Chat | ai <prompt> |
Core |
| 2 | ๐ Smart SSH | ai ssh <server> |
Core |
| 3 | ๐ Multi-hop SSH | ai ssh <srv> --via <proxy> |
Core |
| 4 | ๐ SCP File Transfer | ai scp <src> <dst> |
Core |
| 5 | โก Workflow | ai run <name> |
Core |
| 6 | ๐ Vault | ai vault |
Core |
| 7 | ๐ Pipe Mode | cmd \| ai <prompt> |
Core |
| 8 | ๐ป Shell Integration | ai explain-last |
Shell |
| 9 | โจ๏ธ Tab Completion | ai completion bash\|zsh |
Utility |
| 10 | ๐ ๏ธ Server Manager | ai servers |
Management |
| 11 | ๐ Workflow Manager | ai workflows |
Management |
| 12 | โ๏ธ Config Manager | ai config |
Management |
| 13 | ๐ History | ai history |
Management |
| 14 | ๐ Init | ai init |
Setup |
Bertanya apa pun ke AI langsung dari terminal.
# Minta command shell
ai cari file log lebih dari 1GB
# Output: $ find /var/log -type f -size +1G
# Minta penjelasan
ai explain apa itu reverse proxy
# Generate docker compose
ai buat docker compose untuk nginx + postgres
# Tanya general
ai how to check disk usage in linux
Cara kerja:
1. Load config (API key, model, URL dari config.yaml)
2. Build prompt + system message
3. HTTP POST ke AI provider (OpenAI-compatible API)
4. Parse response JSON
5. Print ke terminal
6. Simpan ke history (SQLite)
7. Deteksi $ prefix โ offer auto-exec
Provider support: DeepSeek, OpenAI, OpenRouter, Ollama, vLLM, atau apapun yang OpenAI-compatible.
SSH ke server tanpa perlu hafal IP address.
# Langsung connect
ai ssh vps-utama
# Fuzzy match โ cukup sebagian nama
ai ssh vps
# Lihat daftar server dulu
ai servers list
Konfigurasi server di ~/.ai-workflows/servers.yaml:
servers:
vps-utama:
host: "43.157.204.199"
user: "ubuntu"
port: 22
key: "~/.ssh/id_ed25519"
desc: "Tencent Cloud VPS utama"
Yang bisa di-configure:
- host โ IP atau domain
- user โ SSH username
- port โ port SSH (default: 22)
- key โ path ke private key
- proxy โ jump host (lihat fitur multi-hop)
- desc โ deskripsi
SSH ke server internal yang cuma bisa diakses lewat jump host/bastion.
# Via CLI (per-call)
ai ssh internal-server --via bastion
# Via config (permanen)
ai ssh internal-server # otomatis lewat bastion
Config permanen di servers.yaml:
servers:
bastion:
host: "123.123.123.123"
user: "ubuntu"
key: "~/.ssh/id_ed25519"
internal-server:
host: "10.0.0.5"
user: "ubuntu"
key: "~/.ssh/internal-key"
proxy: "bastion" # <-- otomatis lewat bastion
Cara kerja:
- Pake SSH -J (ProxyJump) flag
- Chain bisa panjang: ssh -J jump1,jump2 server
- Proxy server di-resolve dari servers.yaml juga
Upload/download file antara lokal dan server โ pakai syntax server:path.
# Upload dari lokal ke server
ai scp ./config.yaml vps-utama:/home/ubuntu/
# Download dari server ke lokal
ai scp vps-utama:logs/app.log .
# Lewat jump host
ai scp file.txt internal-server:/tmp/ --via bastion
Cara kerja:
- Parse server:path โ resolve ke user@host:path
- Sama kaya SSH: support proxy jump, key file, custom port
- Pake scp system command via subprocess
Multi-step automation yang jalanin beberapa command secara berurutan.
# Jalanin workflow
ai run deploy-app
# Lihat daftar workflow
ai workflows list
Contoh workflow:
workflows:
deploy-full:
desc: "Full deployment dengan file transfer"
steps:
- scp: "./docker-compose.yml"
to: "/home/ubuntu/app/docker-compose.yml"
ssh: vps-utama
desc: "Upload compose file"
- ssh: vps-utama
command: "cd /home/ubuntu/app && docker compose pull && docker compose up -d"
desc: "Pull images & restart"
- command: "echo 'โ
Deploy selesai!'"
desc: "Notifikasi"
Step types:
| Type | Format | Fungsi |
|------|--------|--------|
| ssh | ssh: <server> + command: | Jalanin command di server remote |
| scp | scp: <src> + to: <dst> + ssh: <server> | Transfer file ke server |
| command | command: | Jalanin command lokal |
| confirm | confirm: true | Minta konfirmasi user sebelum lanjut |
| wait | wait: <detik> | Tunggu beberapa detik |
Nyimpen credentials (API key, password, token) secara terenkripsi.
# Init vault (set master password)
ai vault init
# Simpan credential
ai vault set db_password "supersecret"
ai vault set github_token "ghp_..."
# Ambil credential
ai vault get db_password # Output: supersecret
# List keys
ai vault list
# Hapus key
ai vault rm db_password
# Kunci vault (clear password dari memory)
ai vault lock
Teknis:
- Encryption: AES-128-CBC via cryptography.fernet.Fernet
- Key derivation: PBKDF2-HMAC-SHA256, 600.000 iterasi
- Master password: dari OPSTERM_VAULT_PASSWORD env atau prompt
- Fallback: kalo cryptography gak terinstall โ HMAC + XOR (kurang aman)
- Data: encrypted JSON di ~/.ai-workflows/vault.json
Kirim output command ke AI untuk dianalisa.
# Explain output
kubectl get pods | ai "ada yang error?"
docker logs webapp --tail 100 | ai "analisa error ini"
free -h | ai "apakah memory cukup?"
netstat -tlnp | ai "port apa aja yang terbuka?"
# Pipe tanpa prompt spesifik
df -h | ai
# AI otomatis: "Jelaskan output ini"
Cara kerja:
1. Deteksi stdin (sys.stdin.isatty() == False)
2. Baca stdin โ simpen sebagai stdin_data
3. Build prompt: "Output dari command:\n\n{stdin_data}\n\nPertanyaan: {prompt}"
4. Kirim ke AI โ print response
Integrasi dengan Zsh shell untuk ngeliat & explain output command terakhir.
# Load di .zshrc
source ~/opsterm/zsh/opsterm.plugin.zsh
# Lihat output command terakhir
ai last
# Explain output command terakhir pake AI
ai explain-last
Fitur:
- ai-last โ alias ke ai last
- ai-explain โ alias ke ai explain-last
- ai-ti โ AI + Terminal Integration: tanya AI, extract command, auto-execute
Cara kerja:
- Zsh preexec hook โ simpen command sebelum jalan
- Output command terakhir disimpan di ~/.ai-workflows/last_output.txt
- ai explain-last โ baca file โ kirim ke AI
Auto-complete buat bash dan zsh โ ga perlu hafal nama server/workflow.
# Bash
source <(ai completion bash)
# Zsh
source <(ai completion zsh)
# Atau permanen:
echo 'source <(ai completion bash)' >> ~/.bashrc
echo 'source <(ai completion zsh)' >> ~/.zshrc
Yang bisa di-complete:
| Context | Completion |
|---------|-----------|
| ai [Tab] | Semua subcommand |
| ai ssh [Tab] | Nama server |
| ai run [Tab] | Nama workflow |
| ai scp [Tab] | server: prefix |
| ai servers [Tab] | add, edit, rm, list |
| ai vault [Tab] | init, set, get, list, rm, lock |
| ai --via [Tab] | Nama proxy server |
CRUD untuk server โ simpan, edit, hapus konfigurasi server.
# Lihat semua server (dengan kolom PROXY)
ai servers list
# Output:
# NAMA HOST USER PORT PROXY DESKRIPSI
# vps-utama 43.157.204.199 ubuntu 22 โ Tencent Cloud VPS
# Tambah server baru (interaktif)
ai servers add
# Edit server
ai servers edit vps-utama
# Hapus server
ai servers rm vps-utama
Data disimpan di ~/.ai-workflows/servers.yaml.
CRUD untuk workflow โ simpan, edit, hapus workflow.
# Lihat semua workflow
ai workflows list
# Tambah workflow baru (interaktif)
ai workflows add
# Edit workflow (buka editor)
ai workflows edit deploy-app
# Hapus workflow
ai workflows rm deploy-app
Data disimpan di ~/.ai-workflows/workflows.yaml.
Lihat dan set konfigurasi OpsTerm.
# Lihat semua config
ai config list
# Set nilai
ai config set ai.model deepseek-chat
ai config set ai.api_url https://api.deepseek.com/v1/chat/completions
ai config set ai.temperature 0.3
ai config set shell.confirm_before_exec true
# Get nilai spesifik
ai config get ai.model
Data disimpan di ~/.ai-workflows/config.yaml.
Riwayat semua command yang pernah dijalanin.
# Lihat 20 riwayat terakhir
ai history
# Lihat 50 riwayat terakhir
ai history 50
Output:
[1] ๐ค 2026-05-24 15:30 [ai] how to check disk usage
[2] ๐ 2026-05-24 15:35 [ssh] vps-utama
[3] โก 2026-05-24 15:40 [workflow] deploy-app
[4] ๐ 2026-05-24 15:45 [pipe] docker ps | ai error
Ikon mode:
| Ikon | Mode |
|------|------|
| ๐ค | AI chat |
| ๐ | SSH |
| โก | Workflow |
| ๐ | Pipe mode |
| ๐ป | Shell command |
| ๐ | SCP transfer |
| ๐ | Vault |
Data disimpan di SQLite: ~/.ai-workflows/history.db.
Setup awal โ bikin file konfigurasi default.
ai init
Yang dibuat:
- ~/.ai-workflows/config.yaml โ template AI provider
- ~/.ai-workflows/servers.yaml โ contoh server
- ~/.ai-workflows/workflows.yaml โ contoh workflow
| Yang Mau Dilakuin | Command |
|---|---|
| SSH ke server | ai ssh vps-utama |
| SSH lewat bastion | ai ssh internal --via bastion |
| Upload file | ai scp file.txt server:/path/ |
| Download file | ai scp server:log.txt . |
| Deploy app | ai run deploy-app |
| Cek server health | ai run cek-server |
| Tanya command | ai how to check disk |
| Explain error | docker logs -n50 \| ai "error?" |
| Explain last command | ai explain-last |
| Simpan password | ai vault set db_pass |
| Ambil password | ai vault get db_pass |
| Auto-complete | ai [Tab] |
| Lihat riwayat | ai history |
| Setup dari awal | ai init |
ai exec <container> langsung masuk container~/.ssh/configai ssh server --via jump1,jump2