@newpeak/barista-cli 0.1.6 → 0.1.7
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 +714 -0
- package/README.ja.md +708 -0
- package/README.md +68 -0
- package/README.vi.md +714 -0
- package/dist/commands/liberica/index.d.ts.map +1 -1
- package/dist/commands/liberica/index.js +4 -0
- package/dist/commands/liberica/index.js.map +1 -1
- package/dist/commands/liberica/materials/create.d.ts.map +1 -1
- package/dist/commands/liberica/materials/create.js +35 -9
- package/dist/commands/liberica/materials/create.js.map +1 -1
- package/dist/commands/liberica/orgs/index.d.ts.map +1 -1
- package/dist/commands/liberica/orgs/index.js.map +1 -1
- package/dist/commands/liberica/users/create.d.ts.map +1 -1
- package/dist/commands/liberica/users/create.js +1 -0
- package/dist/commands/liberica/users/create.js.map +1 -1
- package/dist/commands/liberica/warehouses/create.d.ts +3 -0
- package/dist/commands/liberica/warehouses/create.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/create.js +196 -0
- package/dist/commands/liberica/warehouses/create.js.map +1 -0
- package/dist/commands/liberica/warehouses/delete.d.ts +3 -0
- package/dist/commands/liberica/warehouses/delete.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/delete.js +111 -0
- package/dist/commands/liberica/warehouses/delete.js.map +1 -0
- package/dist/commands/liberica/warehouses/disable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/disable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/disable.js +173 -0
- package/dist/commands/liberica/warehouses/disable.js.map +1 -0
- package/dist/commands/liberica/warehouses/enable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/enable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/enable.js +173 -0
- package/dist/commands/liberica/warehouses/enable.js.map +1 -0
- package/dist/commands/liberica/warehouses/get.d.ts +3 -0
- package/dist/commands/liberica/warehouses/get.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/get.js +90 -0
- package/dist/commands/liberica/warehouses/get.js.map +1 -0
- package/dist/commands/liberica/warehouses/index.d.ts +3 -0
- package/dist/commands/liberica/warehouses/index.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/index.js +23 -0
- package/dist/commands/liberica/warehouses/index.js.map +1 -0
- package/dist/commands/liberica/warehouses/list.d.ts +3 -0
- package/dist/commands/liberica/warehouses/list.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/list.js +101 -0
- package/dist/commands/liberica/warehouses/list.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/create.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/create.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/create.js +199 -0
- package/dist/commands/liberica/warehouses/locations/create.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/delete.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/delete.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/delete.js +115 -0
- package/dist/commands/liberica/warehouses/locations/delete.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/disable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/disable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/disable.js +173 -0
- package/dist/commands/liberica/warehouses/locations/disable.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/enable.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/enable.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/enable.js +173 -0
- package/dist/commands/liberica/warehouses/locations/enable.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/get.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/get.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/get.js +73 -0
- package/dist/commands/liberica/warehouses/locations/get.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/index.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/index.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/index.js +21 -0
- package/dist/commands/liberica/warehouses/locations/index.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/list.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/list.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/list.js +104 -0
- package/dist/commands/liberica/warehouses/locations/list.js.map +1 -0
- package/dist/commands/liberica/warehouses/locations/update.d.ts +3 -0
- package/dist/commands/liberica/warehouses/locations/update.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/locations/update.js +128 -0
- package/dist/commands/liberica/warehouses/locations/update.js.map +1 -0
- package/dist/commands/liberica/warehouses/update.d.ts +3 -0
- package/dist/commands/liberica/warehouses/update.d.ts.map +1 -0
- package/dist/commands/liberica/warehouses/update.js +143 -0
- package/dist/commands/liberica/warehouses/update.js.map +1 -0
- package/dist/core/api/client.d.ts +16 -0
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +286 -0
- package/dist/core/api/client.js.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/location.d.ts +53 -0
- package/dist/types/location.d.ts.map +1 -0
- package/dist/types/location.js +2 -0
- package/dist/types/location.js.map +1 -0
- package/dist/types/warehouse.d.ts +68 -0
- package/dist/types/warehouse.d.ts.map +1 -0
- package/dist/types/warehouse.js +2 -0
- package/dist/types/warehouse.js.map +1 -0
- package/docs/commands/liberica/locations/create.md +195 -0
- package/docs/commands/liberica/locations/list.md +171 -0
- package/docs/commands/liberica/warehouses/create.md +222 -0
- package/docs/commands/liberica/warehouses/list.md +184 -0
- package/package.json +1 -1
- package/src/commands/liberica/index.ts +4 -0
- package/src/commands/liberica/materials/create.ts +32 -9
- package/src/commands/liberica/orgs/index.ts +0 -1
- package/src/commands/liberica/users/create.ts +1 -0
- package/src/commands/liberica/warehouses/create.ts +204 -0
- package/src/commands/liberica/warehouses/delete.ts +112 -0
- package/src/commands/liberica/warehouses/disable.ts +174 -0
- package/src/commands/liberica/warehouses/enable.ts +174 -0
- package/src/commands/liberica/warehouses/get.ts +101 -0
- package/src/commands/liberica/warehouses/index.ts +25 -0
- package/src/commands/liberica/warehouses/list.ts +136 -0
- package/src/commands/liberica/warehouses/locations/create.ts +209 -0
- package/src/commands/liberica/warehouses/locations/delete.ts +116 -0
- package/src/commands/liberica/warehouses/locations/disable.ts +174 -0
- package/src/commands/liberica/warehouses/locations/enable.ts +174 -0
- package/src/commands/liberica/warehouses/locations/get.ts +84 -0
- package/src/commands/liberica/warehouses/locations/index.ts +23 -0
- package/src/commands/liberica/warehouses/locations/list.ts +140 -0
- package/src/commands/liberica/warehouses/locations/update.ts +135 -0
- package/src/commands/liberica/warehouses/update.ts +142 -0
- package/src/core/api/client.ts +396 -0
- package/src/index.ts +1 -3
- package/src/types/index.ts +4 -4
- package/src/types/location.ts +66 -0
- package/src/types/warehouse.ts +82 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
# ☕ Barista CLI
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="./README.md"><img src="https://img.shields.io/badge/-简体中文-green?style=flat-square" alt="简体中文"></a>
|
|
5
|
+
<a href="./README.en.md"><img src="https://img.shields.io/badge/-English-blue?style=flat-square" alt="English"></a>
|
|
6
|
+
<a href="./README.ja.md"><img src="https://img.shields.io/badge/-日本語-red?style=flat-square" alt="日本語"></a>
|
|
7
|
+
<a href="./README.vi.md"><img src="https://img.shields.io/badge/-Tiếng%20Việt-green?style=flat-square" alt="Tiếng Việt"></a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<img src="https://img.shields.io/badge/AI--Native-CLI-blue?style=flat-square" alt="AI-Native">
|
|
12
|
+
<img src="https://img.shields.io/badge/Liberica-Production%20SaaS-green?style=flat-square" alt="Liberica">
|
|
13
|
+
<img src="https://img.shields.io/badge/Arabica-Sales%20Platform-orange?style=flat-square" alt="Arabica">
|
|
14
|
+
<img src="https://img.shields.io/badge/Node.js-18%2B-brightgreen?style=flat-square" alt="Node.js 18+">
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<strong>AI-Native CLI Tool</strong> that seamlessly bridges Liberica Production Management SaaS and Arabica Sales Platform
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 📋 Table of Contents
|
|
24
|
+
|
|
25
|
+
- [Project Introduction](#project-introduction)
|
|
26
|
+
- [Quick Start](#quick-start)
|
|
27
|
+
- [Architecture Design](#architecture-design)
|
|
28
|
+
- [Command Documentation](#command-documentation)
|
|
29
|
+
- [Advanced Features](#advanced-features)
|
|
30
|
+
- [Configuration](#configuration)
|
|
31
|
+
- [AI Integration](#ai-integration)
|
|
32
|
+
- [Development Guide](#development-guide)
|
|
33
|
+
- [Contributing](#contributing)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Project Introduction
|
|
38
|
+
|
|
39
|
+
Barista CLI is an AI-Native command-line tool designed specifically for the Newpeak ecosystem. It provides a unified interface for managing Liberica Production Management SaaS and Arabica Sales Platform.
|
|
40
|
+
|
|
41
|
+
### Core Features
|
|
42
|
+
|
|
43
|
+
| Feature | Description |
|
|
44
|
+
|---------|-------------|
|
|
45
|
+
| 🌍 **Multi-Environment Support** | Seamless switching between dev, test, prod-cn, and prod-jp environments |
|
|
46
|
+
| 🏢 **Multi-Tenant Architecture** | Supports multi-tenant environment configuration and isolation |
|
|
47
|
+
| 🔐 **Token Authentication** | Securely stored in system keychain with environment isolation |
|
|
48
|
+
| 🧪 **Dry-Run Mode** | All write operations support preview to avoid mistakes |
|
|
49
|
+
| 🤖 **AI Integration** | JSON output format optimized for Claude Code |
|
|
50
|
+
| 🔄 **Cross-Service Operations** | Data synchronization between Liberica and Arabica |
|
|
51
|
+
|
|
52
|
+
### Use Cases
|
|
53
|
+
|
|
54
|
+
- **Production Planning Management**: Create, query, and cancel production orders
|
|
55
|
+
- **Product Data Management**: Cross-platform product search and synchronization
|
|
56
|
+
- **Customer Operations**: Query customer information and generate quotes
|
|
57
|
+
- **AI Automation**: Automate business processes through Claude Code
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Quick Start
|
|
62
|
+
|
|
63
|
+
### Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Install via npm
|
|
67
|
+
npm install -g @newpeak/barista-cli
|
|
68
|
+
|
|
69
|
+
# Or via yarn
|
|
70
|
+
yarn global add @newpeak/barista-cli
|
|
71
|
+
|
|
72
|
+
# Verify installation
|
|
73
|
+
barista --version
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Initial Configuration
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# 1. Initialize config directory
|
|
80
|
+
barista init
|
|
81
|
+
|
|
82
|
+
# 2. Set environment (choose default environment)
|
|
83
|
+
barista context use-env dev
|
|
84
|
+
|
|
85
|
+
# 3. Set tenant
|
|
86
|
+
barista context use-tenant your-tenant
|
|
87
|
+
|
|
88
|
+
# 4. Login to get Token
|
|
89
|
+
barista auth login --service liberica --env dev
|
|
90
|
+
|
|
91
|
+
# 5. Verify login status
|
|
92
|
+
barista auth status
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Basic Usage Examples
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# View current context
|
|
99
|
+
barista context show
|
|
100
|
+
|
|
101
|
+
# List all orders (Liberica)
|
|
102
|
+
barista liberica orders list
|
|
103
|
+
|
|
104
|
+
# Search products (supports fuzzy search)
|
|
105
|
+
barista liberica products search --keyword "coffee machine"
|
|
106
|
+
|
|
107
|
+
# View Arabica product catalog
|
|
108
|
+
barista arabica products public-catalog
|
|
109
|
+
|
|
110
|
+
# Create production order (dry-run preview mode)
|
|
111
|
+
barista liberica orders create --product-id 123 --quantity 100 --dry-run
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Architecture Design
|
|
117
|
+
|
|
118
|
+
### Environment Mapping
|
|
119
|
+
|
|
120
|
+
#### Liberica (Production Management SaaS)
|
|
121
|
+
|
|
122
|
+
| Environment | Domain Format | Description |
|
|
123
|
+
|-------------|---------------|-------------|
|
|
124
|
+
| dev | `{tenant}-dev.newpeaksh.com` | Development environment |
|
|
125
|
+
| test | `{tenant}-test.newpeaksh.com` | Test environment |
|
|
126
|
+
| prod-cn | `{tenant}.newpeaksh.com` | China production environment |
|
|
127
|
+
| prod-jp | `{tenant}.newpeakjp.com` | Japan production environment |
|
|
128
|
+
|
|
129
|
+
#### Arabica (Sales Platform)
|
|
130
|
+
|
|
131
|
+
| Environment | Domain | Description |
|
|
132
|
+
|-------------|--------|-------------|
|
|
133
|
+
| dev | `arabica-dev.newpeaksh.com` | Development environment |
|
|
134
|
+
| test | `arabica-test.newpeaksh.com` | Test environment |
|
|
135
|
+
| prod-cn | `www.newpeaksh.com` | China production environment |
|
|
136
|
+
| prod-jp | `members.newpeakjp.com` | Japan production environment |
|
|
137
|
+
|
|
138
|
+
### Authentication Mechanism
|
|
139
|
+
|
|
140
|
+
Barista CLI uses Token-based authentication:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
|
|
144
|
+
│ Barista CLI │────▶│ Auth Server │────▶│ API Servers │
|
|
145
|
+
│ │ │ │ │ │
|
|
146
|
+
│ • Login Request │ │ • Verify Creds │ │ • Verify Token │
|
|
147
|
+
│ • Store Token │◀────│ • Issue JWT │◀────│ • Return Data │
|
|
148
|
+
│ (Keychain) │ │ │ │ │
|
|
149
|
+
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Security Features:**
|
|
153
|
+
|
|
154
|
+
- **Keychain Storage**: Tokens are securely stored in system keychain (macOS Keychain, Windows Credential, Linux Secret Service)
|
|
155
|
+
- **Auto Skip Auth**: Public interfaces (like product catalog queries) do not require authentication
|
|
156
|
+
- **Environment Isolation**: Each environment and tenant uses independent tokens
|
|
157
|
+
- **Token Refresh**: Supports automatic refresh of tokens nearing expiration
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Command Documentation
|
|
162
|
+
|
|
163
|
+
> **Complete Command Reference**: For a complete reference of all commands (including implemented and planned), please see [Command Reference](./docs/commands/REFERENCE.md).
|
|
164
|
+
|
|
165
|
+
### Command Structure
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
barista <service> <resource> <action> [options]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Examples:**
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
barista liberica orders list --page 1 --size 20
|
|
175
|
+
barista arabica quotes calculate --product-id 123 --quantity 10
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Global Options
|
|
179
|
+
|
|
180
|
+
| Option | Description | Example |
|
|
181
|
+
|--------|-------------|---------|
|
|
182
|
+
| `--env` | Specify environment | `--env prod-cn` |
|
|
183
|
+
| `--tenant` | Specify tenant | `--tenant electionjp` |
|
|
184
|
+
| `--service` | Specify service | `--service liberica` |
|
|
185
|
+
| `--dry-run` | Preview mode | `--dry-run` |
|
|
186
|
+
| `--json` | JSON output | `--json` |
|
|
187
|
+
| `--help` | Show help | `--help` |
|
|
188
|
+
|
|
189
|
+
### Context Management
|
|
190
|
+
|
|
191
|
+
Context management is used to quickly switch working environments, avoiding the need to specify environment parameters for every command.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# View current context
|
|
195
|
+
barista context show
|
|
196
|
+
|
|
197
|
+
# Output example:
|
|
198
|
+
# ┌─────────────┬─────────────────┐
|
|
199
|
+
# │ Property │ Value │
|
|
200
|
+
# ├─────────────┼─────────────────┤
|
|
201
|
+
# │ Current Env │ dev │
|
|
202
|
+
# │ Current Tenant│ electionjp │
|
|
203
|
+
# │ Current Service│ liberica │
|
|
204
|
+
# │ Token Status│ Logged In │
|
|
205
|
+
# │ Token Expiry│ 2024-12-31 │
|
|
206
|
+
# └─────────────┴─────────────────┘
|
|
207
|
+
|
|
208
|
+
# Switch environment
|
|
209
|
+
barista context use-env [dev|test|prod-cn|prod-jp]
|
|
210
|
+
|
|
211
|
+
# Switch tenant
|
|
212
|
+
barista context use-tenant <tenant-name>
|
|
213
|
+
|
|
214
|
+
# Switch default service
|
|
215
|
+
barista context use-service [liberica|arabica]
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Authentication Management
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Login to get Token
|
|
222
|
+
barista auth login --service <service> --env <env> [--tenant <tenant>]
|
|
223
|
+
|
|
224
|
+
# Example: Login to Liberica development environment
|
|
225
|
+
barista auth login --service liberica --env dev --tenant electionjp
|
|
226
|
+
|
|
227
|
+
# Check login status
|
|
228
|
+
barista auth status
|
|
229
|
+
|
|
230
|
+
# Output example:
|
|
231
|
+
# ✓ Liberica (dev) - Logged In (Expires: 2024-12-31)
|
|
232
|
+
# ✗ Liberica (test) - Not Logged In
|
|
233
|
+
# ✓ Arabica (prod-cn) - Logged In (Expires: 2024-12-30)
|
|
234
|
+
|
|
235
|
+
# Logout (clear Token)
|
|
236
|
+
barista auth logout --service <service> --env <env>
|
|
237
|
+
|
|
238
|
+
# Logout all environments
|
|
239
|
+
barista auth logout --all
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Liberica Commands
|
|
243
|
+
|
|
244
|
+
#### Order Management
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# List orders (paginated)
|
|
248
|
+
barista liberica orders list [--page <n>] [--size <n>] [--status <status>]
|
|
249
|
+
|
|
250
|
+
# Get single order details
|
|
251
|
+
barista liberica orders get <order-id>
|
|
252
|
+
|
|
253
|
+
# Create order
|
|
254
|
+
barista liberica orders create \
|
|
255
|
+
--product-id <id> \
|
|
256
|
+
--quantity <n> \
|
|
257
|
+
[--delivery-date <date>] \
|
|
258
|
+
[--note <text>]
|
|
259
|
+
|
|
260
|
+
# Cancel order
|
|
261
|
+
barista liberica orders cancel <order-id> [--reason <text>]
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### Product Management
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Search products
|
|
268
|
+
barista liberica products search --keyword <keyword> [--category <id>]
|
|
269
|
+
|
|
270
|
+
# Get product details
|
|
271
|
+
barista liberica products get <product-id>
|
|
272
|
+
|
|
273
|
+
# Get public product list (no auth required)
|
|
274
|
+
barista liberica products public-list [--category <id>] [--page <n>]
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### Production Planning
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# View production schedule
|
|
281
|
+
barista liberica production schedule [--start-date <date>] [--end-date <date>]
|
|
282
|
+
|
|
283
|
+
# Reschedule production
|
|
284
|
+
barista liberica production reschedule <order-id> --new-date <date> [--dry-run]
|
|
285
|
+
|
|
286
|
+
# Query capacity
|
|
287
|
+
barista liberica production capacity [--date <date>] [--line <line-id>]
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Arabica Commands
|
|
291
|
+
|
|
292
|
+
#### Product Management
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# List products
|
|
296
|
+
barista arabica products list [--page <n>] [--size <n>] [--category <id>]
|
|
297
|
+
|
|
298
|
+
# Search products
|
|
299
|
+
barista arabica products search --keyword <keyword>
|
|
300
|
+
|
|
301
|
+
# Get product catalog (public interface)
|
|
302
|
+
barista arabica products public-catalog [--lang <zh|jp|en>]
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### Quote Management
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Calculate quote
|
|
309
|
+
barista arabica quotes calculate \
|
|
310
|
+
--product-id <id> \
|
|
311
|
+
--quantity <n> \
|
|
312
|
+
[--options <json>]
|
|
313
|
+
|
|
314
|
+
# Create quote
|
|
315
|
+
barista arabica quotes create \
|
|
316
|
+
--customer-id <id> \
|
|
317
|
+
--items <json> \
|
|
318
|
+
[--valid-days <n>]
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### Customer Management
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# Search customers
|
|
325
|
+
barista arabica customers search --keyword <keyword> [--type <type>]
|
|
326
|
+
|
|
327
|
+
# Get customer details
|
|
328
|
+
barista arabica customers get <customer-id>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Cross-Service Commands
|
|
332
|
+
|
|
333
|
+
Cross-service commands enable data synchronization and business process衔接 between Liberica and Arabica.
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
# Generate quote from order
|
|
337
|
+
barista cross quote-from-order <order-id> [--target-service arabica]
|
|
338
|
+
|
|
339
|
+
# Output example:
|
|
340
|
+
# ✓ Quote Generated
|
|
341
|
+
# ┌──────────┬────────────┐
|
|
342
|
+
# │ Property │ Value │
|
|
343
|
+
# ├──────────┼────────────┤
|
|
344
|
+
# │ Order ID │ 12345 │
|
|
345
|
+
# │ Quote ID │ QT-2024-001│
|
|
346
|
+
# │ Amount │ ¥50,000 │
|
|
347
|
+
# │ Validity │ 30 days │
|
|
348
|
+
# └──────────┴────────────┘
|
|
349
|
+
|
|
350
|
+
# Sync order status to Arabica
|
|
351
|
+
barista cross sync-order <order-id> [--direction liberica-to-arabica]
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Advanced Features
|
|
357
|
+
|
|
358
|
+
### Dry-Run Mode
|
|
359
|
+
|
|
360
|
+
Dry-Run mode allows you to preview the impact of write operations before executing them, avoiding mistakes.
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
# All write operations support --dry-run option
|
|
364
|
+
barista liberica orders create --product-id 123 --quantity 100 --dry-run
|
|
365
|
+
|
|
366
|
+
# Output example:
|
|
367
|
+
# 🔍 Dry-Run Mode: Operation will not be executed
|
|
368
|
+
# ┌─────────────────┬──────────────────────┐
|
|
369
|
+
# │ Operation │ Create Order │
|
|
370
|
+
# ├─────────────────┼──────────────────────┤
|
|
371
|
+
# │ Product │ Coffee Machine Pro (ID: 123) │
|
|
372
|
+
# │ Quantity │ 100 │
|
|
373
|
+
# │ Estimated Amount│ ¥50,000 │
|
|
374
|
+
# │ Estimated Delivery│ 2024-12-31 │
|
|
375
|
+
# │ Impact │ Add one order record │
|
|
376
|
+
# └─────────────────┴──────────────────────┘
|
|
377
|
+
#
|
|
378
|
+
# ⚠️ Confirm execution? Add --confirm option or remove --dry-run
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**Default Dry-Run Operations:**
|
|
382
|
+
|
|
383
|
+
The following destructive operations have Dry-Run mode enabled by default and require explicit confirmation:
|
|
384
|
+
|
|
385
|
+
- Cancel order
|
|
386
|
+
- Delete product
|
|
387
|
+
- Batch update
|
|
388
|
+
|
|
389
|
+
### JSON Output Format
|
|
390
|
+
|
|
391
|
+
Barista CLI supports JSON output for script processing and AI integration:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
barista liberica orders list --json
|
|
395
|
+
|
|
396
|
+
# Output example:
|
|
397
|
+
{
|
|
398
|
+
"success": true,
|
|
399
|
+
"data": {
|
|
400
|
+
"items": [
|
|
401
|
+
{
|
|
402
|
+
"id": "12345",
|
|
403
|
+
"productName": "Coffee Machine Pro",
|
|
404
|
+
"quantity": 100,
|
|
405
|
+
"status": "in_production",
|
|
406
|
+
"createdAt": "2024-01-15T10:30:00Z"
|
|
407
|
+
}
|
|
408
|
+
],
|
|
409
|
+
"pagination": {
|
|
410
|
+
"page": 1,
|
|
411
|
+
"size": 20,
|
|
412
|
+
"total": 150
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Configuration
|
|
421
|
+
|
|
422
|
+
### Configuration File
|
|
423
|
+
|
|
424
|
+
The configuration file is located at `~/.barista/config.yaml`:
|
|
425
|
+
|
|
426
|
+
```yaml
|
|
427
|
+
# Barista CLI Configuration File
|
|
428
|
+
|
|
429
|
+
# Default context settings
|
|
430
|
+
defaults:
|
|
431
|
+
env: dev
|
|
432
|
+
tenant: electionjp
|
|
433
|
+
service: liberica
|
|
434
|
+
|
|
435
|
+
# Environment configuration
|
|
436
|
+
environments:
|
|
437
|
+
dev:
|
|
438
|
+
liberica:
|
|
439
|
+
baseUrl: "https://{tenant}-dev.newpeaksh.com"
|
|
440
|
+
timeout: 30000
|
|
441
|
+
arabica:
|
|
442
|
+
baseUrl: "https://arabica-dev.newpeaksh.com"
|
|
443
|
+
timeout: 30000
|
|
444
|
+
|
|
445
|
+
test:
|
|
446
|
+
liberica:
|
|
447
|
+
baseUrl: "https://{tenant}-test.newpeaksh.com"
|
|
448
|
+
timeout: 30000
|
|
449
|
+
arabica:
|
|
450
|
+
baseUrl: "https://arabica-test.newpeaksh.com"
|
|
451
|
+
timeout: 30000
|
|
452
|
+
|
|
453
|
+
prod-cn:
|
|
454
|
+
liberica:
|
|
455
|
+
baseUrl: "https://{tenant}.newpeaksh.com"
|
|
456
|
+
timeout: 60000
|
|
457
|
+
arabica:
|
|
458
|
+
baseUrl: "https://www.newpeaksh.com"
|
|
459
|
+
timeout: 60000
|
|
460
|
+
|
|
461
|
+
prod-jp:
|
|
462
|
+
liberica:
|
|
463
|
+
baseUrl: "https://{tenant}.newpeakjp.com"
|
|
464
|
+
timeout: 60000
|
|
465
|
+
arabica:
|
|
466
|
+
baseUrl: "https://members.newpeakjp.com"
|
|
467
|
+
timeout: 60000
|
|
468
|
+
|
|
469
|
+
# Output configuration
|
|
470
|
+
output:
|
|
471
|
+
format: table # table | json
|
|
472
|
+
color: true
|
|
473
|
+
timestamp: true
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Multi-Tenant Configuration
|
|
477
|
+
|
|
478
|
+
Supports configuring multiple tenants for quick switching:
|
|
479
|
+
|
|
480
|
+
```bash
|
|
481
|
+
# Add tenant configuration
|
|
482
|
+
barista config add-tenant \
|
|
483
|
+
--name customer-a \
|
|
484
|
+
--liberica-id customer-a-id \
|
|
485
|
+
--arabica-id customer-a-arabica-id
|
|
486
|
+
|
|
487
|
+
# List configured tenants
|
|
488
|
+
barista config list-tenants
|
|
489
|
+
|
|
490
|
+
# Quick switch tenant
|
|
491
|
+
barista context use-tenant customer-a
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
## AI Integration
|
|
497
|
+
|
|
498
|
+
Barista CLI is optimized for AI programming assistants, especially Claude Code.
|
|
499
|
+
|
|
500
|
+
### Claude Code Usage Examples
|
|
501
|
+
|
|
502
|
+
```typescript
|
|
503
|
+
// Using Barista CLI in Claude Code
|
|
504
|
+
// Example: Get order list and analyze
|
|
505
|
+
|
|
506
|
+
const result = await $`barista liberica orders list --json --page 1 --size 10`;
|
|
507
|
+
const orders = JSON.parse(result.stdout);
|
|
508
|
+
|
|
509
|
+
// Analyze order data
|
|
510
|
+
const analysis = orders.data.items.map(order => ({
|
|
511
|
+
id: order.id,
|
|
512
|
+
status: order.status,
|
|
513
|
+
amount: order.amount
|
|
514
|
+
}));
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Skills Files
|
|
518
|
+
|
|
519
|
+
Barista CLI provides Claude Code Skills files, located at:
|
|
520
|
+
|
|
521
|
+
```
|
|
522
|
+
~/.barista/claude/skills/
|
|
523
|
+
├── orders.md # Order management skills
|
|
524
|
+
├── products.md # Product management skills
|
|
525
|
+
├── quotes.md # Quote management skills
|
|
526
|
+
└── customers.md # Customer management skills
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
**Example Skills File:**
|
|
530
|
+
|
|
531
|
+
```markdown
|
|
532
|
+
# Order Management Skills
|
|
533
|
+
|
|
534
|
+
## List Pending Orders
|
|
535
|
+
|
|
536
|
+
When user asks about pending orders:
|
|
537
|
+
|
|
538
|
+
1. Execute command: barista liberica orders list --status pending --json
|
|
539
|
+
2. Parse the returned JSON
|
|
540
|
+
3. Summarize order count and total amount
|
|
541
|
+
4. List key information for the top 5 orders
|
|
542
|
+
|
|
543
|
+
## Create New Order
|
|
544
|
+
|
|
545
|
+
When user needs to create an order:
|
|
546
|
+
|
|
547
|
+
1. Confirm product ID and quantity
|
|
548
|
+
2. Use dry-run preview: barista liberica orders create --dry-run ...
|
|
549
|
+
3. Execute actual command after user confirmation
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### AI-Friendly Output
|
|
553
|
+
|
|
554
|
+
All commands support the `--json` option, returning structured JSON data:
|
|
555
|
+
|
|
556
|
+
```bash
|
|
557
|
+
# Query with structured output
|
|
558
|
+
barista liberica orders get 12345 --json
|
|
559
|
+
|
|
560
|
+
{
|
|
561
|
+
"success": true,
|
|
562
|
+
"data": {
|
|
563
|
+
"id": "12345",
|
|
564
|
+
"status": "in_production",
|
|
565
|
+
"product": {
|
|
566
|
+
"id": "100",
|
|
567
|
+
"name": "Coffee Machine Pro"
|
|
568
|
+
},
|
|
569
|
+
"quantity": 100,
|
|
570
|
+
"amount": 50000,
|
|
571
|
+
"timeline": {
|
|
572
|
+
"created": "2024-01-15T10:30:00Z",
|
|
573
|
+
"delivery": "2024-02-15"
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
"meta": {
|
|
577
|
+
"requestId": "req-abc123",
|
|
578
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## Development Guide
|
|
586
|
+
|
|
587
|
+
### Project Structure
|
|
588
|
+
|
|
589
|
+
```
|
|
590
|
+
coffee-barista-cli/
|
|
591
|
+
├── bin/
|
|
592
|
+
│ └── barista.js # Entry file
|
|
593
|
+
├── src/
|
|
594
|
+
│ ├── commands/ # Command implementations
|
|
595
|
+
│ │ ├── context/ # Context management commands
|
|
596
|
+
│ │ ├── auth/ # Authentication commands
|
|
597
|
+
│ │ ├── liberica/ # Liberica service commands
|
|
598
|
+
│ │ │ ├── orders.js
|
|
599
|
+
│ │ │ ├── products.js
|
|
600
|
+
│ │ │ └── production.js
|
|
601
|
+
│ │ ├── arabica/ # Arabica service commands
|
|
602
|
+
│ │ │ ├── products.js
|
|
603
|
+
│ │ │ ├── quotes.js
|
|
604
|
+
│ │ │ └── customers.js
|
|
605
|
+
│ │ └── cross/ # Cross-service commands
|
|
606
|
+
│ ├── core/ # Core modules
|
|
607
|
+
│ │ ├── auth.js # Authentication management
|
|
608
|
+
│ │ ├── config.js # Configuration management
|
|
609
|
+
│ │ ├── context.js # Context management
|
|
610
|
+
│ │ └── api-client.js # API client
|
|
611
|
+
│ ├── utils/ # Utility functions
|
|
612
|
+
│ │ ├── formatter.js # Output formatting
|
|
613
|
+
│ │ ├── validator.js # Parameter validation
|
|
614
|
+
│ │ └── keychain.js # Keychain operations
|
|
615
|
+
│ └── templates/ # Template files
|
|
616
|
+
├── skills/ # Claude Code Skills
|
|
617
|
+
├── tests/ # Test files
|
|
618
|
+
├── package.json
|
|
619
|
+
└── README.md
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### Local Development
|
|
623
|
+
|
|
624
|
+
```bash
|
|
625
|
+
# 1. Clone repository
|
|
626
|
+
git clone https://gitlab.newpeaksh.com/coffee/coffee-barista-cli.git
|
|
627
|
+
cd coffee-barista-cli
|
|
628
|
+
|
|
629
|
+
# 2. Install dependencies
|
|
630
|
+
npm install
|
|
631
|
+
|
|
632
|
+
# 3. Link globally (development mode)
|
|
633
|
+
npm link
|
|
634
|
+
|
|
635
|
+
# 4. Verify link
|
|
636
|
+
barista --version
|
|
637
|
+
|
|
638
|
+
# 5. Run tests
|
|
639
|
+
npm test
|
|
640
|
+
|
|
641
|
+
# 6. Code linting
|
|
642
|
+
npm run lint
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### Adding New Commands
|
|
646
|
+
|
|
647
|
+
**Important**: New commands must follow the [Command Design Specification](./docs/COMMAND_DESIGN_SPEC.md), including design documentation, technical review, and other complete processes.
|
|
648
|
+
|
|
649
|
+
For detailed steps, please refer to:
|
|
650
|
+
- [Complete Command Reference](./docs/commands/REFERENCE.md) - All command list and development priorities
|
|
651
|
+
- [Command Design Specification](./docs/COMMAND_DESIGN_SPEC.md#5-command-development-process)
|
|
652
|
+
- [Command Development Guide](./docs/COMMANDS.md)
|
|
653
|
+
|
|
654
|
+
---
|
|
655
|
+
|
|
656
|
+
## Contributing
|
|
657
|
+
|
|
658
|
+
We welcome all forms of contributions, including but not limited to:
|
|
659
|
+
|
|
660
|
+
- 🐛 Reporting bugs
|
|
661
|
+
- 💡 Suggesting new features
|
|
662
|
+
- 📝 Improving documentation
|
|
663
|
+
- 🔧 Submitting code fixes
|
|
664
|
+
- ✨ Adding new features
|
|
665
|
+
|
|
666
|
+
### Commit Conventions
|
|
667
|
+
|
|
668
|
+
Please follow [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
669
|
+
|
|
670
|
+
```bash
|
|
671
|
+
# Fix bug
|
|
672
|
+
fix: fix order list pagination issue
|
|
673
|
+
|
|
674
|
+
# Add feature
|
|
675
|
+
feat: add inventory query command
|
|
676
|
+
|
|
677
|
+
# Documentation update
|
|
678
|
+
docs: update environment mapping in README
|
|
679
|
+
|
|
680
|
+
# Code refactoring
|
|
681
|
+
refactor: refactor API client error handling
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
### Development Workflow
|
|
685
|
+
|
|
686
|
+
1. Fork this repository
|
|
687
|
+
2. Create feature branch: `git checkout -b feature/my-feature`
|
|
688
|
+
3. Commit changes: `git commit -m 'feat: add some feature'`
|
|
689
|
+
4. Push branch: `git push origin feature/my-feature`
|
|
690
|
+
5. Create Pull Request
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## Related Projects
|
|
695
|
+
|
|
696
|
+
| Project | Description | Link |
|
|
697
|
+
|---------|-------------|------|
|
|
698
|
+
| ☕ Liberica Backend | Production Management SaaS Backend | [coffee-liberica-end](https://gitlab.newpeaksh.com/coffee/coffee-liberica-end) |
|
|
699
|
+
| 🖥️ Liberica Frontend | Production Management Web Frontend | [coffee-liberica-front](https://gitlab.newpeaksh.com/coffee/coffee-liberica-front) |
|
|
700
|
+
| 📱 Liberica Mobile | Production Management Mobile | [coffee-liberica-mobile-front](https://gitlab.newpeaksh.com/coffee/coffee-liberica-mobile-front) |
|
|
701
|
+
| 🛒 Arabica Backend | Sales Platform Backend | [coffee-arabica-end](https://gitlab.newpeaksh.com/coffee/coffee-arabica-end) |
|
|
702
|
+
| 🌐 Arabica Frontend | Sales Platform Frontend | [coffee-arabica-front](https://gitlab.newpeaksh.com/coffee/coffee-arabica-front) |
|
|
703
|
+
|
|
704
|
+
---
|
|
705
|
+
|
|
706
|
+
## License
|
|
707
|
+
|
|
708
|
+
[MIT](LICENSE) © Newpeak Technology
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
<p align="center">
|
|
713
|
+
Powered by ☕
|
|
714
|
+
</p>
|