@newpeak/barista-cli 0.1.15 → 0.1.16
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.ja.md +209 -620
- package/README.md +206 -755
- package/README.vi.md +206 -623
- package/README.zh.md +340 -0
- package/dist/commands/liberica/orgs/batch-delete.d.ts +3 -0
- package/dist/commands/liberica/orgs/batch-delete.d.ts.map +1 -0
- package/dist/commands/liberica/orgs/batch-delete.js +109 -0
- package/dist/commands/liberica/orgs/batch-delete.js.map +1 -0
- package/dist/commands/liberica/orgs/create.d.ts +3 -0
- package/dist/commands/liberica/orgs/create.d.ts.map +1 -0
- package/dist/commands/liberica/orgs/create.js +131 -0
- package/dist/commands/liberica/orgs/create.js.map +1 -0
- package/dist/commands/liberica/orgs/disable.d.ts +3 -0
- package/dist/commands/liberica/orgs/disable.d.ts.map +1 -0
- package/dist/commands/liberica/orgs/disable.js +98 -0
- package/dist/commands/liberica/orgs/disable.js.map +1 -0
- package/dist/commands/liberica/orgs/enable.d.ts +3 -0
- package/dist/commands/liberica/orgs/enable.d.ts.map +1 -0
- package/dist/commands/liberica/orgs/enable.js +98 -0
- package/dist/commands/liberica/orgs/enable.js.map +1 -0
- package/dist/commands/liberica/orgs/get.d.ts +3 -0
- package/dist/commands/liberica/orgs/get.d.ts.map +1 -0
- package/dist/commands/liberica/orgs/get.js +79 -0
- package/dist/commands/liberica/orgs/get.js.map +1 -0
- package/dist/commands/liberica/orgs/index.d.ts.map +1 -1
- package/dist/commands/liberica/orgs/index.js +15 -21
- package/dist/commands/liberica/orgs/index.js.map +1 -1
- package/dist/commands/liberica/orgs/list.d.ts +3 -0
- package/dist/commands/liberica/orgs/list.d.ts.map +1 -0
- package/dist/commands/liberica/orgs/list.js +51 -0
- package/dist/commands/liberica/orgs/list.js.map +1 -0
- package/dist/commands/liberica/orgs/update.d.ts +3 -0
- package/dist/commands/liberica/orgs/update.d.ts.map +1 -0
- package/dist/commands/liberica/orgs/update.js +136 -0
- package/dist/commands/liberica/orgs/update.js.map +1 -0
- package/dist/core/api/client.d.ts +7 -1
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +128 -0
- package/dist/core/api/client.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/org.d.ts +38 -0
- package/dist/types/org.d.ts.map +1 -1
- package/package.json +1 -1
- package/README.en.md +0 -757
package/README.md
CHANGED
|
@@ -1,630 +1,268 @@
|
|
|
1
1
|
# ☕ Barista CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
<a href="https://gitlab.newpeaksh.com/coffee/coffee-barista-cli/blob/develop/README.md"><img src="https://img.shields.io/badge/-简体中文-green?style=flat-square" alt="简体中文"></a>
|
|
5
|
-
<a href="https://gitlab.newpeaksh.com/coffee/coffee-barista-cli/blob/develop/README.en.md"><img src="https://img.shields.io/badge/-English-blue?style=flat-square" alt="English"></a>
|
|
6
|
-
<a href="https://gitlab.newpeaksh.com/coffee/coffee-barista-cli/blob/develop/README.ja.md"><img src="https://img.shields.io/badge/-日本語-red?style=flat-square" alt="日本語"></a>
|
|
7
|
-
<a href="https://gitlab.newpeaksh.com/coffee/coffee-barista-cli/blob/develop/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-在线订阅%20SaaS-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 工具</strong>,无缝桥接 Liberica 生产管理 SaaS 与 Arabica 在线订阅 SaaS 服务
|
|
19
|
-
</p>
|
|
3
|
+
> **Let AI assistants control production management systems** — Bridge AI tools (Claude Code, OpenCode, OpenClaw) to enterprise SaaS
|
|
20
4
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- [项目简介](#项目简介)
|
|
26
|
-
- [快速开始](#快速开始)
|
|
27
|
-
- [架构设计](#架构设计)
|
|
28
|
-
- [命令文档](#命令文档)
|
|
29
|
-
- [高级特性](#高级特性)
|
|
30
|
-
- [配置说明](#配置说明)
|
|
31
|
-
- [AI 集成](#AI-集成)
|
|
32
|
-
- [开发指南](#开发指南)
|
|
33
|
-
- [贡献指南](#贡献指南)
|
|
5
|
+
[](https://www.npmjs.com/package/@newpeak/barista-cli)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/@newpeak/barista-cli)
|
|
8
|
+
[](https://nodejs.org/)
|
|
34
9
|
|
|
35
10
|
---
|
|
36
11
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
Barista CLI 是专为 Newpeak 生态系统设计的 AI-Native 命令行工具。它提供统一的接口来管理 Liberica 生产管理 SaaS 和 Arabica 在线订阅 SaaS 服务。
|
|
12
|
+
## ⚡ Quick Start
|
|
40
13
|
|
|
41
|
-
###
|
|
42
|
-
|
|
43
|
-
| 特性 | 说明 |
|
|
44
|
-
|------|------|
|
|
45
|
-
| 🌍 **多环境支持** | dev、test、prod-cn、prod-jp 四环境无缝切换 |
|
|
46
|
-
| 🏢 **多租户架构** | 支持多租户环境配置与隔离 |
|
|
47
|
-
| 🔐 **Token 认证** | 安全存储于系统密钥链,环境隔离 |
|
|
48
|
-
| 🧪 **Dry-Run 模式** | 所有写入操作支持预览,避免误操作 |
|
|
49
|
-
| 🤖 **AI 集成** | 为 Claude Code 优化的 JSON 输出格式 |
|
|
50
|
-
| 🔄 **跨服务操作** | Liberica 与 Arabica 之间的数据同步 |
|
|
51
|
-
|
|
52
|
-
### 适用场景
|
|
53
|
-
|
|
54
|
-
- **生产计划管理**:创建、查询、取消生产订单
|
|
55
|
-
- **产品数据管理**:跨平台搜索、同步产品信息
|
|
56
|
-
- **客户操作**:查询客户信息、生成报价单
|
|
57
|
-
- **AI 自动化**:通过 Claude Code 实现业务流程自动化
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## 快速开始
|
|
62
|
-
|
|
63
|
-
### 安装
|
|
14
|
+
### 1. Install
|
|
64
15
|
|
|
65
16
|
```bash
|
|
66
|
-
# 通过 npm 安装
|
|
67
17
|
npm install -g @newpeak/barista-cli
|
|
68
|
-
|
|
69
|
-
# 或通过 yarn
|
|
70
|
-
yarn global add @newpeak/barista-cli
|
|
71
|
-
|
|
72
|
-
# 验证安装
|
|
73
|
-
barista --version
|
|
74
18
|
```
|
|
75
19
|
|
|
76
|
-
###
|
|
20
|
+
### 2. Authenticate
|
|
77
21
|
|
|
78
22
|
```bash
|
|
79
|
-
#
|
|
80
|
-
barista
|
|
81
|
-
|
|
82
|
-
# 2. 使用凭证登录(推荐方式,自动设置环境和租户)
|
|
83
|
-
barista liberica auth login dev your-tenant your-username your-password
|
|
23
|
+
# AI needs credentials to operate on behalf of user
|
|
24
|
+
barista liberica auth login prod-cn your-tenant your-username your-password
|
|
84
25
|
|
|
85
|
-
#
|
|
26
|
+
# Interactive login (prompts for missing info)
|
|
86
27
|
barista liberica auth login
|
|
87
|
-
|
|
88
|
-
# 3. 验证登录状态
|
|
89
|
-
barista auth status
|
|
90
|
-
|
|
91
|
-
# 4. 查看当前上下文(确认环境已自动设置)
|
|
92
|
-
barista context show
|
|
93
28
|
```
|
|
94
29
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### 基本使用示例
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
# 查看当前上下文
|
|
101
|
-
barista context show
|
|
102
|
-
|
|
103
|
-
# 列出所有订单(Liberica)
|
|
104
|
-
barista liberica orders list
|
|
105
|
-
|
|
106
|
-
# 搜索产品(支持模糊查询)
|
|
107
|
-
barista liberica products search --keyword "咖啡机"
|
|
108
|
-
|
|
109
|
-
# 查看 Arabica 产品目录
|
|
110
|
-
barista arabica products public-catalog
|
|
111
|
-
|
|
112
|
-
# 创建生产订单(dry-run 模式预览)
|
|
113
|
-
barista liberica orders create --product-id 123 --quantity 100 --dry-run
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## 架构设计
|
|
30
|
+
### 3. AI Integration
|
|
119
31
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
| 环境 | 域名格式 | 说明 |
|
|
125
|
-
|------|----------|------|
|
|
126
|
-
| dev | `{tenant}-dev.newpeaksh.com` | 开发环境 |
|
|
127
|
-
| test | `{tenant}-test.newpeaksh.com` | 测试环境 |
|
|
128
|
-
| prod-cn | `{tenant}.newpeaksh.com` | 中国生产环境 |
|
|
129
|
-
| prod-jp | `{tenant}.newpeakjp.com` | 日本生产环境 |
|
|
130
|
-
|
|
131
|
-
#### Arabica(在线订阅 SaaS 服务)
|
|
132
|
-
|
|
133
|
-
| 环境 | 域名 | 说明 |
|
|
134
|
-
|------|------|------|
|
|
135
|
-
| dev | `arabica-dev.newpeaksh.com` | 开发环境 |
|
|
136
|
-
| test | `arabica-test.newpeaksh.com` | 测试环境 |
|
|
137
|
-
| prod-cn | `www.newpeaksh.com` | 中国生产环境 |
|
|
138
|
-
| prod-jp | `members.newpeakjp.com` | 日本生产环境 |
|
|
139
|
-
|
|
140
|
-
### 认证机制
|
|
141
|
-
|
|
142
|
-
Barista CLI 采用 Token-based 认证机制:
|
|
32
|
+
```typescript
|
|
33
|
+
// In Claude Code / OpenCode / OpenClaw:
|
|
34
|
+
const orders = await $`barista liberica orders list --env prod-cn --tenant your-tenant --json`
|
|
35
|
+
const { success, data } = JSON.parse(orders.stdout)
|
|
143
36
|
|
|
37
|
+
// AI parses and acts on the data
|
|
38
|
+
if (data.items.length > 0) {
|
|
39
|
+
console.log(`Found ${data.pagination.total} orders`)
|
|
40
|
+
}
|
|
144
41
|
```
|
|
145
|
-
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
|
|
146
|
-
│ Barista CLI │────▶│ Auth Server │────▶│ API Servers │
|
|
147
|
-
│ │ │ │ │ │
|
|
148
|
-
│ • 登录请求 │ │ • 验证凭证 │ │ • 验证 Token │
|
|
149
|
-
│ • 存储 Token │◀────│ • 签发 JWT │◀────│ • 返回数据 │
|
|
150
|
-
│ (系统密钥链) │ │ │ │ │
|
|
151
|
-
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**安全特性:**
|
|
155
42
|
|
|
156
|
-
|
|
157
|
-
- **自动跳过认证**:公开接口(如产品目录查询)无需认证
|
|
158
|
-
- **环境隔离**:每个环境和租户使用独立的 Token,互不影响
|
|
159
|
-
- **Token 刷新**:支持自动刷新即将过期的 Token
|
|
43
|
+
**[View AI Integration Examples →](#ai-integration)**
|
|
160
44
|
|
|
161
45
|
---
|
|
162
46
|
|
|
163
|
-
##
|
|
164
|
-
|
|
165
|
-
> **完整命令清单**: 所有命令的完整参考(包括已实现和待开发状态)请查看 [命令参考](./docs/commands/REFERENCE.md)。
|
|
166
|
-
|
|
167
|
-
### 命令结构
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
barista <service> <resource> <action> [options]
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
**示例:**
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
barista liberica orders list --page 1 --size 20
|
|
177
|
-
barista arabica quotes calculate --product-id 123 --quantity 10
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### 全局选项
|
|
47
|
+
## 🤖 AI Integration
|
|
181
48
|
|
|
182
|
-
|
|
183
|
-
|------|------|------|
|
|
184
|
-
| `--env` | 指定环境 | `--env prod-cn` |
|
|
185
|
-
| `--tenant` | 指定租户 | `--tenant electionjp` |
|
|
186
|
-
| `--service` | 指定服务 | `--service liberica` |
|
|
187
|
-
| `--dry-run` | 预览模式 | `--dry-run` |
|
|
188
|
-
| `--json` | JSON 输出 | `--json` |
|
|
189
|
-
| `--help` | 显示帮助 | `--help` |
|
|
49
|
+
Barista CLI is designed for AI coding assistants. Every output is structured, every error is actionable.
|
|
190
50
|
|
|
191
|
-
###
|
|
51
|
+
### Supported AI Tools
|
|
192
52
|
|
|
193
|
-
|
|
53
|
+
| AI Tool | Integration Method | Status |
|
|
54
|
+
|---------|-------------------|--------|
|
|
55
|
+
| **Claude Code** | `$` backticks + `--json` | ✅ Verified |
|
|
56
|
+
| **OpenCode** | Shell command + JSON parse | ✅ Verified |
|
|
57
|
+
| **OpenClaw** | Shell command + JSON parse | ✅ Verified |
|
|
58
|
+
| **Cursor** | Terminal integration | ✅ Compatible |
|
|
59
|
+
| **Continue** | CLI subprocess | ✅ Compatible |
|
|
194
60
|
|
|
195
|
-
|
|
196
|
-
# 查看当前上下文
|
|
197
|
-
barista context show
|
|
198
|
-
|
|
199
|
-
# 输出示例:
|
|
200
|
-
# ┌─────────────┬─────────────────┐
|
|
201
|
-
# │ 属性 │ 值 │
|
|
202
|
-
# ├─────────────┼─────────────────┤
|
|
203
|
-
# │ 当前环境 │ dev │
|
|
204
|
-
# │ 当前租户 │ electionjp │
|
|
205
|
-
# │ 当前服务 │ liberica │
|
|
206
|
-
# │ Token 状态 │ 已登录 │
|
|
207
|
-
# │ Token 过期 │ 2024-12-31 │
|
|
208
|
-
# └─────────────┴─────────────────┘
|
|
209
|
-
|
|
210
|
-
# 切换环境
|
|
211
|
-
barista context use-env [dev|test|prod-cn|prod-jp]
|
|
212
|
-
|
|
213
|
-
# 切换租户
|
|
214
|
-
barista context use-tenant <tenant-name>
|
|
215
|
-
|
|
216
|
-
# 切换默认服务
|
|
217
|
-
barista context use-service [liberica|arabica]
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### 认证管理
|
|
221
|
-
|
|
222
|
-
Barista CLI 提供两种登录方式:
|
|
223
|
-
|
|
224
|
-
#### 1. 凭证登录(推荐)
|
|
225
|
-
使用用户名和密码进行完整认证流程,自动获取并存储 Token:
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
# Liberica 凭证登录
|
|
229
|
-
barista liberica auth login <env> [tenant] [username] [password]
|
|
61
|
+
### Integration Pattern
|
|
230
62
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
# 示例:存储 Liberica 开发环境 Token
|
|
248
|
-
barista auth login --service liberica --env dev --tenant electionjp
|
|
249
|
-
# 提示: Enter your token: [输入已有 Token]
|
|
250
|
-
|
|
251
|
-
# 检查登录状态
|
|
252
|
-
barista auth status
|
|
253
|
-
|
|
254
|
-
# 输出示例:
|
|
255
|
-
# ✓ Liberica (dev) - 已登录 (过期: 2024-12-31)
|
|
256
|
-
# ✗ Liberica (test) - 未登录
|
|
257
|
-
# ✓ Arabica (prod-cn) - 已登录 (过期: 2024-12-30)
|
|
258
|
-
|
|
259
|
-
# 登出(清除 Token)
|
|
260
|
-
barista auth logout --service <service> --env <env>
|
|
261
|
-
|
|
262
|
-
# 登出所有环境
|
|
263
|
-
barista auth logout --all
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
**重要**:使用 `barista liberica auth login` 登录后,系统会自动设置当前环境上下文,后续命令无需指定 `--env` 参数。
|
|
267
|
-
|
|
268
|
-
### Liberica 命令
|
|
269
|
-
|
|
270
|
-
#### 订单管理
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
# 列出订单(分页)
|
|
274
|
-
barista liberica orders list [--page <n>] [--size <n>] [--status <status>]
|
|
275
|
-
|
|
276
|
-
# 获取单个订单详情
|
|
277
|
-
barista liberica orders get <order-id>
|
|
278
|
-
|
|
279
|
-
# 创建订单
|
|
280
|
-
barista liberica orders create \
|
|
281
|
-
--product-id <id> \
|
|
282
|
-
--quantity <n> \
|
|
283
|
-
[--delivery-date <date>] \
|
|
284
|
-
[--note <text>]
|
|
285
|
-
|
|
286
|
-
# 取消订单
|
|
287
|
-
barista liberica orders cancel <order-id> [--reason <text>]
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
#### 产品管理
|
|
63
|
+
```typescript
|
|
64
|
+
// 1. Execute command with JSON output
|
|
65
|
+
const result = await $`barista liberica orders list \
|
|
66
|
+
--env prod-cn \
|
|
67
|
+
--tenant your-tenant \
|
|
68
|
+
--status pending \
|
|
69
|
+
--json \
|
|
70
|
+
--page 1 \
|
|
71
|
+
--size 50`
|
|
72
|
+
|
|
73
|
+
// 2. Parse structured response
|
|
74
|
+
const { success, data, meta } = JSON.parse(result.stdout)
|
|
75
|
+
|
|
76
|
+
if (!success) {
|
|
77
|
+
throw new Error(`API Error: ${meta.code || meta.error?.code} - ${meta.message || meta.error?.message}`)
|
|
78
|
+
}
|
|
291
79
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
80
|
+
// 3. Work with data
|
|
81
|
+
const pendingOrders = data.items
|
|
82
|
+
console.log(`Found ${data.pagination.total} pending orders`)
|
|
295
83
|
|
|
296
|
-
|
|
297
|
-
|
|
84
|
+
// 4. Execute operations safely
|
|
85
|
+
for (const order of pendingOrders) {
|
|
86
|
+
// Always dry-run first (AI safety)
|
|
87
|
+
const preview = await $`barista liberica orders cancel ${order.id} --dry-run`
|
|
298
88
|
|
|
299
|
-
|
|
300
|
-
|
|
89
|
+
// Parse preview, verify, then execute with --force
|
|
90
|
+
// ...
|
|
91
|
+
}
|
|
301
92
|
```
|
|
302
93
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
```bash
|
|
306
|
-
# 查看生产排期
|
|
307
|
-
barista liberica production schedule [--start-date <date>] [--end-date <date>]
|
|
94
|
+
### Response Envelope
|
|
308
95
|
|
|
309
|
-
|
|
310
|
-
barista liberica production reschedule <order-id> --new-date <date> [--dry-run]
|
|
96
|
+
All JSON responses follow this structure:
|
|
311
97
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
barista liberica warehouses create --code <code> --name <name> \
|
|
327
|
-
[--type <type>] [--classes <classes>] [--address <address>] \
|
|
328
|
-
[--contact <contact>] [--phone <phone>] [--manager <manager>] \
|
|
329
|
-
[--enable-location] [--enable-negative-inventory] [--remark <remark>]
|
|
330
|
-
|
|
331
|
-
# 更新仓库
|
|
332
|
-
barista liberica warehouses update <warehouse-id> \
|
|
333
|
-
[--name <name>] [--type <type>] [--classes <classes>] [--address <address>] \
|
|
334
|
-
[--contact <contact>] [--phone <phone>] [--manager <manager>] \
|
|
335
|
-
[--enable-location] [--disable-location] \
|
|
336
|
-
[--enable-negative-inventory] [--disable-negative-inventory] \
|
|
337
|
-
[--remark <remark>]
|
|
338
|
-
|
|
339
|
-
# 删除仓库(默认 Dry-Run,需 --force 确认)
|
|
340
|
-
barista liberica warehouses delete <warehouse-id> [--force]
|
|
341
|
-
|
|
342
|
-
# 启用仓库
|
|
343
|
-
barista liberica warehouses enable <warehouse-id> [--force] [--dry-run]
|
|
344
|
-
|
|
345
|
-
# 禁用仓库
|
|
346
|
-
barista liberica warehouses disable <warehouse-id> [--force] [--dry-run]
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"success": true,
|
|
101
|
+
"data": {
|
|
102
|
+
"items": [...],
|
|
103
|
+
"pagination": { "page": 1, "size": 20, "total": 150 }
|
|
104
|
+
},
|
|
105
|
+
"meta": {
|
|
106
|
+
"requestId": "req-abc123",
|
|
107
|
+
"timestamp": "2024-01-15T10:30:00Z",
|
|
108
|
+
"environment": "prod-cn",
|
|
109
|
+
"tenant": "your-tenant"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
347
112
|
```
|
|
348
113
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
```bash
|
|
352
|
-
# 列出库位(分页)
|
|
353
|
-
barista liberica warehouses locations list --warehouse-id <id> \
|
|
354
|
-
[--page <n>] [--size <n>] [--status <status>] [--name <name>] [--code <code>]
|
|
355
|
-
|
|
356
|
-
# 获取库位详情
|
|
357
|
-
barista liberica warehouses locations get <location-id>
|
|
114
|
+
**Error format:**
|
|
358
115
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
barista liberica warehouses locations enable <location-id> [--force] [--dry-run]
|
|
372
|
-
|
|
373
|
-
# 禁用库位
|
|
374
|
-
barista liberica warehouses locations disable <location-id> [--force] [--dry-run]
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"success": false,
|
|
119
|
+
"error": {
|
|
120
|
+
"code": "A150001",
|
|
121
|
+
"message": "Order not found"
|
|
122
|
+
},
|
|
123
|
+
"meta": {
|
|
124
|
+
"requestId": "req-xyz789",
|
|
125
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
375
128
|
```
|
|
376
129
|
|
|
377
|
-
###
|
|
378
|
-
|
|
379
|
-
> Arabica 命令实现完整的 SaaS 订阅流程管理,包括套餐浏览、订阅管理、订单处理、发票查看等。
|
|
380
|
-
|
|
381
|
-
#### 认证管理
|
|
382
|
-
|
|
383
|
-
```bash
|
|
384
|
-
# 登录 Arabica
|
|
385
|
-
barista arabica auth login <account> <password>
|
|
386
|
-
|
|
387
|
-
# 注册新会员
|
|
388
|
-
barista arabica auth register --email <email> --account <account> --password <password>
|
|
389
|
-
|
|
390
|
-
# 查看登录状态
|
|
391
|
-
barista arabica auth status
|
|
392
|
-
|
|
393
|
-
# 登出
|
|
394
|
-
barista arabica auth logout
|
|
395
|
-
```
|
|
130
|
+
### Skills for Claude Code
|
|
396
131
|
|
|
397
|
-
|
|
132
|
+
Install reusable skill files:
|
|
398
133
|
|
|
399
134
|
```bash
|
|
400
|
-
#
|
|
401
|
-
barista
|
|
402
|
-
|
|
403
|
-
# 查看套餐详情
|
|
404
|
-
barista arabica plans get <plan-id>
|
|
405
|
-
|
|
406
|
-
# 对比两个套餐
|
|
407
|
-
barista arabica plans compare <plan-a> <plan-b>
|
|
135
|
+
# Skills are located at ~/.barista/claude/skills/
|
|
136
|
+
barista skills install
|
|
408
137
|
```
|
|
409
138
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
139
|
+
**Available skills:**
|
|
140
|
+
- `orders.md` — Order management workflow
|
|
141
|
+
- `products.md` — Product search and sync
|
|
142
|
+
- `warehouses.md` — Inventory operations
|
|
143
|
+
- `subscriptions.md` — Arabica subscription management
|
|
415
144
|
|
|
416
|
-
|
|
417
|
-
barista arabica subscription upgrade <plan-id> [--seats <n>]
|
|
418
|
-
|
|
419
|
-
# 降级订阅
|
|
420
|
-
barista arabica subscription downgrade <plan-id>
|
|
421
|
-
|
|
422
|
-
# 取消订阅
|
|
423
|
-
barista arabica subscription cancel [--confirm]
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
#### 订单管理
|
|
145
|
+
---
|
|
427
146
|
|
|
428
|
-
|
|
429
|
-
# 查看订单列表
|
|
430
|
-
barista arabica orders list [--status pending|paid|cancelled|refunded]
|
|
147
|
+
## 🚀 Features
|
|
431
148
|
|
|
432
|
-
|
|
433
|
-
barista arabica orders get <order-id>
|
|
149
|
+
### AI-First Design
|
|
434
150
|
|
|
435
|
-
|
|
436
|
-
|
|
151
|
+
| Feature | Description |
|
|
152
|
+
|---------|-------------|
|
|
153
|
+
| 🤖 **JSON-First Output** | All commands support `--json` for AI parsing |
|
|
154
|
+
| 📦 **Structured Responses** | Consistent `{success, data, meta}` envelope |
|
|
155
|
+
| 🔄 **Idempotent Operations** | Safe for AI retry loops |
|
|
156
|
+
| 🛡️ **Dry-Run by Default** | Destructive operations preview before execution |
|
|
157
|
+
| 🔐 **Secure Storage** | Credentials in system keychain, not env vars |
|
|
437
158
|
|
|
438
|
-
|
|
439
|
-
barista arabica orders cancel <order-id>
|
|
440
|
-
```
|
|
159
|
+
### Enterprise Connectivity
|
|
441
160
|
|
|
442
|
-
|
|
161
|
+
| Service | Capabilities |
|
|
162
|
+
|---------|-------------|
|
|
163
|
+
| ☕ **Liberica** | Orders, products, inventory, warehouses, production planning |
|
|
164
|
+
| 🛒 **Arabica** | Subscription plans, billing, invoices, enterprise management |
|
|
165
|
+
| 🔗 **Cross-Service** | Quote from order, sync between systems |
|
|
443
166
|
|
|
444
|
-
|
|
445
|
-
# 查看发票列表
|
|
446
|
-
barista arabica invoices list [--year 2026]
|
|
167
|
+
### Operational Safety
|
|
447
168
|
|
|
448
|
-
|
|
449
|
-
|
|
169
|
+
- 📊 **Audit Trail** — Every operation logged with request ID
|
|
170
|
+
- ⚠️ **Confirmation Guards** — `--dry-run` / `--force` for write operations
|
|
171
|
+
- 🏢 **Multi-Tenant Isolation** — Credentials isolated per tenant
|
|
450
172
|
|
|
451
|
-
|
|
452
|
-
barista arabica invoices download <invoice-id> [--output <path>]
|
|
453
|
-
```
|
|
173
|
+
---
|
|
454
174
|
|
|
455
|
-
|
|
175
|
+
## 🔧 Command Reference
|
|
456
176
|
|
|
457
|
-
|
|
458
|
-
# 查看当前用量
|
|
459
|
-
barista arabica usage current
|
|
177
|
+
### Core Pattern
|
|
460
178
|
|
|
461
|
-
# 查看用量历史
|
|
462
|
-
barista arabica usage history [--period 30d|90d|1y]
|
|
463
179
|
```
|
|
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>
|
|
180
|
+
barista <service> <resource> <action> [options]
|
|
480
181
|
```
|
|
481
182
|
|
|
482
|
-
|
|
183
|
+
### Global Options
|
|
483
184
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
185
|
+
| Option | Description | Default |
|
|
186
|
+
|--------|-------------|---------|
|
|
187
|
+
| `--env` | Environment (dev\|test\|prod-cn\|prod-jp) | `dev` |
|
|
188
|
+
| `--tenant` | Tenant name | - |
|
|
189
|
+
| `--json` | JSON output | `false` |
|
|
190
|
+
| `--dry-run` | Preview mode (recommended for AI) | `false` |
|
|
191
|
+
| `--force` | Skip confirmation | `false` |
|
|
192
|
+
| `--page` | Page number | `1` |
|
|
193
|
+
| `--size` | Page size (max items) | `20` |
|
|
488
194
|
|
|
489
|
-
###
|
|
195
|
+
### Quick Reference
|
|
490
196
|
|
|
491
|
-
|
|
197
|
+
| Command | Description |
|
|
198
|
+
|---------|-------------|
|
|
199
|
+
| `barista context show` | Show current env/tenant context |
|
|
200
|
+
| `barista context use-env <env>` | Switch environment |
|
|
201
|
+
| `barista liberica orders list --json` | List orders (AI format) |
|
|
202
|
+
| `barista liberica orders get <id> --json` | Get order detail |
|
|
203
|
+
| `barista liberica orders create --dry-run ...` | Preview create |
|
|
204
|
+
| `barista liberica products search --keyword <kw> --json` | Search products |
|
|
205
|
+
| `barista arabica plans list --json` | List subscription plans |
|
|
206
|
+
| `barista arabica invoices list --json` | List invoices |
|
|
492
207
|
|
|
493
|
-
|
|
494
|
-
# 从订单生成报价单
|
|
495
|
-
barista cross quote-from-order <order-id> [--target-service arabica]
|
|
496
|
-
|
|
497
|
-
# 输出示例:
|
|
498
|
-
# ✓ 已生成报价单
|
|
499
|
-
# ┌──────────┬────────────┐
|
|
500
|
-
# │ 属性 │ 值 │
|
|
501
|
-
# ├──────────┼────────────┤
|
|
502
|
-
# │ 订单ID │ 12345 │
|
|
503
|
-
# │ 报价单ID │ QT-2024-001│
|
|
504
|
-
# │ 金额 │ ¥50,000 │
|
|
505
|
-
# │ 有效期 │ 30天 │
|
|
506
|
-
# └──────────┴────────────┘
|
|
507
|
-
|
|
508
|
-
# 同步订单状态到 Arabica
|
|
509
|
-
barista cross sync-order <order-id> [--direction liberica-to-arabica]
|
|
510
|
-
```
|
|
208
|
+
**[→ Full Command Reference](./docs/commands/REFERENCE.md)**
|
|
511
209
|
|
|
512
210
|
---
|
|
513
211
|
|
|
514
|
-
##
|
|
212
|
+
## 🛡️ AI Safety Guidelines
|
|
515
213
|
|
|
516
|
-
### Dry-Run
|
|
214
|
+
### 1. Always Dry-Run First
|
|
517
215
|
|
|
518
|
-
|
|
216
|
+
```typescript
|
|
217
|
+
// ❌ Wrong - executing blindly
|
|
218
|
+
await $`barista liberica orders cancel 12345`
|
|
519
219
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
# 输出示例:
|
|
525
|
-
# 🔍 Dry-Run 模式:操作不会被实际执行
|
|
526
|
-
# ┌─────────────────┬──────────────────────┐
|
|
527
|
-
# │ 操作 │ 创建订单 │
|
|
528
|
-
# ├─────────────────┼──────────────────────┤
|
|
529
|
-
# │ 产品 │ 咖啡机 Pro (ID: 123) │
|
|
530
|
-
# │ 数量 │ 100 │
|
|
531
|
-
# │ 预计金额 │ ¥50,000 │
|
|
532
|
-
# │ 预计交期 │ 2024-12-31 │
|
|
533
|
-
# │ 影响 │ 新增一条订单记录 │
|
|
534
|
-
# └─────────────────┴──────────────────────┘
|
|
535
|
-
#
|
|
536
|
-
# ⚠️ 确认执行?添加 --confirm 选项或移除 --dry-run
|
|
220
|
+
// ✅ Correct - preview first
|
|
221
|
+
const preview = await $`barista liberica orders cancel 12345 --dry-run`
|
|
222
|
+
// Parse preview, verify correctness, then:
|
|
223
|
+
await $`barista liberica orders cancel 12345 --force`
|
|
537
224
|
```
|
|
538
225
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
以下破坏性操作默认启用 Dry-Run 模式,需显式确认:
|
|
542
|
-
|
|
543
|
-
- 取消订单
|
|
544
|
-
- 删除产品
|
|
545
|
-
- 批量更新
|
|
226
|
+
### 2. Check Success Before Proceeding
|
|
546
227
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
barista liberica orders list --json
|
|
553
|
-
|
|
554
|
-
# 输出示例:
|
|
555
|
-
{
|
|
556
|
-
"success": true,
|
|
557
|
-
"data": {
|
|
558
|
-
"items": [
|
|
559
|
-
{
|
|
560
|
-
"id": "12345",
|
|
561
|
-
"productName": "咖啡机 Pro",
|
|
562
|
-
"quantity": 100,
|
|
563
|
-
"status": "in_production",
|
|
564
|
-
"createdAt": "2024-01-15T10:30:00Z"
|
|
565
|
-
}
|
|
566
|
-
],
|
|
567
|
-
"pagination": {
|
|
568
|
-
"page": 1,
|
|
569
|
-
"size": 20,
|
|
570
|
-
"total": 150
|
|
571
|
-
}
|
|
572
|
-
}
|
|
228
|
+
```typescript
|
|
229
|
+
const result = JSON.parse(stdout)
|
|
230
|
+
if (!result.success) {
|
|
231
|
+
// Handle error, don't continue
|
|
232
|
+
throw new Error(result.error?.message || result.meta?.message)
|
|
573
233
|
}
|
|
574
234
|
```
|
|
575
235
|
|
|
576
|
-
###
|
|
577
|
-
|
|
578
|
-
Barista CLI 支持 CSV 格式导出,适用于数据分析及 Excel 处理:
|
|
236
|
+
### 3. Use Request IDs for Debugging
|
|
579
237
|
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
# 输出特性:
|
|
585
|
-
# • UTF-8 with BOM 编码,确保 Excel 正确识别中文
|
|
586
|
-
# • 自动转义特殊字符(逗号、引号、换行符)
|
|
587
|
-
# • 支持自定义输出文件路径
|
|
588
|
-
# • 可配合 --json 同时输出两种格式
|
|
238
|
+
```typescript
|
|
239
|
+
const { meta } = JSON.parse(stdout)
|
|
240
|
+
console.log(`Request ID: ${meta.requestId}`)
|
|
589
241
|
```
|
|
590
242
|
|
|
591
|
-
|
|
243
|
+
### 4. Respect Rate Limits
|
|
244
|
+
|
|
245
|
+
- Add delays between bulk operations
|
|
246
|
+
- Use `--size 100` for bulk fetches
|
|
247
|
+
- Cache responses when appropriate
|
|
592
248
|
|
|
593
249
|
---
|
|
594
250
|
|
|
595
|
-
##
|
|
251
|
+
## ⚙️ Configuration
|
|
596
252
|
|
|
597
|
-
###
|
|
253
|
+
### File Location
|
|
598
254
|
|
|
599
|
-
|
|
255
|
+
`~/.barista/config.yaml`
|
|
600
256
|
|
|
601
|
-
|
|
602
|
-
# Barista CLI 配置文件
|
|
257
|
+
### Quick Config
|
|
603
258
|
|
|
604
|
-
|
|
259
|
+
```yaml
|
|
605
260
|
defaults:
|
|
606
|
-
env:
|
|
607
|
-
tenant:
|
|
261
|
+
env: prod-cn
|
|
262
|
+
tenant: your-tenant
|
|
608
263
|
service: liberica
|
|
609
264
|
|
|
610
|
-
# 环境配置
|
|
611
265
|
environments:
|
|
612
|
-
dev:
|
|
613
|
-
liberica:
|
|
614
|
-
baseUrl: "https://{tenant}-dev.newpeaksh.com"
|
|
615
|
-
timeout: 30000
|
|
616
|
-
arabica:
|
|
617
|
-
baseUrl: "https://arabica-dev.newpeaksh.com"
|
|
618
|
-
timeout: 30000
|
|
619
|
-
|
|
620
|
-
test:
|
|
621
|
-
liberica:
|
|
622
|
-
baseUrl: "https://{tenant}-test.newpeaksh.com"
|
|
623
|
-
timeout: 30000
|
|
624
|
-
arabica:
|
|
625
|
-
baseUrl: "https://arabica-test.newpeaksh.com"
|
|
626
|
-
timeout: 30000
|
|
627
|
-
|
|
628
266
|
prod-cn:
|
|
629
267
|
liberica:
|
|
630
268
|
baseUrl: "https://{tenant}.newpeaksh.com"
|
|
@@ -632,258 +270,71 @@ environments:
|
|
|
632
270
|
arabica:
|
|
633
271
|
baseUrl: "https://www.newpeaksh.com"
|
|
634
272
|
timeout: 60000
|
|
635
|
-
|
|
636
|
-
prod-jp:
|
|
637
|
-
liberica:
|
|
638
|
-
baseUrl: "https://{tenant}.newpeakjp.com"
|
|
639
|
-
timeout: 60000
|
|
640
|
-
arabica:
|
|
641
|
-
baseUrl: "https://members.newpeakjp.com"
|
|
642
|
-
timeout: 60000
|
|
643
|
-
|
|
644
|
-
# 输出配置
|
|
645
|
-
output:
|
|
646
|
-
format: table # table | json
|
|
647
|
-
color: true
|
|
648
|
-
timestamp: true
|
|
649
273
|
```
|
|
650
274
|
|
|
651
|
-
###
|
|
652
|
-
|
|
653
|
-
支持配置多个租户,快速切换:
|
|
275
|
+
### Authentication
|
|
654
276
|
|
|
655
277
|
```bash
|
|
656
|
-
#
|
|
657
|
-
barista
|
|
658
|
-
--name customer-a \
|
|
659
|
-
--liberica-id customer-a-id \
|
|
660
|
-
--arabica-id customer-a-arabica-id
|
|
278
|
+
# Credential login (recommended)
|
|
279
|
+
barista liberica auth login <env> <tenant> <username> <password>
|
|
661
280
|
|
|
662
|
-
#
|
|
663
|
-
barista
|
|
281
|
+
# Check auth status
|
|
282
|
+
barista auth status
|
|
664
283
|
|
|
665
|
-
#
|
|
666
|
-
barista
|
|
284
|
+
# Logout
|
|
285
|
+
barista auth logout --service liberica --env prod-cn
|
|
667
286
|
```
|
|
668
287
|
|
|
669
288
|
---
|
|
670
289
|
|
|
671
|
-
##
|
|
672
|
-
|
|
673
|
-
Barista CLI 专为 AI 编程助手优化,特别是 Claude Code。
|
|
674
|
-
|
|
675
|
-
### Claude Code 使用示例
|
|
676
|
-
|
|
677
|
-
```typescript
|
|
678
|
-
// 在 Claude Code 中使用 Barista CLI
|
|
679
|
-
// 示例:获取订单列表并分析
|
|
680
|
-
|
|
681
|
-
const result = await $`barista liberica orders list --json --page 1 --size 10`;
|
|
682
|
-
const orders = JSON.parse(result.stdout);
|
|
683
|
-
|
|
684
|
-
// 分析订单数据
|
|
685
|
-
const analysis = orders.data.items.map(order => ({
|
|
686
|
-
id: order.id,
|
|
687
|
-
status: order.status,
|
|
688
|
-
amount: order.amount
|
|
689
|
-
}));
|
|
690
|
-
```
|
|
691
|
-
|
|
692
|
-
### Skills 文件
|
|
693
|
-
|
|
694
|
-
Barista CLI 提供 Claude Code Skills 文件,位于:
|
|
695
|
-
|
|
696
|
-
```
|
|
697
|
-
~/.barista/claude/skills/
|
|
698
|
-
├── orders.md # 订单管理技能
|
|
699
|
-
├── products.md # 产品管理技能
|
|
700
|
-
├── quotes.md # 报价管理技能
|
|
701
|
-
└── customers.md # 客户管理技能
|
|
702
|
-
```
|
|
703
|
-
|
|
704
|
-
**示例 Skills 文件:**
|
|
705
|
-
|
|
706
|
-
```markdown
|
|
707
|
-
# 订单管理技能
|
|
708
|
-
|
|
709
|
-
## 列出待处理订单
|
|
710
|
-
|
|
711
|
-
当用户询问待处理订单时:
|
|
290
|
+
## ❓ Troubleshooting
|
|
712
291
|
|
|
713
|
-
|
|
714
|
-
2. 解析返回的 JSON
|
|
715
|
-
3. 总结订单数量和总金额
|
|
716
|
-
4. 列出前 5 个订单的关键信息
|
|
717
|
-
|
|
718
|
-
## 创建新订单
|
|
719
|
-
|
|
720
|
-
当用户需要创建订单时:
|
|
721
|
-
|
|
722
|
-
1. 确认产品 ID 和数量
|
|
723
|
-
2. 使用 dry-run 预览:barista liberica orders create --dry-run ...
|
|
724
|
-
3. 用户确认后执行实际命令
|
|
725
|
-
```
|
|
726
|
-
|
|
727
|
-
### AI 友好的输出
|
|
728
|
-
|
|
729
|
-
所有命令都支持 `--json` 选项,返回结构化的 JSON 数据:
|
|
292
|
+
### Auth Failures
|
|
730
293
|
|
|
731
294
|
```bash
|
|
732
|
-
#
|
|
733
|
-
barista
|
|
734
|
-
|
|
735
|
-
{
|
|
736
|
-
"success": true,
|
|
737
|
-
"data": {
|
|
738
|
-
"id": "12345",
|
|
739
|
-
"status": "in_production",
|
|
740
|
-
"product": {
|
|
741
|
-
"id": "100",
|
|
742
|
-
"name": "咖啡机 Pro"
|
|
743
|
-
},
|
|
744
|
-
"quantity": 100,
|
|
745
|
-
"amount": 50000,
|
|
746
|
-
"timeline": {
|
|
747
|
-
"created": "2024-01-15T10:30:00Z",
|
|
748
|
-
"delivery": "2024-02-15"
|
|
749
|
-
}
|
|
750
|
-
},
|
|
751
|
-
"meta": {
|
|
752
|
-
"requestId": "req-abc123",
|
|
753
|
-
"timestamp": "2024-01-15T10:30:00Z"
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
```
|
|
757
|
-
|
|
758
|
-
---
|
|
759
|
-
|
|
760
|
-
## 开发指南
|
|
295
|
+
# Check current status
|
|
296
|
+
barista auth status
|
|
761
297
|
|
|
762
|
-
|
|
298
|
+
# Re-authenticate
|
|
299
|
+
barista liberica auth login prod-cn your-tenant your-username your-password
|
|
763
300
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
├── bin/
|
|
767
|
-
│ └── barista.js # 入口文件
|
|
768
|
-
├── src/
|
|
769
|
-
│ ├── commands/ # 命令实现
|
|
770
|
-
│ │ ├── context/ # 上下文管理命令
|
|
771
|
-
│ │ ├── auth/ # 认证命令
|
|
772
|
-
│ │ ├── liberica/ # Liberica 服务命令
|
|
773
|
-
│ │ │ ├── orders.js
|
|
774
|
-
│ │ │ ├── products.js
|
|
775
|
-
│ │ │ └── production.js
|
|
776
|
-
│ │ ├── arabica/ # Arabica 服务命令
|
|
777
|
-
│ │ │ ├── products.js
|
|
778
|
-
│ │ │ ├── quotes.js
|
|
779
|
-
│ │ │ └── customers.js
|
|
780
|
-
│ │ └── cross/ # 跨服务命令
|
|
781
|
-
│ ├── core/ # 核心模块
|
|
782
|
-
│ │ ├── auth.js # 认证管理
|
|
783
|
-
│ │ ├── config.js # 配置管理
|
|
784
|
-
│ │ ├── context.js # 上下文管理
|
|
785
|
-
│ │ └── api-client.js # API 客户端
|
|
786
|
-
│ ├── utils/ # 工具函数
|
|
787
|
-
│ │ ├── formatter.js # 输出格式化
|
|
788
|
-
│ │ ├── validator.js # 参数验证
|
|
789
|
-
│ │ └── keychain.js # 密钥链操作
|
|
790
|
-
│ └── templates/ # 模板文件
|
|
791
|
-
├── skills/ # Claude Code Skills
|
|
792
|
-
├── tests/ # 测试文件
|
|
793
|
-
├── package.json
|
|
794
|
-
└── README.md
|
|
301
|
+
# Check context
|
|
302
|
+
barista context show
|
|
795
303
|
```
|
|
796
304
|
|
|
797
|
-
###
|
|
305
|
+
### API Errors
|
|
798
306
|
|
|
799
307
|
```bash
|
|
800
|
-
#
|
|
801
|
-
|
|
802
|
-
cd coffee-barista-cli
|
|
803
|
-
|
|
804
|
-
# 2. 安装依赖
|
|
805
|
-
npm install
|
|
806
|
-
|
|
807
|
-
# 3. 链接到全局(开发模式)
|
|
808
|
-
npm link
|
|
809
|
-
|
|
810
|
-
# 4. 验证链接
|
|
811
|
-
barista --version
|
|
812
|
-
|
|
813
|
-
# 5. 运行测试
|
|
814
|
-
npm test
|
|
308
|
+
# Always use --json to get error codes
|
|
309
|
+
barista liberica orders list --json
|
|
815
310
|
|
|
816
|
-
#
|
|
817
|
-
|
|
311
|
+
# Error response includes requestId for debugging
|
|
312
|
+
# "requestId": "req-abc123"
|
|
818
313
|
```
|
|
819
314
|
|
|
820
|
-
###
|
|
821
|
-
|
|
822
|
-
**重要**:新增命令必须遵循 [命令设计规范](./docs/COMMAND_DESIGN_SPEC.md),包含设计文档编写、技术评审等完整流程。
|
|
823
|
-
|
|
824
|
-
详细步骤请参考:
|
|
825
|
-
- [完整命令参考](./docs/commands/REFERENCE.md) - 所有命令清单和开发优先级
|
|
826
|
-
- [命令设计规范文档](./docs/COMMAND_DESIGN_SPEC.md#5-命令开发流程规范)
|
|
827
|
-
- [命令开发指南](./docs/COMMANDS.md)
|
|
828
|
-
|
|
829
|
-
---
|
|
830
|
-
|
|
831
|
-
## 贡献指南
|
|
832
|
-
|
|
833
|
-
我们欢迎所有形式的贡献,包括但不限于:
|
|
834
|
-
|
|
835
|
-
- 🐛 报告 Bug
|
|
836
|
-
- 💡 提出新功能建议
|
|
837
|
-
- 📝 改进文档
|
|
838
|
-
- 🔧 提交代码修复
|
|
839
|
-
- ✨ 添加新功能
|
|
840
|
-
|
|
841
|
-
### 提交规范
|
|
842
|
-
|
|
843
|
-
请遵循 [Conventional Commits](https://www.conventionalcommits.org/) 规范:
|
|
315
|
+
### Timeout Issues
|
|
844
316
|
|
|
845
317
|
```bash
|
|
846
|
-
#
|
|
847
|
-
|
|
318
|
+
# Switch to closer environment
|
|
319
|
+
barista context use-env dev
|
|
848
320
|
|
|
849
|
-
#
|
|
850
|
-
feat: 添加库存查询命令
|
|
851
|
-
|
|
852
|
-
# 文档更新
|
|
853
|
-
docs: 更新 README 中的环境映射
|
|
854
|
-
|
|
855
|
-
# 代码重构
|
|
856
|
-
refactor: 重构 API 客户端错误处理
|
|
321
|
+
# Or adjust timeout in config.yaml
|
|
857
322
|
```
|
|
858
323
|
|
|
859
|
-
### 开发流程
|
|
860
|
-
|
|
861
|
-
1. Fork 本仓库
|
|
862
|
-
2. 创建功能分支:`git checkout -b feature/my-feature`
|
|
863
|
-
3. 提交更改:`git commit -m 'feat: add some feature'`
|
|
864
|
-
4. 推送分支:`git push origin feature/my-feature`
|
|
865
|
-
5. 创建 Pull Request
|
|
866
|
-
|
|
867
324
|
---
|
|
868
325
|
|
|
869
|
-
##
|
|
326
|
+
## 📚 Related Projects
|
|
870
327
|
|
|
871
|
-
|
|
|
872
|
-
|
|
873
|
-
| ☕ Liberica Backend |
|
|
874
|
-
| 🖥️ Liberica Frontend |
|
|
875
|
-
| 📱 Liberica Mobile |
|
|
876
|
-
| 🛒 Arabica Backend |
|
|
877
|
-
| 🌐 Arabica Frontend |
|
|
328
|
+
| Project | Description |
|
|
329
|
+
|---------|-------------|
|
|
330
|
+
| ☕ Liberica Backend | Production management SaaS backend |
|
|
331
|
+
| 🖥️ Liberica Frontend | Production management web UI |
|
|
332
|
+
| 📱 Liberica Mobile | Production management mobile app |
|
|
333
|
+
| 🛒 Arabica Backend | Online subscription SaaS backend |
|
|
334
|
+
| 🌐 Arabica Frontend | Online subscription web UI |
|
|
878
335
|
|
|
879
336
|
---
|
|
880
337
|
|
|
881
|
-
##
|
|
338
|
+
## 📄 License
|
|
882
339
|
|
|
883
340
|
[MIT](LICENSE) © Newpeak Technology
|
|
884
|
-
|
|
885
|
-
---
|
|
886
|
-
|
|
887
|
-
<p align="center">
|
|
888
|
-
用 ☕ 驱动生产力
|
|
889
|
-
</p>
|