@newpeak/barista-cli 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +53 -10
- package/README.ja.md +53 -10
- package/README.md +148 -34
- package/README.vi.md +53 -10
- package/dist/commands/arabica/access/index.d.ts +3 -0
- package/dist/commands/arabica/access/index.d.ts.map +1 -0
- package/dist/commands/arabica/access/index.js +15 -0
- package/dist/commands/arabica/access/index.js.map +1 -0
- package/dist/commands/arabica/access/url.d.ts +3 -0
- package/dist/commands/arabica/access/url.d.ts.map +1 -0
- package/dist/commands/arabica/access/url.js +101 -0
- package/dist/commands/arabica/access/url.js.map +1 -0
- package/dist/commands/arabica/auth/index.d.ts.map +1 -1
- package/dist/commands/arabica/auth/index.js +24 -5
- package/dist/commands/arabica/auth/index.js.map +1 -1
- package/dist/commands/arabica/enterprise/get.d.ts +3 -0
- package/dist/commands/arabica/enterprise/get.d.ts.map +1 -0
- package/dist/commands/arabica/enterprise/get.js +94 -0
- package/dist/commands/arabica/enterprise/get.js.map +1 -0
- package/dist/commands/arabica/enterprise/index.d.ts +3 -0
- package/dist/commands/arabica/enterprise/index.d.ts.map +1 -0
- package/dist/commands/arabica/enterprise/index.js +18 -0
- package/dist/commands/arabica/enterprise/index.js.map +1 -0
- package/dist/commands/arabica/enterprise/list.d.ts +3 -0
- package/dist/commands/arabica/enterprise/list.d.ts.map +1 -0
- package/dist/commands/arabica/enterprise/list.js +71 -0
- package/dist/commands/arabica/enterprise/list.js.map +1 -0
- package/dist/commands/arabica/enterprises/delete.d.ts +3 -0
- package/dist/commands/arabica/enterprises/delete.d.ts.map +1 -0
- package/dist/commands/arabica/enterprises/delete.js +89 -0
- package/dist/commands/arabica/enterprises/delete.js.map +1 -0
- package/dist/commands/arabica/enterprises/get.d.ts +3 -0
- package/dist/commands/arabica/enterprises/get.d.ts.map +1 -0
- package/dist/commands/arabica/enterprises/get.js +103 -0
- package/dist/commands/arabica/enterprises/get.js.map +1 -0
- package/dist/commands/arabica/enterprises/index.d.ts +3 -0
- package/dist/commands/arabica/enterprises/index.d.ts.map +1 -0
- package/dist/commands/arabica/enterprises/index.js +27 -0
- package/dist/commands/arabica/enterprises/index.js.map +1 -0
- package/dist/commands/arabica/enterprises/list.d.ts +3 -0
- package/dist/commands/arabica/enterprises/list.d.ts.map +1 -0
- package/dist/commands/arabica/enterprises/list.js +84 -0
- package/dist/commands/arabica/enterprises/list.js.map +1 -0
- package/dist/commands/arabica/enterprises/register.d.ts +3 -0
- package/dist/commands/arabica/enterprises/register.d.ts.map +1 -0
- package/dist/commands/arabica/enterprises/register.js +175 -0
- package/dist/commands/arabica/enterprises/register.js.map +1 -0
- package/dist/commands/arabica/enterprises/update.d.ts +3 -0
- package/dist/commands/arabica/enterprises/update.d.ts.map +1 -0
- package/dist/commands/arabica/enterprises/update.js +130 -0
- package/dist/commands/arabica/enterprises/update.js.map +1 -0
- package/dist/commands/arabica/index.d.ts.map +1 -1
- package/dist/commands/arabica/index.js +17 -4
- package/dist/commands/arabica/index.js.map +1 -1
- package/dist/commands/arabica/invoices/download.d.ts +3 -0
- package/dist/commands/arabica/invoices/download.d.ts.map +1 -0
- package/dist/commands/arabica/invoices/download.js +55 -0
- package/dist/commands/arabica/invoices/download.js.map +1 -0
- package/dist/commands/arabica/invoices/get.d.ts +3 -0
- package/dist/commands/arabica/invoices/get.d.ts.map +1 -0
- package/dist/commands/arabica/invoices/get.js +53 -0
- package/dist/commands/arabica/invoices/get.js.map +1 -0
- package/dist/commands/arabica/invoices/index.d.ts +3 -0
- package/dist/commands/arabica/invoices/index.d.ts.map +1 -0
- package/dist/commands/arabica/invoices/index.js +21 -0
- package/dist/commands/arabica/invoices/index.js.map +1 -0
- package/dist/commands/arabica/invoices/list.d.ts +3 -0
- package/dist/commands/arabica/invoices/list.d.ts.map +1 -0
- package/dist/commands/arabica/invoices/list.js +75 -0
- package/dist/commands/arabica/invoices/list.js.map +1 -0
- package/dist/commands/arabica/orders/cancel.d.ts +3 -0
- package/dist/commands/arabica/orders/cancel.d.ts.map +1 -0
- package/dist/commands/arabica/orders/cancel.js +133 -0
- package/dist/commands/arabica/orders/cancel.js.map +1 -0
- package/dist/commands/arabica/orders/get.d.ts +3 -0
- package/dist/commands/arabica/orders/get.d.ts.map +1 -0
- package/dist/commands/arabica/orders/get.js +145 -0
- package/dist/commands/arabica/orders/get.js.map +1 -0
- package/dist/commands/arabica/orders/index.d.ts +3 -0
- package/dist/commands/arabica/orders/index.d.ts.map +1 -0
- package/dist/commands/arabica/orders/index.js +24 -0
- package/dist/commands/arabica/orders/index.js.map +1 -0
- package/dist/commands/arabica/orders/list.d.ts +3 -0
- package/dist/commands/arabica/orders/list.d.ts.map +1 -0
- package/dist/commands/arabica/orders/list.js +111 -0
- package/dist/commands/arabica/orders/list.js.map +1 -0
- package/dist/commands/arabica/orders/submit.d.ts +3 -0
- package/dist/commands/arabica/orders/submit.d.ts.map +1 -0
- package/dist/commands/arabica/orders/submit.js +221 -0
- package/dist/commands/arabica/orders/submit.js.map +1 -0
- package/dist/commands/arabica/plans/compare.d.ts +3 -0
- package/dist/commands/arabica/plans/compare.d.ts.map +1 -0
- package/dist/commands/arabica/plans/compare.js +115 -0
- package/dist/commands/arabica/plans/compare.js.map +1 -0
- package/dist/commands/arabica/plans/get.d.ts +3 -0
- package/dist/commands/arabica/plans/get.d.ts.map +1 -0
- package/dist/commands/arabica/plans/get.js +94 -0
- package/dist/commands/arabica/plans/get.js.map +1 -0
- package/dist/commands/arabica/plans/index.d.ts +3 -0
- package/dist/commands/arabica/plans/index.d.ts.map +1 -0
- package/dist/commands/arabica/plans/index.js +21 -0
- package/dist/commands/arabica/plans/index.js.map +1 -0
- package/dist/commands/arabica/plans/list.d.ts +3 -0
- package/dist/commands/arabica/plans/list.d.ts.map +1 -0
- package/dist/commands/arabica/plans/list.js +69 -0
- package/dist/commands/arabica/plans/list.js.map +1 -0
- package/dist/commands/arabica/subscription/current.d.ts +3 -0
- package/dist/commands/arabica/subscription/current.d.ts.map +1 -0
- package/dist/commands/arabica/subscription/current.js +76 -0
- package/dist/commands/arabica/subscription/current.js.map +1 -0
- package/dist/commands/arabica/subscription/index.d.ts +3 -0
- package/dist/commands/arabica/subscription/index.d.ts.map +1 -0
- package/dist/commands/arabica/subscription/index.js +15 -0
- package/dist/commands/arabica/subscription/index.js.map +1 -0
- package/dist/commands/liberica/auth/index.d.ts.map +1 -1
- package/dist/commands/liberica/auth/index.js +1 -0
- package/dist/commands/liberica/auth/index.js.map +1 -1
- package/dist/commands/liberica/dict-types/tenant-items.js +1 -1
- package/dist/commands/liberica/dict-types/tenant-items.js.map +1 -1
- package/dist/core/api/client.d.ts +71 -0
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +629 -1
- package/dist/core/api/client.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/enterprise.d.ts +60 -0
- package/dist/types/enterprise.d.ts.map +1 -0
- package/dist/types/enterprise.js +5 -0
- package/dist/types/enterprise.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/invoice.d.ts +39 -0
- package/dist/types/invoice.d.ts.map +1 -0
- package/dist/types/invoice.js +5 -0
- package/dist/types/invoice.js.map +1 -0
- package/dist/types/member-product.d.ts +53 -0
- package/dist/types/member-product.d.ts.map +1 -0
- package/dist/types/member-product.js +2 -0
- package/dist/types/member-product.js.map +1 -0
- package/dist/types/order.d.ts +108 -0
- package/dist/types/order.d.ts.map +1 -0
- package/dist/types/order.js +5 -0
- package/dist/types/order.js.map +1 -0
- package/dist/types/subscription.d.ts +35 -0
- package/dist/types/subscription.d.ts.map +1 -0
- package/dist/types/subscription.js +5 -0
- package/dist/types/subscription.js.map +1 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -79,19 +79,21 @@ barista --version
|
|
|
79
79
|
# 1. Initialize config directory
|
|
80
80
|
barista init
|
|
81
81
|
|
|
82
|
-
# 2.
|
|
83
|
-
barista
|
|
82
|
+
# 2. Login with credentials (recommended method, automatically sets environment and tenant)
|
|
83
|
+
barista liberica auth login dev your-tenant your-username your-password
|
|
84
84
|
|
|
85
|
-
#
|
|
86
|
-
barista
|
|
85
|
+
# Or interactive login (system will prompt for missing information)
|
|
86
|
+
barista liberica auth login
|
|
87
87
|
|
|
88
|
-
#
|
|
89
|
-
barista auth login --service liberica --env dev
|
|
90
|
-
|
|
91
|
-
# 5. Verify login status
|
|
88
|
+
# 3. Verify login status
|
|
92
89
|
barista auth status
|
|
90
|
+
|
|
91
|
+
# 4. View current context (confirm environment is automatically set)
|
|
92
|
+
barista context show
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
**Note**: After using `barista liberica auth login`, the system automatically sets the current environment context, so subsequent commands do not need to specify `--env` and `--tenant` parameters.
|
|
96
|
+
|
|
95
97
|
### Basic Usage Examples
|
|
96
98
|
|
|
97
99
|
```bash
|
|
@@ -217,12 +219,34 @@ barista context use-service [liberica|arabica]
|
|
|
217
219
|
|
|
218
220
|
### Authentication Management
|
|
219
221
|
|
|
222
|
+
Barista CLI provides two login methods:
|
|
223
|
+
|
|
224
|
+
#### 1. Credential Login (Recommended)
|
|
225
|
+
Use username and password for complete authentication flow, automatically obtaining and storing Token:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Liberica credential login
|
|
229
|
+
barista liberica auth login <env> [tenant] [username] [password]
|
|
230
|
+
|
|
231
|
+
# Example: Login to Liberica test environment
|
|
232
|
+
barista liberica auth login test electionjp admin@shanghai.newpeaksh.com 123456
|
|
233
|
+
|
|
234
|
+
# Interactive login (system will prompt for missing information)
|
|
235
|
+
barista liberica auth login
|
|
236
|
+
|
|
237
|
+
# After login, the current environment context is automatically set
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### 2. Direct Token Storage
|
|
241
|
+
Suitable for scenarios where you already have a JWT Token (e.g., obtained from other sources):
|
|
242
|
+
|
|
220
243
|
```bash
|
|
221
|
-
#
|
|
244
|
+
# Directly store Token
|
|
222
245
|
barista auth login --service <service> --env <env> [--tenant <tenant>]
|
|
223
246
|
|
|
224
|
-
# Example:
|
|
247
|
+
# Example: Store Liberica development environment Token
|
|
225
248
|
barista auth login --service liberica --env dev --tenant electionjp
|
|
249
|
+
# Prompt: Enter your token: [input existing Token]
|
|
226
250
|
|
|
227
251
|
# Check login status
|
|
228
252
|
barista auth status
|
|
@@ -239,6 +263,8 @@ barista auth logout --service <service> --env <env>
|
|
|
239
263
|
barista auth logout --all
|
|
240
264
|
```
|
|
241
265
|
|
|
266
|
+
**Important**: After using `barista liberica auth login`, the system automatically sets the current environment context, so subsequent commands do not need to specify `--env` parameter.
|
|
267
|
+
|
|
242
268
|
### Liberica Commands
|
|
243
269
|
|
|
244
270
|
#### Order Management
|
|
@@ -415,6 +441,23 @@ barista liberica orders list --json
|
|
|
415
441
|
}
|
|
416
442
|
```
|
|
417
443
|
|
|
444
|
+
### CSV Export Format
|
|
445
|
+
|
|
446
|
+
Barista CLI supports CSV format export, suitable for data analysis and Excel processing:
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
# Export dictionary type data as CSV
|
|
450
|
+
barista liberica dict-types tenant-items --lang ja --all --csv --output ./dict-data.csv
|
|
451
|
+
|
|
452
|
+
# Output features:
|
|
453
|
+
# • UTF-8 with BOM encoding ensures proper Chinese character recognition in Excel
|
|
454
|
+
# • Automatic escape of special characters (commas, quotes, line breaks)
|
|
455
|
+
# • Support for custom output file paths
|
|
456
|
+
# • Can be combined with --json for both output formats
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
CSV files use UTF-8 with BOM encoding to ensure correct display of Chinese, Japanese, Vietnamese and other Unicode characters in Microsoft Excel and other tools.
|
|
460
|
+
|
|
418
461
|
---
|
|
419
462
|
|
|
420
463
|
## Configuration
|
package/README.ja.md
CHANGED
|
@@ -79,19 +79,21 @@ barista --version
|
|
|
79
79
|
# 1. 設定ディレクトリを初期化
|
|
80
80
|
barista init
|
|
81
81
|
|
|
82
|
-
# 2.
|
|
83
|
-
barista
|
|
82
|
+
# 2. 資格情報でログイン(推奨方法、環境とテナントを自動的に設定)
|
|
83
|
+
barista liberica auth login dev your-tenant your-username your-password
|
|
84
84
|
|
|
85
|
-
#
|
|
86
|
-
barista
|
|
85
|
+
# または対話型ログイン(システムが不足情報をプロンプト表示)
|
|
86
|
+
barista liberica auth login
|
|
87
87
|
|
|
88
|
-
#
|
|
89
|
-
barista auth login --service liberica --env dev
|
|
90
|
-
|
|
91
|
-
# 5. ログイン状態を確認
|
|
88
|
+
# 3. ログイン状態を確認
|
|
92
89
|
barista auth status
|
|
90
|
+
|
|
91
|
+
# 4. 現在のコンテキストを表示(環境が自動的に設定されたことを確認)
|
|
92
|
+
barista context show
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
**注意**: `barista liberica auth login` を使用した後、システムは現在の環境コンテキストを自動的に設定するため、後続のコマンドで `--env` および `--tenant` パラメータを指定する必要はありません。
|
|
96
|
+
|
|
95
97
|
### 基本的な使用例
|
|
96
98
|
|
|
97
99
|
```bash
|
|
@@ -217,12 +219,34 @@ barista context use-service [liberica|arabica]
|
|
|
217
219
|
|
|
218
220
|
### 認証管理
|
|
219
221
|
|
|
222
|
+
Barista CLI は2つのログイン方法を提供します:
|
|
223
|
+
|
|
224
|
+
#### 1. 資格情報ログイン(推奨)
|
|
225
|
+
ユーザー名とパスワードを使用した完全な認証フローで、トークンを自動的に取得・保存します:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Liberica 資格情報ログイン
|
|
229
|
+
barista liberica auth login <env> [tenant] [username] [password]
|
|
230
|
+
|
|
231
|
+
# 例:Liberica テスト環境にログイン
|
|
232
|
+
barista liberica auth login test electionjp admin@shanghai.newpeaksh.com 123456
|
|
233
|
+
|
|
234
|
+
# 対話型ログイン(システムが不足情報をプロンプト表示)
|
|
235
|
+
barista liberica auth login
|
|
236
|
+
|
|
237
|
+
# ログイン後、現在の環境コンテキストが自動的に設定されます
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### 2. トークン直接保存
|
|
241
|
+
既に JWT トークンを持っている場合に適しています(例:他のソースから取得):
|
|
242
|
+
|
|
220
243
|
```bash
|
|
221
|
-
#
|
|
244
|
+
# トークンを直接保存
|
|
222
245
|
barista auth login --service <service> --env <env> [--tenant <tenant>]
|
|
223
246
|
|
|
224
|
-
# 例:Liberica
|
|
247
|
+
# 例:Liberica 開発環境トークンを保存
|
|
225
248
|
barista auth login --service liberica --env dev --tenant electionjp
|
|
249
|
+
# プロンプト: トークンを入力: [既存のトークンを入力]
|
|
226
250
|
|
|
227
251
|
# ログイン状態を確認
|
|
228
252
|
barista auth status
|
|
@@ -239,6 +263,8 @@ barista auth logout --service <service> --env <env>
|
|
|
239
263
|
barista auth logout --all
|
|
240
264
|
```
|
|
241
265
|
|
|
266
|
+
**重要**: `barista liberica auth login` を使用した後、システムは現在の環境コンテキストを自動的に設定するため、後続のコマンドで `--env` パラメータを指定する必要はありません。
|
|
267
|
+
|
|
242
268
|
### Liberica コマンド
|
|
243
269
|
|
|
244
270
|
#### オーダー管理
|
|
@@ -415,6 +441,23 @@ barista liberica orders list --json
|
|
|
415
441
|
}
|
|
416
442
|
```
|
|
417
443
|
|
|
444
|
+
### CSV エクスポート形式
|
|
445
|
+
|
|
446
|
+
Barista CLI はデータ分析と Excel 処理に適した CSV 形式のエクスポートをサポートしています:
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
# 辞書タイプデータを CSV としてエクスポート
|
|
450
|
+
barista liberica dict-types tenant-items --lang ja --all --csv --output ./dict-data.csv
|
|
451
|
+
|
|
452
|
+
# 出力機能:
|
|
453
|
+
# • UTF-8 with BOM エンコーディングにより、Excel での日本語文字の正しい認識を保証
|
|
454
|
+
# • 特殊文字の自動エスケープ(カンマ、引用符、改行)
|
|
455
|
+
# • カスタム出力ファイルパスのサポート
|
|
456
|
+
# • --json と組み合わせて両方の出力形式を取得可能
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
CSV ファイルは UTF-8 with BOM エンコーディングを使用しており、Microsoft Excel などのツールで日本語、中国語、ベトナム語などの Unicode 文字が正しく表示されます。
|
|
460
|
+
|
|
418
461
|
---
|
|
419
462
|
|
|
420
463
|
## 設定説明
|
package/README.md
CHANGED
|
@@ -79,19 +79,21 @@ barista --version
|
|
|
79
79
|
# 1. 初始化配置目录
|
|
80
80
|
barista init
|
|
81
81
|
|
|
82
|
-
# 2.
|
|
83
|
-
barista
|
|
82
|
+
# 2. 使用凭证登录(推荐方式,自动设置环境和租户)
|
|
83
|
+
barista liberica auth login dev your-tenant your-username your-password
|
|
84
84
|
|
|
85
|
-
#
|
|
86
|
-
barista
|
|
85
|
+
# 或交互式登录(系统会提示输入缺失信息)
|
|
86
|
+
barista liberica auth login
|
|
87
87
|
|
|
88
|
-
#
|
|
89
|
-
barista auth login --service liberica --env dev
|
|
90
|
-
|
|
91
|
-
# 5. 验证登录状态
|
|
88
|
+
# 3. 验证登录状态
|
|
92
89
|
barista auth status
|
|
90
|
+
|
|
91
|
+
# 4. 查看当前上下文(确认环境已自动设置)
|
|
92
|
+
barista context show
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
**注意**:使用 `barista liberica auth login` 登录后,系统会自动设置当前环境上下文,后续命令无需指定 `--env` 和 `--tenant` 参数。
|
|
96
|
+
|
|
95
97
|
### 基本使用示例
|
|
96
98
|
|
|
97
99
|
```bash
|
|
@@ -217,12 +219,34 @@ barista context use-service [liberica|arabica]
|
|
|
217
219
|
|
|
218
220
|
### 认证管理
|
|
219
221
|
|
|
222
|
+
Barista CLI 提供两种登录方式:
|
|
223
|
+
|
|
224
|
+
#### 1. 凭证登录(推荐)
|
|
225
|
+
使用用户名和密码进行完整认证流程,自动获取并存储 Token:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Liberica 凭证登录
|
|
229
|
+
barista liberica auth login <env> [tenant] [username] [password]
|
|
230
|
+
|
|
231
|
+
# 示例:登录 Liberica 测试环境
|
|
232
|
+
barista liberica auth login test electionjp admin@shanghai.newpeaksh.com 123456
|
|
233
|
+
|
|
234
|
+
# 交互式登录(系统会提示输入缺失信息)
|
|
235
|
+
barista liberica auth login
|
|
236
|
+
|
|
237
|
+
# 登录后会自动设置当前环境上下文,后续命令无需指定 --env
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### 2. Token 直接存储
|
|
241
|
+
适用于已有 JWT Token 的场景(如从其他渠道获取):
|
|
242
|
+
|
|
220
243
|
```bash
|
|
221
|
-
#
|
|
244
|
+
# 直接存储 Token
|
|
222
245
|
barista auth login --service <service> --env <env> [--tenant <tenant>]
|
|
223
246
|
|
|
224
|
-
#
|
|
247
|
+
# 示例:存储 Liberica 开发环境 Token
|
|
225
248
|
barista auth login --service liberica --env dev --tenant electionjp
|
|
249
|
+
# 提示: Enter your token: [输入已有 Token]
|
|
226
250
|
|
|
227
251
|
# 检查登录状态
|
|
228
252
|
barista auth status
|
|
@@ -239,6 +263,8 @@ barista auth logout --service <service> --env <env>
|
|
|
239
263
|
barista auth logout --all
|
|
240
264
|
```
|
|
241
265
|
|
|
266
|
+
**重要**:使用 `barista liberica auth login` 登录后,系统会自动设置当前环境上下文,后续命令无需指定 `--env` 参数。
|
|
267
|
+
|
|
242
268
|
### Liberica 命令
|
|
243
269
|
|
|
244
270
|
#### 订单管理
|
|
@@ -348,45 +374,116 @@ barista liberica warehouses locations enable <location-id> [--force] [--dry-run]
|
|
|
348
374
|
barista liberica warehouses locations disable <location-id> [--force] [--dry-run]
|
|
349
375
|
```
|
|
350
376
|
|
|
351
|
-
### Arabica
|
|
377
|
+
### Arabica 命令(订阅管理 SaaS)
|
|
352
378
|
|
|
353
|
-
|
|
379
|
+
> Arabica 命令实现完整的 SaaS 订阅流程管理,包括套餐浏览、订阅管理、订单处理、发票查看等。
|
|
380
|
+
|
|
381
|
+
#### 认证管理
|
|
354
382
|
|
|
355
383
|
```bash
|
|
356
|
-
#
|
|
357
|
-
barista arabica
|
|
384
|
+
# 登录 Arabica
|
|
385
|
+
barista arabica auth login <account> <password>
|
|
358
386
|
|
|
359
|
-
#
|
|
360
|
-
barista arabica
|
|
387
|
+
# 注册新会员
|
|
388
|
+
barista arabica auth register --email <email> --account <account> --password <password>
|
|
389
|
+
|
|
390
|
+
# 查看登录状态
|
|
391
|
+
barista arabica auth status
|
|
361
392
|
|
|
362
|
-
#
|
|
363
|
-
barista arabica
|
|
393
|
+
# 登出
|
|
394
|
+
barista arabica auth logout
|
|
364
395
|
```
|
|
365
396
|
|
|
366
|
-
####
|
|
397
|
+
#### 套餐浏览
|
|
367
398
|
|
|
368
399
|
```bash
|
|
369
|
-
#
|
|
370
|
-
barista arabica
|
|
371
|
-
--product-id <id> \
|
|
372
|
-
--quantity <n> \
|
|
373
|
-
[--options <json>]
|
|
400
|
+
# 浏览可用套餐
|
|
401
|
+
barista arabica plans list
|
|
374
402
|
|
|
375
|
-
#
|
|
376
|
-
barista arabica
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
403
|
+
# 查看套餐详情
|
|
404
|
+
barista arabica plans get <plan-id>
|
|
405
|
+
|
|
406
|
+
# 对比两个套餐
|
|
407
|
+
barista arabica plans compare <plan-a> <plan-b>
|
|
380
408
|
```
|
|
381
409
|
|
|
382
|
-
####
|
|
410
|
+
#### 订阅管理
|
|
383
411
|
|
|
384
412
|
```bash
|
|
385
|
-
#
|
|
386
|
-
barista arabica
|
|
413
|
+
# 查看当前订阅
|
|
414
|
+
barista arabica subscription current
|
|
415
|
+
|
|
416
|
+
# 升级订阅
|
|
417
|
+
barista arabica subscription upgrade <plan-id> [--seats <n>]
|
|
387
418
|
|
|
388
|
-
#
|
|
389
|
-
barista arabica
|
|
419
|
+
# 降级订阅
|
|
420
|
+
barista arabica subscription downgrade <plan-id>
|
|
421
|
+
|
|
422
|
+
# 取消订阅
|
|
423
|
+
barista arabica subscription cancel [--confirm]
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
#### 订单管理
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# 查看订单列表
|
|
430
|
+
barista arabica orders list [--status pending|paid|cancelled|refunded]
|
|
431
|
+
|
|
432
|
+
# 查看订单详情
|
|
433
|
+
barista arabica orders get <order-id>
|
|
434
|
+
|
|
435
|
+
# 创建新订单
|
|
436
|
+
barista arabica orders create <plan-id> [--seats <n>] [--period year|month]
|
|
437
|
+
|
|
438
|
+
# 取消订单
|
|
439
|
+
barista arabica orders cancel <order-id>
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
#### 发票管理
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
# 查看发票列表
|
|
446
|
+
barista arabica invoices list [--year 2026]
|
|
447
|
+
|
|
448
|
+
# 查看发票详情
|
|
449
|
+
barista arabica invoices get <invoice-id>
|
|
450
|
+
|
|
451
|
+
# 下载发票 PDF
|
|
452
|
+
barista arabica invoices download <invoice-id> [--output <path>]
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
#### 用量查看
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
# 查看当前用量
|
|
459
|
+
barista arabica usage current
|
|
460
|
+
|
|
461
|
+
# 查看用量历史
|
|
462
|
+
barista arabica usage history [--period 30d|90d|1y]
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
#### 企业管理
|
|
466
|
+
|
|
467
|
+
```bash
|
|
468
|
+
# 查看企业列表
|
|
469
|
+
barista arabica enterprise list
|
|
470
|
+
|
|
471
|
+
# 查看席位使用
|
|
472
|
+
barista arabica enterprise seats
|
|
473
|
+
|
|
474
|
+
# 增加席位
|
|
475
|
+
barista arabica enterprise seats add <n>
|
|
476
|
+
|
|
477
|
+
# 查看/邀请企业成员
|
|
478
|
+
barista arabica enterprise members list
|
|
479
|
+
barista arabica enterprise members invite <email>
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
#### 访问 Liberica
|
|
483
|
+
|
|
484
|
+
```bash
|
|
485
|
+
# 获取 Liberica 访问地址
|
|
486
|
+
barista arabica access url
|
|
390
487
|
```
|
|
391
488
|
|
|
392
489
|
### 跨服务命令
|
|
@@ -476,6 +573,23 @@ barista liberica orders list --json
|
|
|
476
573
|
}
|
|
477
574
|
```
|
|
478
575
|
|
|
576
|
+
### CSV 导出格式
|
|
577
|
+
|
|
578
|
+
Barista CLI 支持 CSV 格式导出,适用于数据分析及 Excel 处理:
|
|
579
|
+
|
|
580
|
+
```bash
|
|
581
|
+
# 导出字典类型数据为 CSV
|
|
582
|
+
barista liberica dict-types tenant-items --lang ja --all --csv --output ./dict-data.csv
|
|
583
|
+
|
|
584
|
+
# 输出特性:
|
|
585
|
+
# • UTF-8 with BOM 编码,确保 Excel 正确识别中文
|
|
586
|
+
# • 自动转义特殊字符(逗号、引号、换行符)
|
|
587
|
+
# • 支持自定义输出文件路径
|
|
588
|
+
# • 可配合 --json 同时输出两种格式
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
CSV 文件采用 UTF-8 with BOM 编码,确保在 Microsoft Excel 等工具中正确显示中、日、越等 Unicode 字符。
|
|
592
|
+
|
|
479
593
|
---
|
|
480
594
|
|
|
481
595
|
## 配置说明
|
package/README.vi.md
CHANGED
|
@@ -79,19 +79,21 @@ barista --version
|
|
|
79
79
|
# 1. Khởi tạo thư mục cấu hình
|
|
80
80
|
barista init
|
|
81
81
|
|
|
82
|
-
# 2.
|
|
83
|
-
barista
|
|
82
|
+
# 2. Đăng nhập bằng thông tin đăng nhập (phương pháp khuyến nghị, tự động đặt môi trường và người thuê)
|
|
83
|
+
barista liberica auth login dev your-tenant your-username your-password
|
|
84
84
|
|
|
85
|
-
#
|
|
86
|
-
barista
|
|
85
|
+
# Hoặc đăng nhập tương tác (hệ thống sẽ nhắc thông tin thiếu)
|
|
86
|
+
barista liberica auth login
|
|
87
87
|
|
|
88
|
-
#
|
|
89
|
-
barista auth login --service liberica --env dev
|
|
90
|
-
|
|
91
|
-
# 5. Xác minh trạng thái đăng nhập
|
|
88
|
+
# 3. Xác minh trạng thái đăng nhập
|
|
92
89
|
barista auth status
|
|
90
|
+
|
|
91
|
+
# 4. Xem ngữ cảnh hiện tại (xác nhận môi trường đã được đặt tự động)
|
|
92
|
+
barista context show
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
**Lưu ý**: Sau khi sử dụng `barista liberica auth login`, hệ thống tự động đặt ngữ cảnh môi trường hiện tại, vì vậy các lệnh tiếp theo không cần chỉ định tham số `--env` và `--tenant`.
|
|
96
|
+
|
|
95
97
|
### Ví dụ Sử dụng Cơ bản
|
|
96
98
|
|
|
97
99
|
```bash
|
|
@@ -217,12 +219,34 @@ barista context use-service [liberica|arabica]
|
|
|
217
219
|
|
|
218
220
|
### Quản lý Xác thực
|
|
219
221
|
|
|
222
|
+
Barista CLI cung cấp hai phương pháp đăng nhập:
|
|
223
|
+
|
|
224
|
+
#### 1. Đăng nhập bằng Thông tin đăng nhập (Khuyến nghị)
|
|
225
|
+
Sử dụng tên người dùng và mật khẩu cho quy trình xác thực hoàn chỉnh, tự động lấy và lưu Token:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Đăng nhập Liberica bằng thông tin đăng nhập
|
|
229
|
+
barista liberica auth login <env> [tenant] [username] [password]
|
|
230
|
+
|
|
231
|
+
# Ví dụ: Đăng nhập môi trường kiểm thử Liberica
|
|
232
|
+
barista liberica auth login test electionjp admin@shanghai.newpeaksh.com 123456
|
|
233
|
+
|
|
234
|
+
# Đăng nhập tương tác (hệ thống sẽ nhắc thông tin thiếu)
|
|
235
|
+
barista liberica auth login
|
|
236
|
+
|
|
237
|
+
# Sau khi đăng nhập, ngữ cảnh môi trường hiện tại được đặt tự động
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### 2. Lưu trữ Token trực tiếp
|
|
241
|
+
Phù hợp cho các trường hợp đã có JWT Token (ví dụ: lấy từ nguồn khác):
|
|
242
|
+
|
|
220
243
|
```bash
|
|
221
|
-
#
|
|
244
|
+
# Lưu trữ Token trực tiếp
|
|
222
245
|
barista auth login --service <service> --env <env> [--tenant <tenant>]
|
|
223
246
|
|
|
224
|
-
# Ví dụ:
|
|
247
|
+
# Ví dụ: Lưu trữ Token môi trường phát triển Liberica
|
|
225
248
|
barista auth login --service liberica --env dev --tenant electionjp
|
|
249
|
+
# Lời nhắc: Nhập token của bạn: [nhập Token hiện có]
|
|
226
250
|
|
|
227
251
|
# Kiểm tra trạng thái đăng nhập
|
|
228
252
|
barista auth status
|
|
@@ -239,6 +263,8 @@ barista auth logout --service <service> --env <env>
|
|
|
239
263
|
barista auth logout --all
|
|
240
264
|
```
|
|
241
265
|
|
|
266
|
+
**Quan trọng**: Sau khi sử dụng `barista liberica auth login`, hệ thống tự động đặt ngữ cảnh môi trường hiện tại, vì vậy các lệnh tiếp theo không cần chỉ định tham số `--env`.
|
|
267
|
+
|
|
242
268
|
### Lệnh Liberica
|
|
243
269
|
|
|
244
270
|
#### Quản lý Đơn hàng
|
|
@@ -415,6 +441,23 @@ barista liberica orders list --json
|
|
|
415
441
|
}
|
|
416
442
|
```
|
|
417
443
|
|
|
444
|
+
### Định dạng Xuất CSV
|
|
445
|
+
|
|
446
|
+
Barista CLI hỗ trợ xuất định dạng CSV, phù hợp cho phân tích dữ liệu và xử lý Excel:
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
# Xuất dữ liệu loại từ điển dưới dạng CSV
|
|
450
|
+
barista liberica dict-types tenant-items --lang ja --all --csv --output ./dict-data.csv
|
|
451
|
+
|
|
452
|
+
# Tính năng đầu ra:
|
|
453
|
+
# • Mã hóa UTF-8 with BOM đảm bảo nhận dạng chữ Trung Quốc chính xác trong Excel
|
|
454
|
+
# • Tự động thoát ký tự đặc biệt (dấu phẩy, dấu ngoặc kép, ngắt dòng)
|
|
455
|
+
# • Hỗ trợ đường dẫn tệp đầu ra tùy chỉnh
|
|
456
|
+
# • Có thể kết hợp với --json để có cả hai định dạng đầu ra
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Tệp CSV sử dụng mã hóa UTF-8 with BOM để đảm bảo hiển thị chính xác các ký tự Unicode như tiếng Trung, tiếng Nhật, tiếng Việt trong Microsoft Excel và các công cụ khác.
|
|
460
|
+
|
|
418
461
|
---
|
|
419
462
|
|
|
420
463
|
## Cấu hình
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/arabica/access/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,0BAA0B,IAAI,OAAO,CAapD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { createAccessUrlCommand } from './url.js';
|
|
4
|
+
export function createArabicaAccessCommand() {
|
|
5
|
+
const accessCommand = new Command('access');
|
|
6
|
+
accessCommand.description('Access management for Arabica platform');
|
|
7
|
+
accessCommand.addCommand(createAccessUrlCommand());
|
|
8
|
+
accessCommand.action(() => {
|
|
9
|
+
console.log(chalk.bold('\n🔐 Arabica Access Commands\n'));
|
|
10
|
+
console.log(' Use "barista arabica access url" to get Liberica access URL and account suffix');
|
|
11
|
+
console.log('\n Run "barista arabica access <command> --help" for more details\n');
|
|
12
|
+
});
|
|
13
|
+
return accessCommand;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/arabica/access/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,UAAU,0BAA0B;IACxC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5C,aAAa,CAAC,WAAW,CAAC,wCAAwC,CAAC,CAAC;IAEpE,aAAa,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,CAAC;IAEnD,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,kFAAkF,CAAC,CAAC;QAChG,OAAO,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IAEH,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../src/commands/arabica/access/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,wBAAgB,sBAAsB,IAAI,OAAO,CAkGhD"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import Table from 'cli-table3';
|
|
4
|
+
import { configManager } from '../../../core/config/manager.js';
|
|
5
|
+
import { apiClient } from '../../../core/api/client.js';
|
|
6
|
+
function getGlobalOption(name, defaultValue) {
|
|
7
|
+
const index = process.argv.indexOf(`--${name}`);
|
|
8
|
+
if (index !== -1 && index + 1 < process.argv.length) {
|
|
9
|
+
const value = process.argv[index + 1];
|
|
10
|
+
if (!value.startsWith('--')) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return defaultValue;
|
|
15
|
+
}
|
|
16
|
+
export function createAccessUrlCommand() {
|
|
17
|
+
const urlCommand = new Command('url');
|
|
18
|
+
urlCommand.description('Get Liberica access URL and account suffix');
|
|
19
|
+
urlCommand
|
|
20
|
+
.option('--env <environment>', 'Environment (dev|test|prod-cn|prod-jp)')
|
|
21
|
+
.option('--tenant <tenant>', 'Tenant code (e.g., electionjp)')
|
|
22
|
+
.option('--json', 'Output as JSON')
|
|
23
|
+
.action(async (options) => {
|
|
24
|
+
const context = configManager.getCurrentContext();
|
|
25
|
+
const environment = getGlobalOption('env', context.environment);
|
|
26
|
+
const tenant = getGlobalOption('tenant', context.tenant);
|
|
27
|
+
console.log(chalk.bold('\n🔗 Liberica Access Information\n'));
|
|
28
|
+
if (!tenant) {
|
|
29
|
+
console.error(chalk.red('\n✗ Tenant is required. Set via --tenant or: barista context use-tenant <tenant>\n'));
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const [loginUrlResponse, enterprisesResponse] = await Promise.all([
|
|
34
|
+
apiClient.getLibericaLoginUrl(environment),
|
|
35
|
+
apiClient.listEnterprises(environment),
|
|
36
|
+
]);
|
|
37
|
+
if (!loginUrlResponse.success) {
|
|
38
|
+
console.error(chalk.red(`\n✗ Failed to get login URL: ${loginUrlResponse.error?.message || 'Unknown error'}`));
|
|
39
|
+
if (loginUrlResponse.error?.code) {
|
|
40
|
+
console.error(chalk.gray(` Error code: ${loginUrlResponse.error.code}`));
|
|
41
|
+
}
|
|
42
|
+
console.error();
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
const data = loginUrlResponse.data;
|
|
46
|
+
if (!data || data.length < 3) {
|
|
47
|
+
console.error(chalk.red('\n✗ Invalid response: expected [urlPrefix, urlSuffix, accountSuffix]\n'));
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
const [urlPrefix, urlSuffix, accountSuffix] = data;
|
|
51
|
+
const fullUrl = `${urlPrefix}${tenant}${urlSuffix}`;
|
|
52
|
+
const jsonOutput = options.json === true;
|
|
53
|
+
let contactEmail = '';
|
|
54
|
+
if (enterprisesResponse.success && enterprisesResponse.data) {
|
|
55
|
+
const enterprises = enterprisesResponse.data;
|
|
56
|
+
const enterprise = enterprises.find((e) => e.enterpriseNo === tenant);
|
|
57
|
+
if (enterprise?.enterpriseId) {
|
|
58
|
+
const detailResponse = await apiClient.getEnterpriseDetail(environment, enterprise.enterpriseId);
|
|
59
|
+
if (detailResponse.success && detailResponse.data) {
|
|
60
|
+
contactEmail = detailResponse.data.contactEmail || '';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (jsonOutput) {
|
|
65
|
+
console.log(JSON.stringify({
|
|
66
|
+
success: true,
|
|
67
|
+
data: {
|
|
68
|
+
libericaUrl: fullUrl,
|
|
69
|
+
account: `admin@${tenant}.${accountSuffix}`,
|
|
70
|
+
accountSuffix,
|
|
71
|
+
contactEmail,
|
|
72
|
+
},
|
|
73
|
+
}, null, 2));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const table = new Table({
|
|
77
|
+
head: [chalk.bold('属性'), chalk.bold('值')],
|
|
78
|
+
colWidths: [20, 50],
|
|
79
|
+
style: {
|
|
80
|
+
head: [],
|
|
81
|
+
border: [],
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
table.push([chalk.cyan('Liberica URL'), fullUrl], [chalk.cyan('登录账号'), `admin@${tenant}.${accountSuffix}`]);
|
|
85
|
+
console.log(table.toString());
|
|
86
|
+
console.log();
|
|
87
|
+
if (contactEmail) {
|
|
88
|
+
console.log(chalk.gray(` Note: Initial password will be sent to ${contactEmail}\n`));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.log(chalk.gray(' Note: Initial password will be sent to the enterprise contact email.\n'));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
console.error(chalk.red(`\n✗ Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}\n`));
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return urlCommand;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=url.js.map
|