jumbo-toast-cli 0.1.0 → 0.2.0
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.md +19 -3
- package/package.json +1 -1
- package/src/capabilities.mjs +3 -1
- package/src/core.mjs +9 -0
package/README.md
CHANGED
|
@@ -61,16 +61,32 @@ jumbo --profile production control apply --file ./product.json \
|
|
|
61
61
|
--reason "更新商品说明" --idempotency-key "product-copy-20261009-0001" --apply
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
可写种类:`product`、`store-availability`、`store-hours`、`home-bulletins`、`banner`、`feishu-rules
|
|
64
|
+
可写种类:`product`、`store-availability`、`store-hours`、`home-bulletins`、`banner`、`feishu-rules`、`wallet-gift`。商品写入限内容、上下架和排序;没有价格、库存数量、付款、退款、本金充值、角色权限或任意 URL 写入口。
|
|
65
65
|
|
|
66
66
|
服务器校验 revision、权限、原因和幂等键;CLI 在成功回执后必须回读核对。409 时重新导出并检查差异;`APPLY_RESULT_UNKNOWN` 时使用同一文件、原因和幂等键重试;`READBACK_FAILED` 表示不能确认最终状态。
|
|
67
67
|
|
|
68
68
|
## 飞书与后端兼容性
|
|
69
69
|
|
|
70
|
-
安装 CLI 不会部署后台或启动自动提醒。目标后台必须部署兼容的 control-plane/reminder API;旧后台可能返回 404。飞书
|
|
70
|
+
安装 CLI 不会部署后台或启动自动提醒。目标后台必须部署兼容的 control-plane/reminder API;旧后台可能返回 404。飞书 `webhook` 或 `app_bot` 模式都只在服务器配置;CLI 只读取脱敏 readiness 状态或修改业务提醒规则,不持有 webhook、签名密钥、app id/secret、chat id 或 tenant token,也没有本地常驻转发命令。
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
默认关闭的后台通知任务负责新订单 Card 2.0、低库存与每日摘要;历史 text outbox 仍兼容。真实群消息送达需在服务器选择并完整配置一种模式后单独验证;客户端安装成功或 `deliveryReady=true` 都不等于飞书已实际送达。
|
|
73
73
|
|
|
74
74
|
## 许可
|
|
75
75
|
|
|
76
76
|
客户端代码采用 MIT,见包内 LICENSE。包不包含门店品牌图片、数据库、`.env`、profile 或后台源码。
|
|
77
|
+
|
|
78
|
+
## 免费赠送饭卡余额(CLI 0.2.0)
|
|
79
|
+
|
|
80
|
+
此能力要求兼容的新 API 与 owner 登录,npm 安装不部署服务器。`wallet find --nickname 晚安` 精确匹配昵称,最多20项;`unique=false` 或 `truncated=true` 时不得自动选择首项。用核实后的8位公开顾客编号作为 `targetId`。
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
jumbo --profile production wallet find --nickname 晚安
|
|
84
|
+
jumbo --profile production control export --kind wallet-gift --id PUBLIC_USER_NO --out gift.json
|
|
85
|
+
# 仅将 gift.json 的 patch.amountFen 改为 100000(1000元);snapshot 供核对,不是可写字段。
|
|
86
|
+
jumbo --profile production control preview --file gift.json
|
|
87
|
+
jumbo --profile production control apply --file gift.json --reason "商户授权免费赠送1000元" --idempotency-key wallet-gift-UNIQUE_REQUEST_ID --apply
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
只增赠金,单次1–500000整数分并受账户总额上限/冻结状态约束。本金与冻结桶不变,不创建支付或充值单、不发积分、不开放退款提现。费用6000借方/赠金负债2200贷方与 `gift_credit`、审计及幂等回执同事务;日结关闭或任何环节失败整体回滚。`WALLET_ENABLED` 仍只控制收款充值,免费赠金不冒充支付。用户账单按成功余额调整展示,实际金额与赠金腿保留。
|
|
91
|
+
|
|
92
|
+
revision 绑定用户身份、昵称、账户版本和配置投影;昵称变化或余额变化需重新核对导出。`snapshot` 仅展示;服务器忽略其中客户端改值,以实时数据库和 revision 校验为准。相同幂等键/文件/理由重放不二次入账;回读失败或超时不得换键再发。
|
package/package.json
CHANGED
package/src/capabilities.mjs
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// POS: Human/machine discovery contract; listing a capability never grants its server permission.
|
|
4
4
|
// PROTOCOL: Sync core.mjs, apps/api/src/routes/control-plane.ts and docs/operations/JUMBO_CLI_FEISHU.md when commands, filters or permissions change.
|
|
5
5
|
|
|
6
|
-
export const CLI_VERSION = '0.
|
|
6
|
+
export const CLI_VERSION = '0.2.0';
|
|
7
7
|
|
|
8
8
|
export const CONTROL_KINDS = Object.freeze([
|
|
9
|
+
'wallet-gift',
|
|
9
10
|
'product',
|
|
10
11
|
'store-availability',
|
|
11
12
|
'store-hours',
|
|
@@ -15,6 +16,7 @@ export const CONTROL_KINDS = Object.freeze([
|
|
|
15
16
|
]);
|
|
16
17
|
|
|
17
18
|
export const CLI_CAPABILITIES = Object.freeze([
|
|
19
|
+
{ command: 'wallet find', mode: 'read', permission: 'wallet.gift (owner only)', options: ['nickname'] },
|
|
18
20
|
{ command: 'version', mode: 'local', permission: null, options: [] },
|
|
19
21
|
{ command: 'auth login', mode: 'auth', permission: null, options: ['email', 'password-stdin', 'password-file', 'password-env'] },
|
|
20
22
|
{ command: 'auth whoami', mode: 'read', permission: 'active staff', options: [] },
|
package/src/core.mjs
CHANGED
|
@@ -20,6 +20,7 @@ const COMMAND_OPTIONS = Object.freeze({
|
|
|
20
20
|
'auth login': ['email', 'password-stdin', 'password-file', 'password-env'],
|
|
21
21
|
'auth whoami': [],
|
|
22
22
|
'auth logout': [],
|
|
23
|
+
'wallet find': ['nickname'],
|
|
23
24
|
'catalog show': [],
|
|
24
25
|
'products list': ['store-id', 'status', 'q', 'page', 'page-size'],
|
|
25
26
|
'products get': [],
|
|
@@ -350,6 +351,14 @@ export async function executeCommand({ command, args, options }, io) {
|
|
|
350
351
|
return authenticatedRequest(context, io, { path: '/api/admin/me' });
|
|
351
352
|
}
|
|
352
353
|
|
|
354
|
+
if (command === 'wallet find') {
|
|
355
|
+
requireNoArgs(command, args);
|
|
356
|
+
if (!options.nickname) throw new CliError('INVALID_ARGUMENT', 'wallet find requires --nickname', EXIT.USAGE);
|
|
357
|
+
return authenticatedRequest(context, io, {
|
|
358
|
+
path: queryPath('/api/admin/control-plane/wallet-customers', [['nickname', options.nickname]]),
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
353
362
|
if (command === 'catalog show') {
|
|
354
363
|
requireNoArgs(command, args);
|
|
355
364
|
return authenticatedRequest(context, io, { path: '/api/admin/catalog' });
|