stali-cli
v3.45.1
Published
Interactive CLI tool and configuration manager for Stali API (https://api.stali.vn)
Maintainers
Readme
stali-cli 🚀
Công cụ dòng lệnh (CLI) tương tác và trình quản lý cấu hình cho Stali API (https://api.stali.vn), xây dựng bằng TypeScript, Bun và React trong Terminal (Ink) với validation an toàn bằng Zod.
⚡ Quickstart (user — ~30 giây)
npm install -g stali-cli@latest
# Cách nhanh nhất — một lệnh (auth + gateway + check)
stali -k sk-stali-xxxxxxxx
# hoặc
stali setup -k sk-stali-xxxxxxxx # stali onboard = tương đương
stali setup -k sk-stali-... --json # schemaVersion: 2 + pendingGateway
# Kiểm tra
stali status # hoặc: stali ready / stali check
stali user # hướng dẫn lệnh user
stali help advanced # toàn bộ lệnh (configure, plugins, …)
stali info --json # xem setup.ready + nextCommandLấy API key: api.stali.vn/dashboard/keys
Hướng dẫn đầy đủ (một trang): docs/ONBOARDING.md — setup, doctor strict, git pre-commit mẫu.
✨ Tính năng
- 🎨 Giao diện Terminal (Ink): wizard 5 bước, menu mũi tên, spinner
- 🔑 Quản lý token:
~/.stali/config.json(chmod 0600), validate prefixsk-stali- - 📊 Bảng giá realtime:
GET /v1/modelsvới Zod - 🔌 13 công cụ AI — wizard +
stali configure <tool>:- Claude Code, Codex CLI, OpenClaw, DeepSeek TUI, Qwen Code
- OpenCode, Kilo Code, Droid CLI, Cline, Roo Code
- Grok Build, Cowork, jcode
- 🛡️ Backup timestamp:
<file>.YYYYMMDD_HHmmss.bak+stali restore - 🩺 Doctor:
stali doctor— quét 13 tool với parser schema (không chỉ heuristic) - 🌐 Gateway:
stali scan/stali gw— quét app đang dùng và cài Stali API gateway - 📋 Tools:
stali tools— liệt kê 13 công cụ + đường dẫn config - ⚙️ Batch:
stali configure-all— cấu hình hàng loạt (dry-run, filter tool) - 🐾 OpenClaw menu: wizard riêng với status live
- ⌨️ Completion:
stali completion bash|zsh|fish - 📤 Export:
stali export-env <tool>— copy env thủ công - 🩺 Doctor fix:
stali doctor --fix— sửa tool chưa trỏ Stali - 🧩 VS Code menu: Cline / Roo / Kilo wizard riêng
- 📄 TOML menu: DeepSeek / Grok / jcode wizard riêng
- 🟢 OpenCode menu: wizard provider JSON riêng
- 🗑️ Uninstall:
stali uninstallgỡ wrapper an toàn - 🔧 Wizard fix-all: sửa hàng loạt từ menu chính / doctor
- 🔑 Auth:
stali auth login|status|logout - 📋 Info:
stali info --json - 🔗 Open:
stali open keys· Guide:stali guide onboarding·stali guide cursor - ⚙️ Wizard configure-all: batch 11/13 tool từ menu chính
- 🟣 13/13 menu riêng: Qwen, Droid, Cowork — không còn generic fallback
- 🚀 Setup:
stali setup -k sk-stali-...hoặc chỉstali -k sk-stali-...— lệnh khuyến nghị - 🚀 Init:
stali init— đầy đủ hơn (completion, version check) - 🔌 Plugins:
stali plugins list|sync— registry~/.stali/plugins.json+ syncer tự động - 🌐 Custom API:
stali config set base-url <url>— staging/self-hosted - 🌐 i18n:
--lang vi|enhoặcSTALI_LANG - 🔔 Doctor notify:
stali doctor --watch --notify— cảnh báo khi cấu hình đổi - 📦 v3.28:
stali setup— lệnh user nhanh nhất - 📦 v3.27:
telemetry flush, init gateway auto fix - 📦 v3.26:
gw --yes, telemetry retry queue - 📦 v3.21:
gateway auto, discovery process/app markers, info online nhanh hơn - 📦 v3.20: wizard gateway menu + plan, info offline flag, bench gateway plan
- 📦 v3.19:
gateway plan, shell completion bench/telemetry, plugin scan parallel - 📦 v3.18: info offline fast (~136ms), gateway install JSON, telemetry opt-in
- 📦 v3.14: Windows Task Scheduler auto-update, wizard install menu, npm registry publish
- 📦 v3.13:
stali install,update --json, npm pack verify, install auto default - 📦 v3.12: npm fast install (Node), install.ps1, update dry-run, metrics-bind, systemd timer
- 📦 v3.11: wizard completion, info installMode, metrics HTTP, auto-update cron, win standalone
- 📦 v3.10: install mode detect, standalone update, multi-platform binary, doctor --prometheus
- 📦 v3.9: GitHub Release assets, doctor watch CI, standalone install, completion install fix
- 📦 v3.8: wizard-only chunks, completion install --all, doctor watch exit code, GitHub Release tags
- 📦 v3.7: shared runtime dedupe, completion doctor, update --channel, bin/stali wrapper
- 📦 v3.6: dual dist + checksums, completion uninstall, doctor --ids/--watch scoped
- 📦 v3.5:
doctor --fixscoped,completion install, wizard bundle tách subcommand - 📦 v3.4: zsh completion đầy đủ, CI docs, e2e check scope/conflict
- 📦 v3.3:
check --tools-only/--plugins-only,stali wizard, multi-entry build - 📦 v3.2:
doctor --tools-only, dual-entry CLI/wizard, gỡ forwardplugins doctor --json - 📦 v3.1:
doctor --plugins-only, lazy-load subcommands - 📦 v3.0: wizard doctor thống nhất, gỡ devtools bundle (~-750KB)
- 📦 v2.7: auto-include plugins,
--no-plugins, plugins doctor deprecated, CI npm publish - 📦 v2.6: lazy-load wizard,
init --include-plugins, doctor JSON thống nhất (tools+plugins), cold-start ~80ms - 📦 v2.4:
doctor --jsonmeta endpoints, commands/ modular, 91 tests
🚀 Cài đặt
# Nhanh nhất — npm global (prebuilt dist, ~0 transitive deps, chỉ cần Node >= 18)
npm install -g stali-cli
# hoặc tắt fund/audit của npm CLI:
npm install -g stali-cli --no-fund --no-audit
bash scripts/npm-install-global.sh
# curl installer (git source / standalone / npm auto)
curl -fsSL https://api.stali.vn/install/stali-cli.sh | bash
STALI_CLI_INSTALL_METHOD=npm bash scripts/install.sh # npm only
# Windows standalone (PowerShell)
$env:STALI_CLI_VERSION = "v3.12.0"; irm .../scripts/install.ps1 | iex
# Dev từ source (cần Bun để build)
git clone https://github.com/ngocvu/stali-cli.git && cd stali-cli && bun install && bun run build📁 Cấu trúc thư mục (~/.stali)
| Path | Mục đích |
|------|----------|
| ~/.stali/cli | Source + build stali-cli |
| ~/.stali/bin | Lệnh stali (wrapper, không nằm trong .bun) |
| ~/.stali/config.json | API key đã lưu (wizard) |
| ~/.bun | Chỉ Bun runtime |
stali paths # In đường dẫn trên máy bạnstali # Wizard tương tác
stali --models # Bảng giá model
stali ls -k sk-stali-... # Bảng giá với token
stali status --json # gateway.pendingGateway + pendingGatewayCount
stali doctor # human: Gateway chờ (app đã cài)
stali doctor --json # pendingGateway[], meta.schemaVersion: 2
stali doctor --strict # CI gate: exit 1 nếu còn app/plugin chưa OK
stali plugins suggest # gợi ý patchStyle từ file config
stali plugins sync --preview --json
stali gw auto
stali scan # Quét app AI đang dùng (nhanh, user-first)
stali gateway scan # Tương đương scan
stali gateway auto -k sk-stali-... # Quét + cài gateway một lệnh
stali gateway install -k sk-stali-... # Cài gateway chỉ app đã phát hiện
stali gateway install --all -k sk-stali-... # Cài gateway cả 13 tool
stali paths # ~/.stali/cli, bin, config
stali tools # Liệt kê 13 công cụ + file config
stali update # Cập nhật từ GitHub
stali configure claude --dry-run -k sk-stali-... # Xem preview, không ghi file
stali configure-all --skip-advanced -k sk-stali-... # 11 tool (bỏ claude/codex)
stali configure-all --tools openclaw,cline -k sk-stali-...
stali export-env claude -k sk-stali-... # export ANTHROPIC_* (shell)
stali export-env codex -f json -k sk-stali-...
stali doctor --fix -k sk-stali-... # sửa tool chưa OK
stali doctor --fix --installed-only -k sk-stali-... # chỉ app đang dùng
stali configure-all --installed-only -k sk-stali-... # batch theo quét
stali init -k sk-stali-... # mặc định chỉ configure app phát hiện
stali doctor --json # JSON: meta + tools + plugins + pendingGateway
stali doctor --strict [--tools-only] # CI: exit 1 nếu còn gateway/plugin chưa OK
stali doctor --plugins-only [--json] # Chỉ plugin (~/.stali/plugins.json)
stali doctor --tools-only [--json] # Chỉ 13 tool (bỏ plugin)
stali config set base-url https://staging/v1 # custom endpoint
stali plugins suggest [--json] # Gợi ý patchStyle
stali plugins sync --preview [--json] # Preview trước khi ghi
stali plugins sync -k sk-stali-... # sync plugin tùy chỉnh
stali uninstall # Gỡ wrapper (~/.stali/bin)
stali auth login -k sk-stali-... # Lưu API key
stali auth status
stali info --json
stali open keys # Mở Dashboard tạo key
stali init -k sk-stali-... # Onboarding (auto sync plugin nếu plugins.json có entry)
stali init --no-plugins -k sk-stali-... # Chỉ tools, bỏ plugin
stali init --skip-configure -k sk-stali-... # Chỉ lưu key
stali plugins --init # Tạo ~/.stali/plugins.json mẫu
stali --lang en check # Thông báo tiếng Anh
stali config show
stali backups -t claude
stali check --strict # Auth + tất cả tool (và plugin nếu có)
stali check --tools-only --json # Chỉ tools
stali check --plugins-only # Chỉ plugin
stali wizard # Wizard Ink (hoặc: stali)
stali completion install # Cài completion (auto từ $SHELL)
stali completion install --all # Cài bash + fish + zsh
stali completion install fish # Cài fish completion
stali completion --doctor --json # Kiểm tra completion đã cài
stali completion --uninstall fish # Gỡ completion
stali update --channel beta --check
stali doctor --tools-only --watch --json # NDJSON stream
stali doctor --tools-only --fix # Sửa chỉ 13 tool
stali doctor --plugins-only --fix --ids my-agent # Sửa plugin cụ thể
stali doctor --tools-only --watch --max-cycles 2 -i 3 --json # CI smoke
stali doctor --watch --notify -i 10 # Theo dõi + cảnh báo desktop (exit 1 nếu configured giảm)
stali doctor --tools-only --watch --metrics-port 9090 -i 30 # Prometheus scrape
stali update --install-cron --channel stable # Cron 04:00 auto-update
stali update --cron-status
stali info --json # installMode + doctor summary
# Cài standalone theo platform (linux/darwin x64/arm64)
STALI_CLI_VERSION=v3.10.0 STALI_CLI_STANDALONE=1 bash scripts/install.sh
stali update --check # Có bản mới?
stali uninstall --purge-path # Windows: gỡ khỏi User PATH
stali restore -t claude # Khôi phục backup gần nhất
stali --reset # Xóa token ~/.staliCI / automation
# Gate deploy: auth + toàn bộ 13 tool (bỏ plugin nếu chưa dùng)
stali check --strict --tools-only --json
# Gate plugin sync (plugins.json phải có entry và đã trỏ Stali)
stali check --strict --plugins-only --json
# Diagnostic đầy đủ (tools + plugins + meta)
stali doctor --jsonExit code: 0 = pass, 1 = fail health, 2 = lỗi CLI (vd. cờ xung đột).
🛠️ Phát triển
bun install
bun run typecheck
bun test
bun run build
bun run src/index.ts📄 License
MIT © Stali API
