@newpeak/barista-cli 0.1.133 → 0.1.162

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.
Files changed (178) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/liberica/actual-production/create.d.ts.map +1 -1
  3. package/dist/commands/liberica/actual-production/create.js +36 -1
  4. package/dist/commands/liberica/actual-production/create.js.map +1 -1
  5. package/dist/commands/liberica/aps/list.d.ts.map +1 -1
  6. package/dist/commands/liberica/aps/list.js +3 -2
  7. package/dist/commands/liberica/aps/list.js.map +1 -1
  8. package/dist/commands/liberica/aps/schedule.d.ts.map +1 -1
  9. package/dist/commands/liberica/aps/schedule.js +2 -1
  10. package/dist/commands/liberica/aps/schedule.js.map +1 -1
  11. package/dist/commands/liberica/bom/copy.js +1 -1
  12. package/dist/commands/liberica/bom/copy.js.map +1 -1
  13. package/dist/commands/liberica/bom/delete.js +1 -1
  14. package/dist/commands/liberica/bom/delete.js.map +1 -1
  15. package/dist/commands/liberica/bom/disable.d.ts.map +1 -1
  16. package/dist/commands/liberica/bom/disable.js +3 -4
  17. package/dist/commands/liberica/bom/disable.js.map +1 -1
  18. package/dist/commands/liberica/bom/enable.d.ts.map +1 -1
  19. package/dist/commands/liberica/bom/enable.js +3 -4
  20. package/dist/commands/liberica/bom/enable.js.map +1 -1
  21. package/dist/commands/liberica/bom/review.d.ts.map +1 -1
  22. package/dist/commands/liberica/bom/review.js +3 -4
  23. package/dist/commands/liberica/bom/review.js.map +1 -1
  24. package/dist/commands/liberica/bom/unReview.d.ts.map +1 -1
  25. package/dist/commands/liberica/bom/unReview.js +3 -4
  26. package/dist/commands/liberica/bom/unReview.js.map +1 -1
  27. package/dist/commands/liberica/bom/update.js +1 -1
  28. package/dist/commands/liberica/bom/update.js.map +1 -1
  29. package/dist/commands/liberica/cutting-material/list.d.ts.map +1 -1
  30. package/dist/commands/liberica/cutting-material/list.js +9 -3
  31. package/dist/commands/liberica/cutting-material/list.js.map +1 -1
  32. package/dist/commands/liberica/finance/invoices/create.d.ts.map +1 -1
  33. package/dist/commands/liberica/finance/invoices/create.js +13 -0
  34. package/dist/commands/liberica/finance/invoices/create.js.map +1 -1
  35. package/dist/commands/liberica/finance/proceeds/create.d.ts.map +1 -1
  36. package/dist/commands/liberica/finance/proceeds/create.js +13 -1
  37. package/dist/commands/liberica/finance/proceeds/create.js.map +1 -1
  38. package/dist/commands/liberica/inventory-shortage/__tests__/create.test.js +45 -8
  39. package/dist/commands/liberica/inventory-shortage/__tests__/create.test.js.map +1 -1
  40. package/dist/commands/liberica/inventory-shortage/create.d.ts +7 -0
  41. package/dist/commands/liberica/inventory-shortage/create.d.ts.map +1 -1
  42. package/dist/commands/liberica/inventory-shortage/create.js +12 -4
  43. package/dist/commands/liberica/inventory-shortage/create.js.map +1 -1
  44. package/dist/commands/liberica/material-issue/create.d.ts.map +1 -1
  45. package/dist/commands/liberica/material-issue/create.js +28 -3
  46. package/dist/commands/liberica/material-issue/create.js.map +1 -1
  47. package/dist/commands/liberica/material-issue/update.d.ts.map +1 -1
  48. package/dist/commands/liberica/material-issue/update.js +6 -2
  49. package/dist/commands/liberica/material-issue/update.js.map +1 -1
  50. package/dist/commands/liberica/material-return/create.d.ts.map +1 -1
  51. package/dist/commands/liberica/material-return/create.js +13 -1
  52. package/dist/commands/liberica/material-return/create.js.map +1 -1
  53. package/dist/commands/liberica/mes-result/list.d.ts.map +1 -1
  54. package/dist/commands/liberica/mes-result/list.js +9 -3
  55. package/dist/commands/liberica/mes-result/list.js.map +1 -1
  56. package/dist/commands/liberica/mould/list.d.ts.map +1 -1
  57. package/dist/commands/liberica/mould/list.js +3 -2
  58. package/dist/commands/liberica/mould/list.js.map +1 -1
  59. package/dist/commands/liberica/mould/register.d.ts.map +1 -1
  60. package/dist/commands/liberica/mould/register.js +9 -3
  61. package/dist/commands/liberica/mould/register.js.map +1 -1
  62. package/dist/commands/liberica/mould/stock-in.d.ts.map +1 -1
  63. package/dist/commands/liberica/mould/stock-in.js +7 -4
  64. package/dist/commands/liberica/mould/stock-in.js.map +1 -1
  65. package/dist/commands/liberica/operations/create.js +1 -1
  66. package/dist/commands/liberica/operations/create.js.map +1 -1
  67. package/dist/commands/liberica/outsourcing-orders/get.d.ts +3 -0
  68. package/dist/commands/liberica/outsourcing-orders/get.d.ts.map +1 -0
  69. package/dist/commands/liberica/outsourcing-orders/get.js +75 -0
  70. package/dist/commands/liberica/outsourcing-orders/get.js.map +1 -0
  71. package/dist/commands/liberica/outsourcing-orders/index.d.ts.map +1 -1
  72. package/dist/commands/liberica/outsourcing-orders/index.js +2 -0
  73. package/dist/commands/liberica/outsourcing-orders/index.js.map +1 -1
  74. package/dist/commands/liberica/physical-inventory/list.d.ts.map +1 -1
  75. package/dist/commands/liberica/physical-inventory/list.js +3 -2
  76. package/dist/commands/liberica/physical-inventory/list.js.map +1 -1
  77. package/dist/commands/liberica/plan-orders/create.d.ts.map +1 -1
  78. package/dist/commands/liberica/plan-orders/create.js +6 -2
  79. package/dist/commands/liberica/plan-orders/create.js.map +1 -1
  80. package/dist/commands/liberica/plan-orders/list.d.ts.map +1 -1
  81. package/dist/commands/liberica/plan-orders/list.js +8 -2
  82. package/dist/commands/liberica/plan-orders/list.js.map +1 -1
  83. package/dist/commands/liberica/plan-orders/update.js +1 -1
  84. package/dist/commands/liberica/plan-orders/update.js.map +1 -1
  85. package/dist/commands/liberica/product-stock-in/create.d.ts.map +1 -1
  86. package/dist/commands/liberica/product-stock-in/create.js +2 -0
  87. package/dist/commands/liberica/product-stock-in/create.js.map +1 -1
  88. package/dist/commands/liberica/product-stock-out/create.d.ts.map +1 -1
  89. package/dist/commands/liberica/product-stock-out/create.js +7 -1
  90. package/dist/commands/liberica/product-stock-out/create.js.map +1 -1
  91. package/dist/commands/liberica/product-stock-out/list.d.ts.map +1 -1
  92. package/dist/commands/liberica/product-stock-out/list.js +9 -3
  93. package/dist/commands/liberica/product-stock-out/list.js.map +1 -1
  94. package/dist/commands/liberica/purchase-orders/stock-in-create.d.ts.map +1 -1
  95. package/dist/commands/liberica/purchase-orders/stock-in-create.js +7 -2
  96. package/dist/commands/liberica/purchase-orders/stock-in-create.js.map +1 -1
  97. package/dist/commands/liberica/quality/get.d.ts.map +1 -1
  98. package/dist/commands/liberica/quality/get.js +32 -10
  99. package/dist/commands/liberica/quality/get.js.map +1 -1
  100. package/dist/commands/liberica/quotations/create.d.ts.map +1 -1
  101. package/dist/commands/liberica/quotations/create.js +16 -0
  102. package/dist/commands/liberica/quotations/create.js.map +1 -1
  103. package/dist/commands/liberica/replenish-orders/create.d.ts.map +1 -1
  104. package/dist/commands/liberica/replenish-orders/create.js +8 -0
  105. package/dist/commands/liberica/replenish-orders/create.js.map +1 -1
  106. package/dist/commands/liberica/routing/compute.js +1 -1
  107. package/dist/commands/liberica/routing/compute.js.map +1 -1
  108. package/dist/commands/liberica/routing/copy.js +1 -1
  109. package/dist/commands/liberica/routing/copy.js.map +1 -1
  110. package/dist/commands/liberica/routing/delete.js +1 -1
  111. package/dist/commands/liberica/routing/delete.js.map +1 -1
  112. package/dist/commands/liberica/routing/disable.js +2 -2
  113. package/dist/commands/liberica/routing/disable.js.map +1 -1
  114. package/dist/commands/liberica/routing/enable.js +1 -1
  115. package/dist/commands/liberica/routing/enable.js.map +1 -1
  116. package/dist/commands/liberica/routing/review.js +2 -2
  117. package/dist/commands/liberica/routing/review.js.map +1 -1
  118. package/dist/commands/liberica/routing/unReview.js +2 -2
  119. package/dist/commands/liberica/routing/unReview.js.map +1 -1
  120. package/dist/commands/liberica/routing/update.js +1 -1
  121. package/dist/commands/liberica/routing/update.js.map +1 -1
  122. package/dist/commands/liberica/sales-orders/create.d.ts.map +1 -1
  123. package/dist/commands/liberica/sales-orders/create.js +8 -2
  124. package/dist/commands/liberica/sales-orders/create.js.map +1 -1
  125. package/dist/commands/liberica/sales-orders/submit.d.ts.map +1 -1
  126. package/dist/commands/liberica/sales-orders/submit.js +10 -0
  127. package/dist/commands/liberica/sales-orders/submit.js.map +1 -1
  128. package/dist/commands/liberica/sales-orders/update.js +1 -1
  129. package/dist/commands/liberica/sales-orders/update.js.map +1 -1
  130. package/dist/commands/liberica/stock-reservation/create.d.ts.map +1 -1
  131. package/dist/commands/liberica/stock-reservation/create.js +30 -1
  132. package/dist/commands/liberica/stock-reservation/create.js.map +1 -1
  133. package/dist/commands/liberica/supplier-price/create.d.ts.map +1 -1
  134. package/dist/commands/liberica/supplier-price/create.js +13 -1
  135. package/dist/commands/liberica/supplier-price/create.js.map +1 -1
  136. package/dist/commands/liberica/supplier-price/list.d.ts.map +1 -1
  137. package/dist/commands/liberica/supplier-price/list.js +66 -77
  138. package/dist/commands/liberica/supplier-price/list.js.map +1 -1
  139. package/dist/commands/liberica/suppliers/update.d.ts.map +1 -1
  140. package/dist/commands/liberica/suppliers/update.js +10 -4
  141. package/dist/commands/liberica/suppliers/update.js.map +1 -1
  142. package/dist/commands/liberica/work-orders/create.js +2 -2
  143. package/dist/commands/liberica/work-orders/create.js.map +1 -1
  144. package/dist/core/api/client.d.ts +4 -0
  145. package/dist/core/api/client.d.ts.map +1 -1
  146. package/dist/core/api/client.js +89 -0
  147. package/dist/core/api/client.js.map +1 -1
  148. package/dist/types/aps.d.ts +2 -1
  149. package/dist/types/aps.d.ts.map +1 -1
  150. package/dist/types/bom.d.ts +4 -4
  151. package/dist/types/material-return.d.ts +1 -0
  152. package/dist/types/material-return.d.ts.map +1 -1
  153. package/dist/types/mould-stock-in.d.ts +1 -1
  154. package/dist/types/outsourcing-order.d.ts +36 -0
  155. package/dist/types/outsourcing-order.d.ts.map +1 -1
  156. package/dist/types/outsourcing-order.js +1 -0
  157. package/dist/types/outsourcing-order.js.map +1 -1
  158. package/dist/types/plan-order.d.ts +4 -2
  159. package/dist/types/plan-order.d.ts.map +1 -1
  160. package/dist/types/quotation.d.ts +1 -0
  161. package/dist/types/quotation.d.ts.map +1 -1
  162. package/dist/types/replenish-order.d.ts +1 -0
  163. package/dist/types/replenish-order.d.ts.map +1 -1
  164. package/dist/types/routing.d.ts +4 -4
  165. package/dist/types/sales-order.d.ts +3 -0
  166. package/dist/types/sales-order.d.ts.map +1 -1
  167. package/dist/types/supplier-price.d.ts +3 -3
  168. package/dist/types/supplier-price.d.ts.map +1 -1
  169. package/dist/types/supplier.d.ts +7 -1
  170. package/dist/types/supplier.d.ts.map +1 -1
  171. package/dist/types/work-order.d.ts +1 -1
  172. package/dist/types/work-order.d.ts.map +1 -1
  173. package/package.json +1 -1
  174. package/skills/barista-cli/SKILL.md +193 -193
  175. package/skills/barista-cli/data/commands.json +8 -3
  176. package/skills/barista-cli/data/commands.yaml +6 -3
  177. package/skills/barista-cli/scripts/search.py +194 -194
  178. package/skills/barista-cli/skill.json +17 -17
