VIETFUEL_API_URL
Ghi đè địa chỉ API đích. Mặc định tự dò: localhost:8787 → localhost:3000 → production.
Override target API base URL. Defaults to probing localhost:8787 → localhost:3000 → production.
Tra cứu giá xăng dầu Việt Nam từ 12 đầu mối & 63 tỉnh thành cũ (34 sau sáp nhập) ngay trên dòng lệnh. Hỗ trợ menu tương tác tiếng Việt/Anh, bảng Unicode tự co giãn và cờ --json cho script.
Tất cả lệnh con, cờ toàn cục và biến môi trường được hỗ trợ trong cli/index.ts.
| Lệnh / Menu | Command / Menu | Tùy chọn đi kèm | Flags | Mô tả | Description |
|---|---|---|---|---|---|
vietfuel npm |
--lang vi|en, --url, --version |
Mở menu tương tác đánh số (1–7), có bộ chọn tìm kiếm đầu mối & tỉnh thành. (Hoặc npm run cli trong repo).
Launch interactive numbered menu (1–7) with searchable distributor & province pickers. (Or npm run cli inside the repo).
|
|||
prices 1 |
--zone both|1|2, --json |
So sánh giá bán lẻ từ cả 12 nguồn, tự chia nhóm cột vừa độ rộng terminal. Compare retail prices across all 12 sources, auto-chunked to terminal width. | |||
source <id> 2 |
--json |
Xem chi tiết giá của 1 đầu mối (petrolimex, pvoil, luatvietnam…).
Inspect prices for one distributor (petrolimex, pvoil, luatvietnam…).
|
|||
province <slug> 3 |
--json |
Tra cứu giá bán lẻ tại một trong 63 tỉnh thành cũ (ha-noi, ho-chi-minh…).
Look up retail prices for any of the 63 legacy provinces (ha-noi, ho-chi-minh…).
|
|||
provinces 4 |
--region 1|2, --q <text> |
Liệt kê 63 tỉnh thành cũ (34 sau sáp nhập) kèm mã slug và phân vùng V1/V2. List all 63 legacy provinces (34 post-merger) with slugs and V1/V2 zone tags. | |||
history 5 |
--fuel, --source, --from, --to, --limit |
Truy vấn lịch sử giá 90 ngày từ Cloudflare D1 / SQLite theo bộ lọc. Query 90-day price history from Cloudflare D1 / SQLite with filters. | |||
health 6 |
--json |
Kiểm tra tình trạng hệ thống, storage đang dùng và TTL cache của 12 nguồn. Inspect API health, active storage backends, and per-source cache TTLs. | |||
scrape [source] 7 |
--token, clear-cache |
Kích hoạt cào mới ngay hoặc xóa cache KV (cần ADMIN_TOKEN ở production).
Trigger immediate scraping or clear KV cache (requires ADMIN_TOKEN in production).
|
VIETFUEL_API_URLGhi đè địa chỉ API đích. Mặc định tự dò: localhost:8787 → localhost:3000 → production.
Override target API base URL. Defaults to probing localhost:8787 → localhost:3000 → production.
VIETFUEL_LANGNgôn ngữ giao diện CLI: vi (mặc định) hoặc en. Có thể ghi đè qua --lang en.
CLI language: vi (default) or en. Override per command with --lang en.
ADMIN_TOKENBearer token cho lệnh quản trị ở production. Ở local Wrangler (npm run dev), endpoint quản trị được mở sẵn.
Bearer token for admin commands in production. Local Wrangler dev (npm run dev) allows admin calls without a token.