@newpeak/barista-cli 0.1.14 → 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 +211 -579
- package/README.md +208 -643
- package/README.vi.md +212 -586
- package/README.zh.md +340 -0
- 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/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 +78 -1
- package/dist/core/api/client.d.ts.map +1 -1
- package/dist/core/api/client.js +832 -76
- 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/org.d.ts +38 -0
- package/dist/types/org.d.ts.map +1 -1
- 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 +0 -714
package/README.md
CHANGED
|
@@ -1,516 +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
|
-
- [贡献指南](#贡献指南)
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## 项目简介
|
|
38
|
-
|
|
39
|
-
Barista CLI 是专为 Newpeak 生态系统设计的 AI-Native 命令行工具。它提供统一的接口来管理 Liberica 生产管理 SaaS 和 Arabica 在线订阅 SaaS 服务。
|
|
40
|
-
|
|
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 实现业务流程自动化
|
|
5
|
+
[](https://www.npmjs.com/package/@newpeak/barista-cli)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/@newpeak/barista-cli)
|
|
8
|
+
[](https://nodejs.org/)
|
|
58
9
|
|
|
59
10
|
---
|
|
60
11
|
|
|
61
|
-
##
|
|
12
|
+
## ⚡ Quick Start
|
|
62
13
|
|
|
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 context use-env dev
|
|
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
|
-
#
|
|
86
|
-
barista
|
|
87
|
-
|
|
88
|
-
# 4. 登录获取 Token
|
|
89
|
-
barista auth login --service liberica --env dev
|
|
90
|
-
|
|
91
|
-
# 5. 验证登录状态
|
|
92
|
-
barista auth status
|
|
26
|
+
# Interactive login (prompts for missing info)
|
|
27
|
+
barista liberica auth login
|
|
93
28
|
```
|
|
94
29
|
|
|
95
|
-
###
|
|
30
|
+
### 3. AI Integration
|
|
96
31
|
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
barista
|
|
100
|
-
|
|
101
|
-
# 列出所有订单(Liberica)
|
|
102
|
-
barista liberica orders list
|
|
103
|
-
|
|
104
|
-
# 搜索产品(支持模糊查询)
|
|
105
|
-
barista liberica products search --keyword "咖啡机"
|
|
106
|
-
|
|
107
|
-
# 查看 Arabica 产品目录
|
|
108
|
-
barista arabica products public-catalog
|
|
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)
|
|
109
36
|
|
|
110
|
-
|
|
111
|
-
|
|
37
|
+
// AI parses and acts on the data
|
|
38
|
+
if (data.items.length > 0) {
|
|
39
|
+
console.log(`Found ${data.pagination.total} orders`)
|
|
40
|
+
}
|
|
112
41
|
```
|
|
113
42
|
|
|
43
|
+
**[View AI Integration Examples →](#ai-integration)**
|
|
44
|
+
|
|
114
45
|
---
|
|
115
46
|
|
|
116
|
-
##
|
|
47
|
+
## 🤖 AI Integration
|
|
117
48
|
|
|
118
|
-
|
|
49
|
+
Barista CLI is designed for AI coding assistants. Every output is structured, every error is actionable.
|
|
119
50
|
|
|
120
|
-
|
|
51
|
+
### Supported AI Tools
|
|
121
52
|
|
|
122
|
-
|
|
|
123
|
-
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
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 |
|
|
128
60
|
|
|
129
|
-
|
|
61
|
+
### Integration Pattern
|
|
130
62
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
+
}
|
|
137
79
|
|
|
138
|
-
|
|
80
|
+
// 3. Work with data
|
|
81
|
+
const pendingOrders = data.items
|
|
82
|
+
console.log(`Found ${data.pagination.total} pending orders`)
|
|
139
83
|
|
|
140
|
-
|
|
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`
|
|
141
88
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
│ │ │ │ │ │
|
|
146
|
-
│ • 登录请求 │ │ • 验证凭证 │ │ • 验证 Token │
|
|
147
|
-
│ • 存储 Token │◀────│ • 签发 JWT │◀────│ • 返回数据 │
|
|
148
|
-
│ (系统密钥链) │ │ │ │ │
|
|
149
|
-
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
|
89
|
+
// Parse preview, verify, then execute with --force
|
|
90
|
+
// ...
|
|
91
|
+
}
|
|
150
92
|
```
|
|
151
93
|
|
|
152
|
-
|
|
94
|
+
### Response Envelope
|
|
153
95
|
|
|
154
|
-
|
|
155
|
-
- **自动跳过认证**:公开接口(如产品目录查询)无需认证
|
|
156
|
-
- **环境隔离**:每个环境和租户使用独立的 Token,互不影响
|
|
157
|
-
- **Token 刷新**:支持自动刷新即将过期的 Token
|
|
96
|
+
All JSON responses follow this structure:
|
|
158
97
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
+
}
|
|
169
112
|
```
|
|
170
113
|
|
|
171
|
-
|
|
114
|
+
**Error format:**
|
|
172
115
|
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
|
|
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
|
+
}
|
|
176
128
|
```
|
|
177
129
|
|
|
178
|
-
###
|
|
179
|
-
|
|
180
|
-
| 选项 | 说明 | 示例 |
|
|
181
|
-
|------|------|------|
|
|
182
|
-
| `--env` | 指定环境 | `--env prod-cn` |
|
|
183
|
-
| `--tenant` | 指定租户 | `--tenant electionjp` |
|
|
184
|
-
| `--service` | 指定服务 | `--service liberica` |
|
|
185
|
-
| `--dry-run` | 预览模式 | `--dry-run` |
|
|
186
|
-
| `--json` | JSON 输出 | `--json` |
|
|
187
|
-
| `--help` | 显示帮助 | `--help` |
|
|
188
|
-
|
|
189
|
-
### 上下文管理
|
|
190
|
-
|
|
191
|
-
上下文管理用于快速切换工作环境,避免每个命令都指定环境参数。
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
# 查看当前上下文
|
|
195
|
-
barista context show
|
|
196
|
-
|
|
197
|
-
# 输出示例:
|
|
198
|
-
# ┌─────────────┬─────────────────┐
|
|
199
|
-
# │ 属性 │ 值 │
|
|
200
|
-
# ├─────────────┼─────────────────┤
|
|
201
|
-
# │ 当前环境 │ dev │
|
|
202
|
-
# │ 当前租户 │ electionjp │
|
|
203
|
-
# │ 当前服务 │ liberica │
|
|
204
|
-
# │ Token 状态 │ 已登录 │
|
|
205
|
-
# │ Token 过期 │ 2024-12-31 │
|
|
206
|
-
# └─────────────┴─────────────────┘
|
|
207
|
-
|
|
208
|
-
# 切换环境
|
|
209
|
-
barista context use-env [dev|test|prod-cn|prod-jp]
|
|
210
|
-
|
|
211
|
-
# 切换租户
|
|
212
|
-
barista context use-tenant <tenant-name>
|
|
213
|
-
|
|
214
|
-
# 切换默认服务
|
|
215
|
-
barista context use-service [liberica|arabica]
|
|
216
|
-
```
|
|
130
|
+
### Skills for Claude Code
|
|
217
131
|
|
|
218
|
-
|
|
132
|
+
Install reusable skill files:
|
|
219
133
|
|
|
220
134
|
```bash
|
|
221
|
-
#
|
|
222
|
-
barista
|
|
223
|
-
|
|
224
|
-
# 示例:登录 Liberica 开发环境
|
|
225
|
-
barista auth login --service liberica --env dev --tenant electionjp
|
|
226
|
-
|
|
227
|
-
# 检查登录状态
|
|
228
|
-
barista auth status
|
|
229
|
-
|
|
230
|
-
# 输出示例:
|
|
231
|
-
# ✓ Liberica (dev) - 已登录 (过期: 2024-12-31)
|
|
232
|
-
# ✗ Liberica (test) - 未登录
|
|
233
|
-
# ✓ Arabica (prod-cn) - 已登录 (过期: 2024-12-30)
|
|
234
|
-
|
|
235
|
-
# 登出(清除 Token)
|
|
236
|
-
barista auth logout --service <service> --env <env>
|
|
237
|
-
|
|
238
|
-
# 登出所有环境
|
|
239
|
-
barista auth logout --all
|
|
135
|
+
# Skills are located at ~/.barista/claude/skills/
|
|
136
|
+
barista skills install
|
|
240
137
|
```
|
|
241
138
|
|
|
242
|
-
|
|
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
|
|
243
144
|
|
|
244
|
-
|
|
145
|
+
---
|
|
245
146
|
|
|
246
|
-
|
|
247
|
-
# 列出订单(分页)
|
|
248
|
-
barista liberica orders list [--page <n>] [--size <n>] [--status <status>]
|
|
147
|
+
## 🚀 Features
|
|
249
148
|
|
|
250
|
-
|
|
251
|
-
barista liberica orders get <order-id>
|
|
149
|
+
### AI-First Design
|
|
252
150
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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 |
|
|
259
158
|
|
|
260
|
-
|
|
261
|
-
barista liberica orders cancel <order-id> [--reason <text>]
|
|
262
|
-
```
|
|
159
|
+
### Enterprise Connectivity
|
|
263
160
|
|
|
264
|
-
|
|
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 |
|
|
265
166
|
|
|
266
|
-
|
|
267
|
-
# 搜索产品
|
|
268
|
-
barista liberica products search --keyword <keyword> [--category <id>]
|
|
167
|
+
### Operational Safety
|
|
269
168
|
|
|
270
|
-
|
|
271
|
-
|
|
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
|
|
272
172
|
|
|
273
|
-
|
|
274
|
-
barista liberica products public-list [--category <id>] [--page <n>]
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
#### 生产计划
|
|
173
|
+
---
|
|
278
174
|
|
|
279
|
-
|
|
280
|
-
# 查看生产排期
|
|
281
|
-
barista liberica production schedule [--start-date <date>] [--end-date <date>]
|
|
175
|
+
## 🔧 Command Reference
|
|
282
176
|
|
|
283
|
-
|
|
284
|
-
barista liberica production reschedule <order-id> --new-date <date> [--dry-run]
|
|
177
|
+
### Core Pattern
|
|
285
178
|
|
|
286
|
-
# 查询产能
|
|
287
|
-
barista liberica production capacity [--date <date>] [--line <line-id>]
|
|
288
179
|
```
|
|
289
|
-
|
|
290
|
-
#### 仓库管理
|
|
291
|
-
|
|
292
|
-
```bash
|
|
293
|
-
# 列出仓库(分页)
|
|
294
|
-
barista liberica warehouses list [--page <n>] [--size <n>] [--status <status>] [--name <name>] [--code <code>]
|
|
295
|
-
|
|
296
|
-
# 获取仓库详情
|
|
297
|
-
barista liberica warehouses get <warehouse-id>
|
|
298
|
-
|
|
299
|
-
# 创建仓库
|
|
300
|
-
barista liberica warehouses create --code <code> --name <name> \
|
|
301
|
-
[--type <type>] [--classes <classes>] [--address <address>] \
|
|
302
|
-
[--contact <contact>] [--phone <phone>] [--manager <manager>] \
|
|
303
|
-
[--enable-location] [--enable-negative-inventory] [--remark <remark>]
|
|
304
|
-
|
|
305
|
-
# 更新仓库
|
|
306
|
-
barista liberica warehouses update <warehouse-id> \
|
|
307
|
-
[--name <name>] [--type <type>] [--classes <classes>] [--address <address>] \
|
|
308
|
-
[--contact <contact>] [--phone <phone>] [--manager <manager>] \
|
|
309
|
-
[--enable-location] [--disable-location] \
|
|
310
|
-
[--enable-negative-inventory] [--disable-negative-inventory] \
|
|
311
|
-
[--remark <remark>]
|
|
312
|
-
|
|
313
|
-
# 删除仓库(默认 Dry-Run,需 --force 确认)
|
|
314
|
-
barista liberica warehouses delete <warehouse-id> [--force]
|
|
315
|
-
|
|
316
|
-
# 启用仓库
|
|
317
|
-
barista liberica warehouses enable <warehouse-id> [--force] [--dry-run]
|
|
318
|
-
|
|
319
|
-
# 禁用仓库
|
|
320
|
-
barista liberica warehouses disable <warehouse-id> [--force] [--dry-run]
|
|
180
|
+
barista <service> <resource> <action> [options]
|
|
321
181
|
```
|
|
322
182
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
# 列出库位(分页)
|
|
327
|
-
barista liberica warehouses locations list --warehouse-id <id> \
|
|
328
|
-
[--page <n>] [--size <n>] [--status <status>] [--name <name>] [--code <code>]
|
|
329
|
-
|
|
330
|
-
# 获取库位详情
|
|
331
|
-
barista liberica warehouses locations get <location-id>
|
|
332
|
-
|
|
333
|
-
# 创建库位
|
|
334
|
-
barista liberica warehouses locations create --warehouse-id <id> --code <code> --name <name> \
|
|
335
|
-
[--type <type>] [--capacity <capacity>] [--remark <remark>] [--status <status>]
|
|
183
|
+
### Global Options
|
|
336
184
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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` |
|
|
340
194
|
|
|
341
|
-
|
|
342
|
-
barista liberica warehouses locations delete <location-id> [--force]
|
|
195
|
+
### Quick Reference
|
|
343
196
|
|
|
344
|
-
|
|
345
|
-
|
|
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 |
|
|
346
207
|
|
|
347
|
-
|
|
348
|
-
barista liberica warehouses locations disable <location-id> [--force] [--dry-run]
|
|
349
|
-
```
|
|
208
|
+
**[→ Full Command Reference](./docs/commands/REFERENCE.md)**
|
|
350
209
|
|
|
351
|
-
|
|
210
|
+
---
|
|
352
211
|
|
|
353
|
-
|
|
212
|
+
## 🛡️ AI Safety Guidelines
|
|
354
213
|
|
|
355
|
-
|
|
356
|
-
# 列出产品
|
|
357
|
-
barista arabica products list [--page <n>] [--size <n>] [--category <id>]
|
|
214
|
+
### 1. Always Dry-Run First
|
|
358
215
|
|
|
359
|
-
|
|
360
|
-
|
|
216
|
+
```typescript
|
|
217
|
+
// ❌ Wrong - executing blindly
|
|
218
|
+
await $`barista liberica orders cancel 12345`
|
|
361
219
|
|
|
362
|
-
|
|
363
|
-
barista
|
|
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`
|
|
364
224
|
```
|
|
365
225
|
|
|
366
|
-
|
|
226
|
+
### 2. Check Success Before Proceeding
|
|
367
227
|
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
# 创建报价单
|
|
376
|
-
barista arabica quotes create \
|
|
377
|
-
--customer-id <id> \
|
|
378
|
-
--items <json> \
|
|
379
|
-
[--valid-days <n>]
|
|
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)
|
|
233
|
+
}
|
|
380
234
|
```
|
|
381
235
|
|
|
382
|
-
|
|
236
|
+
### 3. Use Request IDs for Debugging
|
|
383
237
|
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
# 获取客户详情
|
|
389
|
-
barista arabica customers get <customer-id>
|
|
238
|
+
```typescript
|
|
239
|
+
const { meta } = JSON.parse(stdout)
|
|
240
|
+
console.log(`Request ID: ${meta.requestId}`)
|
|
390
241
|
```
|
|
391
242
|
|
|
392
|
-
###
|
|
243
|
+
### 4. Respect Rate Limits
|
|
393
244
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
# 从订单生成报价单
|
|
398
|
-
barista cross quote-from-order <order-id> [--target-service arabica]
|
|
399
|
-
|
|
400
|
-
# 输出示例:
|
|
401
|
-
# ✓ 已生成报价单
|
|
402
|
-
# ┌──────────┬────────────┐
|
|
403
|
-
# │ 属性 │ 值 │
|
|
404
|
-
# ├──────────┼────────────┤
|
|
405
|
-
# │ 订单ID │ 12345 │
|
|
406
|
-
# │ 报价单ID │ QT-2024-001│
|
|
407
|
-
# │ 金额 │ ¥50,000 │
|
|
408
|
-
# │ 有效期 │ 30天 │
|
|
409
|
-
# └──────────┴────────────┘
|
|
410
|
-
|
|
411
|
-
# 同步订单状态到 Arabica
|
|
412
|
-
barista cross sync-order <order-id> [--direction liberica-to-arabica]
|
|
413
|
-
```
|
|
245
|
+
- Add delays between bulk operations
|
|
246
|
+
- Use `--size 100` for bulk fetches
|
|
247
|
+
- Cache responses when appropriate
|
|
414
248
|
|
|
415
249
|
---
|
|
416
250
|
|
|
417
|
-
##
|
|
418
|
-
|
|
419
|
-
### Dry-Run 模式
|
|
420
|
-
|
|
421
|
-
Dry-Run 模式允许你在执行写入操作前预览其影响,避免误操作。
|
|
422
|
-
|
|
423
|
-
```bash
|
|
424
|
-
# 所有写入操作都支持 --dry-run 选项
|
|
425
|
-
barista liberica orders create --product-id 123 --quantity 100 --dry-run
|
|
426
|
-
|
|
427
|
-
# 输出示例:
|
|
428
|
-
# 🔍 Dry-Run 模式:操作不会被实际执行
|
|
429
|
-
# ┌─────────────────┬──────────────────────┐
|
|
430
|
-
# │ 操作 │ 创建订单 │
|
|
431
|
-
# ├─────────────────┼──────────────────────┤
|
|
432
|
-
# │ 产品 │ 咖啡机 Pro (ID: 123) │
|
|
433
|
-
# │ 数量 │ 100 │
|
|
434
|
-
# │ 预计金额 │ ¥50,000 │
|
|
435
|
-
# │ 预计交期 │ 2024-12-31 │
|
|
436
|
-
# │ 影响 │ 新增一条订单记录 │
|
|
437
|
-
# └─────────────────┴──────────────────────┘
|
|
438
|
-
#
|
|
439
|
-
# ⚠️ 确认执行?添加 --confirm 选项或移除 --dry-run
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
**默认 Dry-Run 的操作:**
|
|
443
|
-
|
|
444
|
-
以下破坏性操作默认启用 Dry-Run 模式,需显式确认:
|
|
445
|
-
|
|
446
|
-
- 取消订单
|
|
447
|
-
- 删除产品
|
|
448
|
-
- 批量更新
|
|
449
|
-
|
|
450
|
-
### JSON 输出格式
|
|
451
|
-
|
|
452
|
-
Barista CLI 支持 JSON 输出,便于脚本处理和 AI 集成:
|
|
453
|
-
|
|
454
|
-
```bash
|
|
455
|
-
barista liberica orders list --json
|
|
456
|
-
|
|
457
|
-
# 输出示例:
|
|
458
|
-
{
|
|
459
|
-
"success": true,
|
|
460
|
-
"data": {
|
|
461
|
-
"items": [
|
|
462
|
-
{
|
|
463
|
-
"id": "12345",
|
|
464
|
-
"productName": "咖啡机 Pro",
|
|
465
|
-
"quantity": 100,
|
|
466
|
-
"status": "in_production",
|
|
467
|
-
"createdAt": "2024-01-15T10:30:00Z"
|
|
468
|
-
}
|
|
469
|
-
],
|
|
470
|
-
"pagination": {
|
|
471
|
-
"page": 1,
|
|
472
|
-
"size": 20,
|
|
473
|
-
"total": 150
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
```
|
|
251
|
+
## ⚙️ Configuration
|
|
478
252
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
## 配置说明
|
|
253
|
+
### File Location
|
|
482
254
|
|
|
483
|
-
|
|
255
|
+
`~/.barista/config.yaml`
|
|
484
256
|
|
|
485
|
-
|
|
257
|
+
### Quick Config
|
|
486
258
|
|
|
487
259
|
```yaml
|
|
488
|
-
# Barista CLI 配置文件
|
|
489
|
-
|
|
490
|
-
# 默认上下文设置
|
|
491
260
|
defaults:
|
|
492
|
-
env:
|
|
493
|
-
tenant:
|
|
261
|
+
env: prod-cn
|
|
262
|
+
tenant: your-tenant
|
|
494
263
|
service: liberica
|
|
495
264
|
|
|
496
|
-
# 环境配置
|
|
497
265
|
environments:
|
|
498
|
-
dev:
|
|
499
|
-
liberica:
|
|
500
|
-
baseUrl: "https://{tenant}-dev.newpeaksh.com"
|
|
501
|
-
timeout: 30000
|
|
502
|
-
arabica:
|
|
503
|
-
baseUrl: "https://arabica-dev.newpeaksh.com"
|
|
504
|
-
timeout: 30000
|
|
505
|
-
|
|
506
|
-
test:
|
|
507
|
-
liberica:
|
|
508
|
-
baseUrl: "https://{tenant}-test.newpeaksh.com"
|
|
509
|
-
timeout: 30000
|
|
510
|
-
arabica:
|
|
511
|
-
baseUrl: "https://arabica-test.newpeaksh.com"
|
|
512
|
-
timeout: 30000
|
|
513
|
-
|
|
514
266
|
prod-cn:
|
|
515
267
|
liberica:
|
|
516
268
|
baseUrl: "https://{tenant}.newpeaksh.com"
|
|
@@ -518,258 +270,71 @@ environments:
|
|
|
518
270
|
arabica:
|
|
519
271
|
baseUrl: "https://www.newpeaksh.com"
|
|
520
272
|
timeout: 60000
|
|
521
|
-
|
|
522
|
-
prod-jp:
|
|
523
|
-
liberica:
|
|
524
|
-
baseUrl: "https://{tenant}.newpeakjp.com"
|
|
525
|
-
timeout: 60000
|
|
526
|
-
arabica:
|
|
527
|
-
baseUrl: "https://members.newpeakjp.com"
|
|
528
|
-
timeout: 60000
|
|
529
|
-
|
|
530
|
-
# 输出配置
|
|
531
|
-
output:
|
|
532
|
-
format: table # table | json
|
|
533
|
-
color: true
|
|
534
|
-
timestamp: true
|
|
535
273
|
```
|
|
536
274
|
|
|
537
|
-
###
|
|
538
|
-
|
|
539
|
-
支持配置多个租户,快速切换:
|
|
275
|
+
### Authentication
|
|
540
276
|
|
|
541
277
|
```bash
|
|
542
|
-
#
|
|
543
|
-
barista
|
|
544
|
-
--name customer-a \
|
|
545
|
-
--liberica-id customer-a-id \
|
|
546
|
-
--arabica-id customer-a-arabica-id
|
|
278
|
+
# Credential login (recommended)
|
|
279
|
+
barista liberica auth login <env> <tenant> <username> <password>
|
|
547
280
|
|
|
548
|
-
#
|
|
549
|
-
barista
|
|
281
|
+
# Check auth status
|
|
282
|
+
barista auth status
|
|
550
283
|
|
|
551
|
-
#
|
|
552
|
-
barista
|
|
284
|
+
# Logout
|
|
285
|
+
barista auth logout --service liberica --env prod-cn
|
|
553
286
|
```
|
|
554
287
|
|
|
555
288
|
---
|
|
556
289
|
|
|
557
|
-
##
|
|
558
|
-
|
|
559
|
-
Barista CLI 专为 AI 编程助手优化,特别是 Claude Code。
|
|
560
|
-
|
|
561
|
-
### Claude Code 使用示例
|
|
562
|
-
|
|
563
|
-
```typescript
|
|
564
|
-
// 在 Claude Code 中使用 Barista CLI
|
|
565
|
-
// 示例:获取订单列表并分析
|
|
566
|
-
|
|
567
|
-
const result = await $`barista liberica orders list --json --page 1 --size 10`;
|
|
568
|
-
const orders = JSON.parse(result.stdout);
|
|
569
|
-
|
|
570
|
-
// 分析订单数据
|
|
571
|
-
const analysis = orders.data.items.map(order => ({
|
|
572
|
-
id: order.id,
|
|
573
|
-
status: order.status,
|
|
574
|
-
amount: order.amount
|
|
575
|
-
}));
|
|
576
|
-
```
|
|
577
|
-
|
|
578
|
-
### Skills 文件
|
|
579
|
-
|
|
580
|
-
Barista CLI 提供 Claude Code Skills 文件,位于:
|
|
581
|
-
|
|
582
|
-
```
|
|
583
|
-
~/.barista/claude/skills/
|
|
584
|
-
├── orders.md # 订单管理技能
|
|
585
|
-
├── products.md # 产品管理技能
|
|
586
|
-
├── quotes.md # 报价管理技能
|
|
587
|
-
└── customers.md # 客户管理技能
|
|
588
|
-
```
|
|
589
|
-
|
|
590
|
-
**示例 Skills 文件:**
|
|
591
|
-
|
|
592
|
-
```markdown
|
|
593
|
-
# 订单管理技能
|
|
290
|
+
## ❓ Troubleshooting
|
|
594
291
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
当用户询问待处理订单时:
|
|
598
|
-
|
|
599
|
-
1. 执行命令:barista liberica orders list --status pending --json
|
|
600
|
-
2. 解析返回的 JSON
|
|
601
|
-
3. 总结订单数量和总金额
|
|
602
|
-
4. 列出前 5 个订单的关键信息
|
|
603
|
-
|
|
604
|
-
## 创建新订单
|
|
605
|
-
|
|
606
|
-
当用户需要创建订单时:
|
|
607
|
-
|
|
608
|
-
1. 确认产品 ID 和数量
|
|
609
|
-
2. 使用 dry-run 预览:barista liberica orders create --dry-run ...
|
|
610
|
-
3. 用户确认后执行实际命令
|
|
611
|
-
```
|
|
612
|
-
|
|
613
|
-
### AI 友好的输出
|
|
614
|
-
|
|
615
|
-
所有命令都支持 `--json` 选项,返回结构化的 JSON 数据:
|
|
292
|
+
### Auth Failures
|
|
616
293
|
|
|
617
294
|
```bash
|
|
618
|
-
#
|
|
619
|
-
barista
|
|
620
|
-
|
|
621
|
-
{
|
|
622
|
-
"success": true,
|
|
623
|
-
"data": {
|
|
624
|
-
"id": "12345",
|
|
625
|
-
"status": "in_production",
|
|
626
|
-
"product": {
|
|
627
|
-
"id": "100",
|
|
628
|
-
"name": "咖啡机 Pro"
|
|
629
|
-
},
|
|
630
|
-
"quantity": 100,
|
|
631
|
-
"amount": 50000,
|
|
632
|
-
"timeline": {
|
|
633
|
-
"created": "2024-01-15T10:30:00Z",
|
|
634
|
-
"delivery": "2024-02-15"
|
|
635
|
-
}
|
|
636
|
-
},
|
|
637
|
-
"meta": {
|
|
638
|
-
"requestId": "req-abc123",
|
|
639
|
-
"timestamp": "2024-01-15T10:30:00Z"
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
```
|
|
643
|
-
|
|
644
|
-
---
|
|
645
|
-
|
|
646
|
-
## 开发指南
|
|
295
|
+
# Check current status
|
|
296
|
+
barista auth status
|
|
647
297
|
|
|
648
|
-
|
|
298
|
+
# Re-authenticate
|
|
299
|
+
barista liberica auth login prod-cn your-tenant your-username your-password
|
|
649
300
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
├── bin/
|
|
653
|
-
│ └── barista.js # 入口文件
|
|
654
|
-
├── src/
|
|
655
|
-
│ ├── commands/ # 命令实现
|
|
656
|
-
│ │ ├── context/ # 上下文管理命令
|
|
657
|
-
│ │ ├── auth/ # 认证命令
|
|
658
|
-
│ │ ├── liberica/ # Liberica 服务命令
|
|
659
|
-
│ │ │ ├── orders.js
|
|
660
|
-
│ │ │ ├── products.js
|
|
661
|
-
│ │ │ └── production.js
|
|
662
|
-
│ │ ├── arabica/ # Arabica 服务命令
|
|
663
|
-
│ │ │ ├── products.js
|
|
664
|
-
│ │ │ ├── quotes.js
|
|
665
|
-
│ │ │ └── customers.js
|
|
666
|
-
│ │ └── cross/ # 跨服务命令
|
|
667
|
-
│ ├── core/ # 核心模块
|
|
668
|
-
│ │ ├── auth.js # 认证管理
|
|
669
|
-
│ │ ├── config.js # 配置管理
|
|
670
|
-
│ │ ├── context.js # 上下文管理
|
|
671
|
-
│ │ └── api-client.js # API 客户端
|
|
672
|
-
│ ├── utils/ # 工具函数
|
|
673
|
-
│ │ ├── formatter.js # 输出格式化
|
|
674
|
-
│ │ ├── validator.js # 参数验证
|
|
675
|
-
│ │ └── keychain.js # 密钥链操作
|
|
676
|
-
│ └── templates/ # 模板文件
|
|
677
|
-
├── skills/ # Claude Code Skills
|
|
678
|
-
├── tests/ # 测试文件
|
|
679
|
-
├── package.json
|
|
680
|
-
└── README.md
|
|
301
|
+
# Check context
|
|
302
|
+
barista context show
|
|
681
303
|
```
|
|
682
304
|
|
|
683
|
-
###
|
|
305
|
+
### API Errors
|
|
684
306
|
|
|
685
307
|
```bash
|
|
686
|
-
#
|
|
687
|
-
|
|
688
|
-
cd coffee-barista-cli
|
|
689
|
-
|
|
690
|
-
# 2. 安装依赖
|
|
691
|
-
npm install
|
|
692
|
-
|
|
693
|
-
# 3. 链接到全局(开发模式)
|
|
694
|
-
npm link
|
|
695
|
-
|
|
696
|
-
# 4. 验证链接
|
|
697
|
-
barista --version
|
|
698
|
-
|
|
699
|
-
# 5. 运行测试
|
|
700
|
-
npm test
|
|
308
|
+
# Always use --json to get error codes
|
|
309
|
+
barista liberica orders list --json
|
|
701
310
|
|
|
702
|
-
#
|
|
703
|
-
|
|
311
|
+
# Error response includes requestId for debugging
|
|
312
|
+
# "requestId": "req-abc123"
|
|
704
313
|
```
|
|
705
314
|
|
|
706
|
-
###
|
|
707
|
-
|
|
708
|
-
**重要**:新增命令必须遵循 [命令设计规范](./docs/COMMAND_DESIGN_SPEC.md),包含设计文档编写、技术评审等完整流程。
|
|
709
|
-
|
|
710
|
-
详细步骤请参考:
|
|
711
|
-
- [完整命令参考](./docs/commands/REFERENCE.md) - 所有命令清单和开发优先级
|
|
712
|
-
- [命令设计规范文档](./docs/COMMAND_DESIGN_SPEC.md#5-命令开发流程规范)
|
|
713
|
-
- [命令开发指南](./docs/COMMANDS.md)
|
|
714
|
-
|
|
715
|
-
---
|
|
716
|
-
|
|
717
|
-
## 贡献指南
|
|
718
|
-
|
|
719
|
-
我们欢迎所有形式的贡献,包括但不限于:
|
|
720
|
-
|
|
721
|
-
- 🐛 报告 Bug
|
|
722
|
-
- 💡 提出新功能建议
|
|
723
|
-
- 📝 改进文档
|
|
724
|
-
- 🔧 提交代码修复
|
|
725
|
-
- ✨ 添加新功能
|
|
726
|
-
|
|
727
|
-
### 提交规范
|
|
728
|
-
|
|
729
|
-
请遵循 [Conventional Commits](https://www.conventionalcommits.org/) 规范:
|
|
315
|
+
### Timeout Issues
|
|
730
316
|
|
|
731
317
|
```bash
|
|
732
|
-
#
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
# 添加功能
|
|
736
|
-
feat: 添加库存查询命令
|
|
737
|
-
|
|
738
|
-
# 文档更新
|
|
739
|
-
docs: 更新 README 中的环境映射
|
|
318
|
+
# Switch to closer environment
|
|
319
|
+
barista context use-env dev
|
|
740
320
|
|
|
741
|
-
#
|
|
742
|
-
refactor: 重构 API 客户端错误处理
|
|
321
|
+
# Or adjust timeout in config.yaml
|
|
743
322
|
```
|
|
744
323
|
|
|
745
|
-
### 开发流程
|
|
746
|
-
|
|
747
|
-
1. Fork 本仓库
|
|
748
|
-
2. 创建功能分支:`git checkout -b feature/my-feature`
|
|
749
|
-
3. 提交更改:`git commit -m 'feat: add some feature'`
|
|
750
|
-
4. 推送分支:`git push origin feature/my-feature`
|
|
751
|
-
5. 创建 Pull Request
|
|
752
|
-
|
|
753
324
|
---
|
|
754
325
|
|
|
755
|
-
##
|
|
326
|
+
## 📚 Related Projects
|
|
756
327
|
|
|
757
|
-
|
|
|
758
|
-
|
|
759
|
-
| ☕ Liberica Backend |
|
|
760
|
-
| 🖥️ Liberica Frontend |
|
|
761
|
-
| 📱 Liberica Mobile |
|
|
762
|
-
| 🛒 Arabica Backend |
|
|
763
|
-
| 🌐 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 |
|
|
764
335
|
|
|
765
336
|
---
|
|
766
337
|
|
|
767
|
-
##
|
|
338
|
+
## 📄 License
|
|
768
339
|
|
|
769
340
|
[MIT](LICENSE) © Newpeak Technology
|
|
770
|
-
|
|
771
|
-
---
|
|
772
|
-
|
|
773
|
-
<p align="center">
|
|
774
|
-
用 ☕ 驱动生产力
|
|
775
|
-
</p>
|