@@ -1,193 +1,193 @@
1
- ---
2
- name: barista-cli
3
- description: >-
4
- Barista CLI — 让 AI 助手通过命令行操控企业生产管理系统。
5
- 【Liberica】生产管理 SaaS(70+ 模块:基础资料/供应链/库存/生产/BOM/计划/质量/财务/HR/团队等)。
6
- 用户为租户企业员工,通过 tenant + username 登录。
7
- 【Arabica】Liberica 在线订阅平台(套餐/订阅下单/发票/企业管理)。
8
- 用户为会员(个人账号),通过 account + password 登录。
9
- Actions: list, get, create, update, delete, submit, cancel, review, batch-review,
10
- enable, disable, copy, track, export, import, compute, release, complete, register.
11
- ---
12
-
13
- # Barista CLI — AI 操控企业生产管理系统
14
-
15
- ## 系统关系
16
-
17
- **Liberica** = 生产管理 SaaS(制造企业 ERP)。用户=**租户企业员工**,登录=tenant+username+password。
18
- **Arabica** = Liberica 在线订阅平台。用户=**会员**(个人账号),登录=account+password。
19
-
20
- 两者用户体系完全独立,但有业务流程关联:
21
-
22
- ```
23
- 会员注册 Arabica → 登录 → 注册企业 → 选套餐下单 → 获得 Liberica 权限
24
- → 员工登录 Liberica → 日常生产管理(采购/库存/生产/销售等)
25
- ```
26
-
27
- ## When to Apply
28
-
29
- | 场景 | 系统 | 判断 |
30
- |------|------|------|
31
- | 生产数据(订单/库存/物料/BOM/工单/质量/财务/HR) | **Liberica** | 涉及制造企业日常运营 |
32
- | 订阅/套餐/购买/发票/企业注册 | **Arabica** | 涉及购买 Liberica 服务 |
33
- | 先看用户意图对应哪个业务领域 | 判断后再选系统 | 不确定时问用户 |
34
-
35
- ## CRITICAL: 关键陷阱(AI 必须遵守)
36
-
37
- ### 1. 邮箱用户名登录
38
- ```bash
39
- # ✅ 正确:用位置参数
40
- barista liberica auth login dev shanghai admin@shanghai.newpeaksh.com 123456
41
- # ❌ 错误:--username 遇到 @ 会报 A0900006
42
- barista liberica auth login --username admin@shanghai.newpeaksh.com
43
- ```
44
-
45
- ### 2. teams issues 的 --tenant 被忽略
46
- ```bash
47
- # ✅ 正确:先切换 context
48
- barista context use-tenant coffee
49
- barista liberica teams issues update <id> --status CLOSED --assign-to <uid>
50
-
51
- # ❌ 错误:--tenant coffee 被忽略,使用配置中的默认 tenant
52
- barista liberica teams issues update <id> --status CLOSED --tenant coffee
53
- ```
54
-
55
- **已知忽略 --tenant 的命令**:teams issues update/close/get/delete
56
-
57
- ### 3. teams issues close 需要 --assign-to
58
- ```
59
- A1506: 负责人ID列表不能为空
60
- # 用 update 代替 close:
61
- barista liberica teams issues update <id> --status CLOSED --assign-to <userId>
62
- ```
63
-
64
- ### 4. 日期字段用 epoch ms
65
- ```bash
66
- # ✅ 正确:Date.now() → 1746547200000
67
- # ❌ 错误:"2025-05-06" 导致 B0001
68
- ```
69
- 影响命令:transfer-out-forms create(stockDate)、finance invoices create(invoiceDate)
70
-
71
- ### 5. Liberica vs Arabica 登录差异
72
- | | Liberica | Arabica |
73
- |--|----------|---------|
74
- | 命令 | `barista liberica auth login <env> <tenant> <username> <password>` | `barista arabica auth login <env> <account> <password>` |
75
- | 有无 tenant | 有 | 无 |
76
- | 用户类型 | 企业员工 | 会员 |
77
- | 注册 | 无注册命令 | `barista arabica auth register` |
78
-
79
- ### 6. 两个独立的问题系统
80
- - `liberica issue submit` — 向开发团队上报需求/BUG(通过 Typica → GitLab Issue)
81
- - 默认上报到 **CLI 项目**(barista)
82
- - `--project-code arabica` 上报到 **Arabica 项目**
83
- - `--project-code liberica` 上报到 **Liberica 项目**
84
- - `--type BUG|REQUIREMENT|QUESTION` 指定问题类型
85
- - 可用 `validate-project <code>` 验证项目代号是否有效
86
- - `liberica teams issues` — 团队内部项目的问题管理(本地 DB)
87
- - 关闭已上报的 issue:在 teams issues 中过滤 BARISTA 项目 ID `2048236204222570498`
88
-
89
- ### 7. token 存储
90
- - Token 存在系统密钥链(keytar),fallback 到 AES-256-GCM 加密文件
91
- - Liberica key 格式:`liberica:{environment}:{tenant}`
92
- - Arabica key 格式:`arabica:{environment}`(无 tenant)
93
-
94
- ## 安全规则
95
-
96
- 所有写操作(create/update/delete/batch-*)必须先 dry-run 再 force:
97
-
98
- ```typescript
99
- // 1. 预览
100
- const preview = await $`barista liberica <resource> <action> --dry-run --json`
101
- const { success, data } = JSON.parse(preview.stdout)
102
- if (!success) throw new Error(data.error?.message)
103
-
104
- // 2. 验证 preview 内容是否正确
105
-
106
- // 3. 执行
107
- const result = await $`barista liberica <resource> <action> --force --json`
108
- ```
109
-
110
- ## 如何查找命令
111
-
112
- 当需要查找具体命令时,使用 search.py 按用户意图搜索。search.py 位于技能安装目录下的 `scripts/search.py`:
113
-
114
- ```bash
115
- # 示例路径(根据你的 AI 平台调整):
116
- python3 .claude/skills/barista-cli/scripts/search.py "<用户意图>" [--domain <domain>]
117
- # 或使用 barista 内置搜索:
118
- barista skills query "<用户意图>" [--domain <domain>]
119
- ```
120
-
121
- **domain 选项**:
122
-
123
- | domain | 搜索范围 |
124
- |--------|----------|
125
- | 不传 | 所有服务 |
126
- | `liberica` | 仅 Liberica |
127
- | `liberica.purchase-orders` | Liberica 采购订单模块 |
128
- | `liberica.finance.invoices` | Liberica 财务发票子模块 |
129
- | `arabica` | 仅 Arabica |
130
- | `arabica.plans` | Arabica 套餐模块 |
131
-
132
- **示例**:
133
- ```bash
134
- python3 search.py "采购订单 列表" --domain liberica
135
- python3 search.py "创建入库单"
136
- python3 search.py "subscription" --domain arabica
137
- python3 search.py "invoice" --domain arabica.invoices
138
- ```
139
-
140
- ## JSON 响应格式
141
-
142
- 所有命令的 `--json` 输出遵循统一格式:
143
-
144
- ```json
145
- {
146
- "success": true,
147
- "data": {
148
- "items": [...],
149
- "pagination": { "page": 1, "size": 20, "total": 150 }
150
- },
151
- "meta": { "requestId": "...", "timestamp": "...", "environment": "dev", "tenant": "..." }
152
- }
153
- ```
154
-
155
- 错误格式(两种):
156
- ```json
157
- { "success": false, "code": "B0301", "message": "TOKEN解析失败" }
158
- { "success": false, "error": { "code": "A150001", "message": "..." } }
159
- ```
160
-
161
- ## 常见错误
162
-
163
- | 错误 | 含义 | 修复 |
164
- |------|------|------|
165
- | B0301 | Liberica token 过期/invalid | `barista liberica auth login <env> <tenant> <username> <password>` |
166
- | A0307 | 获取 token 失败 | 同上 |
167
- | Arabica 登录失败 | 会员 token 过期 | `barista arabica auth login <env> <account> <password>` |
168
- | A958001 | teams issues 的 tenant 不对 | `barista context use-tenant <正确tenant>` 重试 |
169
- | A1506 | 负责人 ID 列表为空 | 用 `update --status CLOSED --assign-to <id>` 代替 close |
170
- | B0001 | 系统执行出错 | 检查日期格式(epoch ms)、必填参数 |
171
- | A0900006 | 错误的账号 | 邮箱用位置参数,不用 --username |
172
- | A1504 | HTTP 方法错误 | CLI 一般自动处理(list→GET,create→POST) |
173
-
174
- ## 内置 JSON 输出
175
-
176
- ```typescript
177
- // AI 在 Claude Code / OpenCode 中执行:
178
- const result = await $`barista liberica <resource> <action> --json`
179
- const { success, data, error } = JSON.parse(result.stdout)
180
-
181
- if (!success) {
182
- if (error?.code === 'B0301') { /* need re-login */ }
183
- throw new Error(error?.message)
184
- }
185
- const items = data?.items || []
186
- ```
187
-
188
- ## ⚠️ 通用约束
189
-
190
- 1. ID 字段必须用 `string` 类型(后端返回 BigInteger 超出 JS number 精度)
191
- 2. 不加 `X-TENANT-ID` header(tenant 在 JWT 中)
192
- 3. Authorization 不加 `Bearer` 前缀
193
- 4. 分页 1-based 直传
1
+ ---
2
+ name: barista-cli
3
+ description: >-
4
+ Barista CLI — 让 AI 助手通过命令行操控企业生产管理系统。
5
+ 【Liberica】生产管理 SaaS(70+ 模块:基础资料/供应链/库存/生产/BOM/计划/质量/财务/HR/团队等)。
6
+ 用户为租户企业员工,通过 tenant + username 登录。
7
+ 【Arabica】Liberica 在线订阅平台(套餐/订阅下单/发票/企业管理)。
8
+ 用户为会员(个人账号),通过 account + password 登录。
9
+ Actions: list, get, create, update, delete, submit, cancel, review, batch-review,
10
+ enable, disable, copy, track, export, import, compute, release, complete, register.
11
+ ---
12
+
13
+ # Barista CLI — AI 操控企业生产管理系统
14
+
15
+ ## 系统关系
16
+
17
+ **Liberica** = 生产管理 SaaS(制造企业 ERP)。用户=**租户企业员工**,登录=tenant+username+password。
18
+ **Arabica** = Liberica 在线订阅平台。用户=**会员**(个人账号),登录=account+password。
19
+
20
+ 两者用户体系完全独立,但有业务流程关联:
21
+
22
+ ```
23
+ 会员注册 Arabica → 登录 → 注册企业 → 选套餐下单 → 获得 Liberica 权限
24
+ → 员工登录 Liberica → 日常生产管理(采购/库存/生产/销售等)
25
+ ```
26
+
27
+ ## When to Apply
28
+
29
+ | 场景 | 系统 | 判断 |
30
+ |------|------|------|
31
+ | 生产数据(订单/库存/物料/BOM/工单/质量/财务/HR) | **Liberica** | 涉及制造企业日常运营 |
32
+ | 订阅/套餐/购买/发票/企业注册 | **Arabica** | 涉及购买 Liberica 服务 |
33
+ | 先看用户意图对应哪个业务领域 | 判断后再选系统 | 不确定时问用户 |
34
+
35
+ ## CRITICAL: 关键陷阱(AI 必须遵守)
36
+
37
+ ### 1. 邮箱用户名登录
38
+ ```bash
39
+ # ✅ 正确:用位置参数
40
+ barista liberica auth login dev shanghai admin@shanghai.newpeaksh.com 123456
41
+ # ❌ 错误:--username 遇到 @ 会报 A0900006
42
+ barista liberica auth login --username admin@shanghai.newpeaksh.com
43
+ ```
44
+
45
+ ### 2. teams issues 的 --tenant 被忽略
46
+ ```bash
47
+ # ✅ 正确:先切换 context
48
+ barista context use-tenant coffee
49
+ barista liberica teams issues update <id> --status CLOSED --assign-to <uid>
50
+
51
+ # ❌ 错误:--tenant coffee 被忽略,使用配置中的默认 tenant
52
+ barista liberica teams issues update <id> --status CLOSED --tenant coffee
53
+ ```
54
+
55
+ **已知忽略 --tenant 的命令**:teams issues update/close/get/delete
56
+
57
+ ### 3. teams issues close 需要 --assign-to
58
+ ```
59
+ A1506: 负责人ID列表不能为空
60
+ # 用 update 代替 close:
61
+ barista liberica teams issues update <id> --status CLOSED --assign-to <userId>
62
+ ```
63
+
64
+ ### 4. 日期字段用 epoch ms
65
+ ```bash
66
+ # ✅ 正确:Date.now() → 1746547200000
67
+ # ❌ 错误:"2025-05-06" 导致 B0001
68
+ ```
69
+ 影响命令:transfer-out-forms create(stockDate)、finance invoices create(invoiceDate)
70
+
71
+ ### 5. Liberica vs Arabica 登录差异
72
+ | | Liberica | Arabica |
73
+ |--|----------|---------|
74
+ | 命令 | `barista liberica auth login <env> <tenant> <username> <password>` | `barista arabica auth login <env> <account> <password>` |
75
+ | 有无 tenant | 有 | 无 |
76
+ | 用户类型 | 企业员工 | 会员 |
77
+ | 注册 | 无注册命令 | `barista arabica auth register` |
78
+
79
+ ### 6. 两个独立的问题系统
80
+ - `liberica issue submit` — 向开发团队上报需求/BUG(通过 Typica → GitLab Issue)
81
+ - 默认上报到 **CLI 项目**(barista)
82
+ - `--project-code arabica` 上报到 **Arabica 项目**
83
+ - `--project-code liberica` 上报到 **Liberica 项目**
84
+ - `--type BUG|REQUIREMENT|QUESTION` 指定问题类型
85
+ - 可用 `validate-project <code>` 验证项目代号是否有效
86
+ - `liberica teams issues` — 团队内部项目的问题管理(本地 DB)
87
+ - 关闭已上报的 issue:在 teams issues 中过滤 BARISTA 项目 ID `2048236204222570498`
88
+
89
+ ### 7. token 存储
90
+ - Token 存在系统密钥链(keytar),fallback 到 AES-256-GCM 加密文件
91
+ - Liberica key 格式:`liberica:{environment}:{tenant}`
92
+ - Arabica key 格式:`arabica:{environment}`(无 tenant)
93
+
94
+ ## 安全规则
95
+
96
+ 所有写操作(create/update/delete/batch-*)必须先 dry-run 再 force:
97
+
98
+ ```typescript
99
+ // 1. 预览
100
+ const preview = await $`barista liberica <resource> <action> --dry-run --json`
101
+ const { success, data } = JSON.parse(preview.stdout)
102
+ if (!success) throw new Error(data.error?.message)
103
+
104
+ // 2. 验证 preview 内容是否正确
105
+
106
+ // 3. 执行
107
+ const result = await $`barista liberica <resource> <action> --force --json`
108
+ ```
109
+
110
+ ## 如何查找命令
111
+
112
+ 当需要查找具体命令时,使用 search.py 按用户意图搜索。search.py 位于技能安装目录下的 `scripts/search.py`:
113
+
114
+ ```bash
115
+ # 示例路径(根据你的 AI 平台调整):
116
+ python3 .claude/skills/barista-cli/scripts/search.py "<用户意图>" [--domain <domain>]
117
+ # 或使用 barista 内置搜索:
118
+ barista skills query "<用户意图>" [--domain <domain>]
119
+ ```
120
+
121
+ **domain 选项**:
122
+
123
+ | domain | 搜索范围 |
124
+ |--------|----------|
125
+ | 不传 | 所有服务 |
126
+ | `liberica` | 仅 Liberica |
127
+ | `liberica.purchase-orders` | Liberica 采购订单模块 |
128
+ | `liberica.finance.invoices` | Liberica 财务发票子模块 |
129
+ | `arabica` | 仅 Arabica |
130
+ | `arabica.plans` | Arabica 套餐模块 |
131
+
132
+ **示例**:
133
+ ```bash
134
+ python3 search.py "采购订单 列表" --domain liberica
135
+ python3 search.py "创建入库单"
136
+ python3 search.py "subscription" --domain arabica
137
+ python3 search.py "invoice" --domain arabica.invoices
138
+ ```
139
+
140
+ ## JSON 响应格式
141
+
142
+ 所有命令的 `--json` 输出遵循统一格式:
143
+
144
+ ```json
145
+ {
146
+ "success": true,
147
+ "data": {
148
+ "items": [...],
149
+ "pagination": { "page": 1, "size": 20, "total": 150 }
150
+ },
151
+ "meta": { "requestId": "...", "timestamp": "...", "environment": "dev", "tenant": "..." }
152
+ }
153
+ ```
154
+
155
+ 错误格式(两种):
156
+ ```json
157
+ { "success": false, "code": "B0301", "message": "TOKEN解析失败" }
158
+ { "success": false, "error": { "code": "A150001", "message": "..." } }
159
+ ```
160
+
161
+ ## 常见错误
162
+
163
+ | 错误 | 含义 | 修复 |
164
+ |------|------|------|
165
+ | B0301 | Liberica token 过期/invalid | `barista liberica auth login <env> <tenant> <username> <password>` |
166
+ | A0307 | 获取 token 失败 | 同上 |
167
+ | Arabica 登录失败 | 会员 token 过期 | `barista arabica auth login <env> <account> <password>` |
168
+ | A958001 | teams issues 的 tenant 不对 | `barista context use-tenant <正确tenant>` 重试 |
169
+ | A1506 | 负责人 ID 列表为空 | 用 `update --status CLOSED --assign-to <id>` 代替 close |
170
+ | B0001 | 系统执行出错 | 检查日期格式(epoch ms)、必填参数 |
171
+ | A0900006 | 错误的账号 | 邮箱用位置参数,不用 --username |
172
+ | A1504 | HTTP 方法错误 | CLI 一般自动处理(list→GET,create→POST) |
173
+
174
+ ## 内置 JSON 输出
175
+
176
+ ```typescript
177
+ // AI 在 Claude Code / OpenCode 中执行:
178
+ const result = await $`barista liberica <resource> <action> --json`
179
+ const { success, data, error } = JSON.parse(result.stdout)
180
+
181
+ if (!success) {
182
+ if (error?.code === 'B0301') { /* need re-login */ }
183
+ throw new Error(error?.message)
184
+ }
185
+ const items = data?.items || []
186
+ ```
187
+
188
+ ## ⚠️ 通用约束
189
+
190
+ 1. ID 字段必须用 `string` 类型(后端返回 BigInteger 超出 JS number 精度)
191
+ 2. 不加 `X-TENANT-ID` header(tenant 在 JWT 中)
192
+ 3. Authorization 不加 `Bearer` 前缀
193
+ 4. 分页 1-based 直传
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_metadata": {
3
- "generatedAt": "2026-05-06T09:00:41.074Z",
3
+ "generatedAt": "2026-05-07T01:16:04.749Z",
4
4
  "source": "src/commands/",
5
5
  "generator": "src/skills/barista-cli/scripts/generate.ts"
6
6
  },
@@ -1018,6 +1018,10 @@
1018
1018
  "json": true,
1019
1019
  "dry-run": true
1020
1020
  },
1021
+ "get": {
1022
+ "description": "Get outsourcing order details by ID",
1023
+ "json": true
1024
+ },
1021
1025
  "history": {
1022
1026
  "description": "Get outsourcing order change history",
1023
1027
  "json": true
@@ -1392,7 +1396,8 @@
1392
1396
  "commands": {
1393
1397
  "create": {
1394
1398
  "description": "Create a stock reservation",
1395
- "json": true
1399
+ "json": true,
1400
+ "dry-run": true
1396
1401
  },
1397
1402
  "list": {
1398
1403
  "description": "List stock reservations with pagination",
@@ -1997,7 +2002,7 @@
1997
2002
  "json": true
1998
2003
  },
1999
2004
  "get": {
2000
- "description": "Get material QC form details by ID",
2005
+ "description": "Get material QC form details by ID or QC code",
2001
2006
  "json": true
2002
2007
  },
2003
2008
  "list": {
@@ -1,5 +1,5 @@
1
1
  # ★ 自动生成。修改源码后重新生成:npm run generate-skills-data
2
- # ★ 生成时间: 2026-05-06T09:00:41.084Z
2
+ # ★ 生成时间: 2026-05-07T01:16:04.757Z
3
3
 
4
4
  global:
5
5
  # ── 全局 ──
@@ -651,6 +651,9 @@ liberica:
651
651
  create:
652
652
  description: "Create a new outsourcing order"
653
653
  options: [--json, --dry-run]
654
+ get:
655
+ description: "Get outsourcing order details by ID"
656
+ options: [--json]
654
657
  history:
655
658
  description: "Get outsourcing order change history"
656
659
  options: [--json]
@@ -890,7 +893,7 @@ liberica:
890
893
  commands:
891
894
  create:
892
895
  description: "Create a stock reservation"
893
- options: [--json]
896
+ options: [--json, --dry-run]
894
897
  list:
895
898
  description: "List stock reservations with pagination"
896
899
  options: [--json]
@@ -1269,7 +1272,7 @@ liberica:
1269
1272
  description: "Fill material QC form info from purchase order"
1270
1273
  options: [--json]
1271
1274
  get:
1272
- description: "Get material QC form details by ID"
1275
+ description: "Get material QC form details by ID or QC code"
1273
1276
  options: [--json]
1274
1277
  list:
1275
1278
  description: "List material QC forms with pagination"