cbs-4px-merchant-cli 0.0.9 → 0.0.12

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 (55) hide show
  1. package/README.4px.md +5 -5
  2. package/README.cainiao.md +5 -5
  3. package/README.md +5 -5
  4. package/dist/cli.js +150 -32
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/address.d.ts +7 -1
  7. package/dist/commands/address.js +29 -10
  8. package/dist/commands/address.js.map +1 -1
  9. package/dist/commands/auth.d.ts +1 -0
  10. package/dist/commands/auth.js +87 -0
  11. package/dist/commands/auth.js.map +1 -1
  12. package/dist/commands/config.js +120 -20
  13. package/dist/commands/config.js.map +1 -1
  14. package/dist/commands/onboarding.d.ts +21 -7
  15. package/dist/commands/onboarding.js +95 -18
  16. package/dist/commands/onboarding.js.map +1 -1
  17. package/dist/commands/order.d.ts +38 -6
  18. package/dist/commands/order.js +251 -35
  19. package/dist/commands/order.js.map +1 -1
  20. package/dist/commands/platform.d.ts +50 -0
  21. package/dist/commands/platform.js +108 -6
  22. package/dist/commands/platform.js.map +1 -1
  23. package/dist/commands/product.d.ts +3 -0
  24. package/dist/commands/product.js +3 -0
  25. package/dist/commands/product.js.map +1 -1
  26. package/dist/commands/update.js +124 -3
  27. package/dist/commands/update.js.map +1 -1
  28. package/dist/errors.d.ts +29 -1
  29. package/dist/errors.js +11 -1
  30. package/dist/errors.js.map +1 -1
  31. package/dist/services/api-client.d.ts +49 -13
  32. package/dist/services/api-client.js +231 -45
  33. package/dist/services/api-client.js.map +1 -1
  34. package/dist/services/binary-source.d.ts +30 -0
  35. package/dist/services/binary-source.js +88 -0
  36. package/dist/services/binary-source.js.map +1 -0
  37. package/dist/services/binary-update.d.ts +62 -0
  38. package/dist/services/binary-update.js +179 -0
  39. package/dist/services/binary-update.js.map +1 -0
  40. package/dist/services/install-detector.d.ts +13 -1
  41. package/dist/services/install-detector.js +20 -1
  42. package/dist/services/install-detector.js.map +1 -1
  43. package/dist/types/index.d.ts +199 -12
  44. package/dist/utils/run-command.d.ts +6 -0
  45. package/dist/utils/run-command.js +13 -0
  46. package/dist/utils/run-command.js.map +1 -1
  47. package/package.json +7 -1
  48. package/skill/SKILL.md +14 -12
  49. package/skill/package.json +1 -1
  50. package/skill/reference/auth.md +20 -1
  51. package/skill/reference/index.md +3 -3
  52. package/skill/reference/onboarding.md +121 -52
  53. package/skill/reference/order.md +216 -36
  54. package/skill/reference/platform.md +85 -2
  55. package/skill/reference/product.md +3 -0
@@ -47,23 +47,43 @@ export interface LabelPrintDTO {
47
47
  }
48
48
  export interface ShipperConsigneeVO {
49
49
  orderId: number;
50
+ shipperName: string | null;
51
+ shipperCompany: string | null;
52
+ shipperAddress1: string | null;
53
+ shipperAddress2: string | null;
54
+ shipperPostcode: string | null;
55
+ shipperTelephone: string | null;
56
+ shipperMobile: string | null;
57
+ shipperEmail: string | null;
58
+ shipperCountry: string | null;
59
+ shipperCity: string | null;
60
+ shipperProvince: string | null;
50
61
  consigneeName: string | null;
62
+ consigneeFirstName: string | null;
63
+ consigneeLastName: string | null;
64
+ consigneeCompany: string | null;
51
65
  consigneeAddress1: string | null;
52
66
  consigneeAddress2: string | null;
67
+ consigneeStreet: string | null;
68
+ consigneeDoorNo: string | null;
53
69
  consigneePostcode: string | null;
54
70
  consigneeTelephone: string | null;
55
71
  consigneeMobile: string | null;
72
+ consigneeMail: string | null;
56
73
  consigneeCountry: string | null;
57
74
  consigneeCity: string | null;
58
75
  consigneeProvince: string | null;
59
- shipperName: string | null;
60
- shipperCountry: string | null;
76
+ consigneeVatNo: string | null;
61
77
  }
62
78
  export interface DeclareInvoiceVO {
63
79
  orderId: number;
64
80
  invoiceId: number;
65
81
  ename: string | null;
66
82
  cname: string | null;
83
+ pcs: number | null;
84
+ unitPrice: number | null;
85
+ hscode: string | null;
86
+ weight: number | null;
67
87
  totalPrice: number | null;
68
88
  currency: string | null;
69
89
  }
@@ -77,11 +97,66 @@ export interface BillingFeeItemDetailVO {
77
97
  currencyCode: string | null;
78
98
  billingSuccessDateStr: string | null;
79
99
  }
100
+ /** 单条字段规则(长度/正则/必填等),来自规则库配置 */
101
+ export interface FieldRule {
102
+ ruleType: string | null;
103
+ ruleTypeDesc: string | null;
104
+ ruleValue: string | null;
105
+ }
106
+ /** 某个下单字段的规则集合 */
107
+ export interface OrderFieldRuleItem {
108
+ field: string | null;
109
+ /**
110
+ * 该字段在 order create/edit 的 JSON 里的路径,如 receiver.name、parcel.weight、
111
+ * declareItems[].qty。后端直接给出,不需要自己从 field 换算(两套命名不是驼峰转换)。
112
+ * null 表示该字段不能通过建单/改单接口设置。
113
+ */
114
+ requestPath: string | null;
115
+ fieldLabel: string | null;
116
+ fieldElabel: string | null;
117
+ required: boolean | null;
118
+ rules: FieldRule[];
119
+ placeholder: string[];
120
+ msg: string | null;
121
+ }
122
+ /**
123
+ * 跨字段联动约束。无法用「单字段必填」表达,必须单独判断。
124
+ */
125
+ export interface FieldRuleLinkage {
126
+ iossOrVatEitherRequired: boolean | null;
127
+ hscodeRequiredWhenIoss: boolean | null;
128
+ idOrVatEitherRequired: boolean | null;
129
+ currencyCustoms: string | null;
130
+ currencyMustBeConsistent: boolean | null;
131
+ }
132
+ /**
133
+ * 下单字段规则全量清单。
134
+ *
135
+ * 必填性由规则库按 (产品, 目的国, 客户, 单据状态) 配置,不同产品结论不同 —— 这是
136
+ * 判断字段必填的唯一权威来源,不要在客户端另写一份清单。
137
+ */
138
+ export interface OrderFieldRulesResp {
139
+ productCode: string | null;
140
+ country: string | null;
141
+ fields: OrderFieldRuleItem[];
142
+ linkage: FieldRuleLinkage | null;
143
+ chatReply: string | null;
144
+ }
80
145
  export interface OrderDetailResp {
81
146
  orderDTO: OrderVO | null;
82
147
  shipperConsigneeDTO: ShipperConsigneeVO | null;
83
148
  declareList: DeclareInvoiceVO[];
84
149
  feeDetailList: BillingFeeItemDetailVO[];
150
+ batteryType: string | null;
151
+ iossNo: string | null;
152
+ orderNote: string | null;
153
+ customerWeight: number | null;
154
+ length: number | null;
155
+ width: number | null;
156
+ height: number | null;
157
+ dutyPayMode: string | null;
158
+ salesPlatform: string | null;
159
+ pieces: number | null;
85
160
  totalFee: string | null;
86
161
  weightFee: number | null;
87
162
  chatReplay: string | null;
@@ -93,6 +168,12 @@ export interface ProductRecommendRequest {
93
168
  postCode?: string;
94
169
  isBattery?: string;
95
170
  declareValue?: number;
171
+ /** 包裹长(cm),体积重计费产品必传 */
172
+ length?: number;
173
+ /** 包裹宽(cm) */
174
+ width?: number;
175
+ /** 包裹高(cm) */
176
+ height?: number;
96
177
  }
97
178
  export interface RecommendProductItem {
98
179
  productName: string;
@@ -155,14 +236,23 @@ export interface OrderListRequest {
155
236
  statusName?: string;
156
237
  customerOrderNo?: string;
157
238
  fpxTrackNo?: string;
239
+ queryDateType?: string;
158
240
  queryStartDate?: string;
159
241
  queryEndDate?: string;
160
242
  productCode?: string;
161
243
  destinationCountry?: string;
244
+ consigneeName?: string;
245
+ buyerId?: string;
246
+ isPrint?: string;
247
+ odaConfirm?: string;
248
+ interceptStatus?: string;
249
+ changeNoStatus?: string;
250
+ isHistory?: string;
162
251
  pageNum?: number;
163
252
  pageSize?: number;
164
253
  }
165
254
  export interface OrderSummary {
255
+ orderId: number | null;
166
256
  fpxTrackNo: string | null;
167
257
  customerOrderNo: string | null;
168
258
  statusName: string | null;
@@ -180,19 +270,36 @@ export interface OrderListResp {
180
270
  total: number;
181
271
  list: OrderSummary[];
182
272
  }
273
+ /** 地址类型:shipper 发件人 / consignee 收件人 / return 退件 / collect 揽收 */
274
+ export type AddressType = 'shipper' | 'consignee' | 'return' | 'collect';
275
+ export interface AddressBookListRequest {
276
+ addressType?: AddressType;
277
+ keyword?: string;
278
+ pageNum?: number;
279
+ pageSize?: number;
280
+ }
183
281
  export interface AddressBookItem {
184
- code: string | null;
185
- contact: string | null;
186
- contactPhone: string | null;
187
- emergencyContact: string | null;
282
+ id: string | null;
283
+ addressType: string | null;
284
+ name: string | null;
285
+ company: string | null;
286
+ phone: string | null;
287
+ mobile: string | null;
288
+ email: string | null;
289
+ country: string | null;
188
290
  province: string | null;
189
291
  city: string | null;
190
- county: string | null;
292
+ district: string | null;
191
293
  address: string | null;
192
- containerStuffingLocation: string | null;
294
+ postcode: string | null;
295
+ /** 是否默认地址:Y/N */
296
+ isDefault: string | null;
193
297
  }
194
298
  export interface OrderAddressResp {
195
299
  list: AddressBookItem[];
300
+ total: number | null;
301
+ pageNum: number | null;
302
+ pageSize: number | null;
196
303
  }
197
304
  export interface CountryItem {
198
305
  code: string;
@@ -851,6 +958,24 @@ export interface PlatformOrderItem {
851
958
  createdTime: string | null;
852
959
  pushTime: string | null;
853
960
  }
961
+ export interface PlatformOrderUpdateResp {
962
+ updatedIds: string[];
963
+ failed: {
964
+ id: string;
965
+ errMsg: string;
966
+ }[];
967
+ }
968
+ /**
969
+ * push 的失败明细(每个未能推送的订单一条)。
970
+ *
971
+ * 后端只回失败项:**空数组表示全部推送成功**。已推送的单会以
972
+ * "订单已推送…不能重复推送" 出现在这里 —— 后端按状态拒绝,防止重复建物流单。
973
+ */
974
+ export interface PlatformOrderPushFailure {
975
+ id?: string | null;
976
+ customerOrderNo?: string | null;
977
+ errMsg?: string | null;
978
+ }
854
979
  export interface PlatformOrderListResp {
855
980
  pageNum: number;
856
981
  pageSize: number;
@@ -908,11 +1033,39 @@ export interface CheckAuthCodeRequest {
908
1033
  flowId: string;
909
1034
  isAgent?: boolean;
910
1035
  }
1036
+ /**
1037
+ * 企业实名认证请求。
1038
+ *
1039
+ * 服务端 `startOrganRealNameAuth` 对除 `certTypeEnum` 外的字段全部做
1040
+ * `requireNotBlank` 校验,缺一个就返回 PARAM_REQUIRED,因此这里大多为必填。
1041
+ * `code`(客户编码)与 `creatorId` 由登录上下文填充,不接受调用方传入。
1042
+ */
911
1043
  export interface OrganAuthRequest {
912
1044
  name: string;
913
1045
  certNumber: string;
914
- certType?: number;
915
- agentAccountId?: string;
1046
+ /** 企业证件类型:0 营业执照(统一社会信用代码)… 12 未知,服务端必填 */
1047
+ certType: number;
1048
+ /** 由 certType 推导,如 0 → CRED_ORG_USCC */
1049
+ certTypeEnum?: string;
1050
+ /** 0=企业四要素认证、1=组织机构三要素认证 */
1051
+ authType: number;
1052
+ /** 经办人账号 ID,来自 `auth code --agent` 的返回值 */
1053
+ agentAccountId: string;
1054
+ /** 法定代表人姓名 */
1055
+ legalName: string;
1056
+ /** 法定代表人证件号,authType=0(四要素)时服务端必填 */
1057
+ legalCertNumber?: string;
1058
+ /** 法定代表人证件类型:0 身份证,authType=0 时服务端必填 */
1059
+ legalCertType?: number;
1060
+ /** 国家数字编码,中国大陆为 485 */
1061
+ countryCode: string;
1062
+ /** 国家二字码,中国大陆为 CN */
1063
+ alpha2Code: string;
1064
+ country: string;
1065
+ state: string;
1066
+ city: string;
1067
+ county: string;
1068
+ address: string;
916
1069
  }
917
1070
  export interface OpenBrandRequest {
918
1071
  serviceCode: string;
@@ -1017,7 +1170,10 @@ export interface OrderSenderInfo {
1017
1170
  name?: string;
1018
1171
  company?: string;
1019
1172
  phone?: string;
1173
+ mobile?: string;
1174
+ email?: string;
1020
1175
  address?: string;
1176
+ address2?: string;
1021
1177
  country?: string;
1022
1178
  postcode?: string;
1023
1179
  city?: string;
@@ -1028,12 +1184,19 @@ export interface OrderReceiverInfo {
1028
1184
  company?: string;
1029
1185
  phone?: string;
1030
1186
  mobile?: string;
1187
+ firstName?: string;
1188
+ lastName?: string;
1031
1189
  address?: string;
1190
+ address2?: string;
1191
+ street?: string;
1192
+ doorNo?: string;
1032
1193
  city?: string;
1033
1194
  province?: string;
1034
1195
  postcode?: string;
1035
1196
  country?: string;
1036
1197
  email?: string;
1198
+ idCode?: string;
1199
+ vatNo?: string;
1037
1200
  }
1038
1201
  export interface OrderParcelInfo {
1039
1202
  weight?: number;
@@ -1041,6 +1204,15 @@ export interface OrderParcelInfo {
1041
1204
  width?: number;
1042
1205
  height?: number;
1043
1206
  dutyPayMode?: string;
1207
+ batteryType?: string;
1208
+ iossNo?: string;
1209
+ /** EORI 号(欧盟进口商登记号)。后端字段名为 tariffNo */
1210
+ eoriNo?: string;
1211
+ orderNote?: string;
1212
+ salesPlatform?: string;
1213
+ warehouseCode?: string;
1214
+ codPrice?: number;
1215
+ codCurrency?: string;
1044
1216
  }
1045
1217
  export interface OrderDeclareItemInfo {
1046
1218
  ename?: string;
@@ -1050,15 +1222,29 @@ export interface OrderDeclareItemInfo {
1050
1222
  currency?: string;
1051
1223
  weight?: number;
1052
1224
  hsCode?: string;
1225
+ material?: string;
1226
+ uses?: string;
1227
+ url?: string;
1228
+ brand?: string;
1053
1229
  }
1054
- /** `P` = 预报(直接提交),`D` = 草稿(保存不提交)。后端默认 `P`。 */
1230
+ /**
1231
+ * `P` = 预报(直接提交),`D` = 草稿(保存不提交)。后端默认 `P`。
1232
+ *
1233
+ * 后端已改用语义化的 `draft` 布尔,`status` 仅作兼容保留。订单 JSON 里两者都接受,
1234
+ * CLI 会统一转成 `draft` 发出。
1235
+ */
1055
1236
  export type OrderWriteStatus = 'P' | 'D';
1056
1237
  export interface CreateOrderRequest {
1057
1238
  productCode: string;
1058
1239
  destinationCountry: string;
1059
1240
  originCountry?: string;
1241
+ /** 保存为草稿。与 status 二选一,同时存在时 draft 优先 */
1242
+ draft?: boolean;
1060
1243
  status?: OrderWriteStatus;
1061
1244
  customerOrderNo?: string;
1245
+ pieces?: number;
1246
+ hasBattery?: string;
1247
+ buyerId?: string;
1062
1248
  sender?: OrderSenderInfo;
1063
1249
  receiver?: OrderReceiverInfo;
1064
1250
  parcel?: OrderParcelInfo;
@@ -1071,7 +1257,8 @@ export interface CreateOrderResp {
1071
1257
  customerOrderNo: string | null;
1072
1258
  }
1073
1259
  export interface EditOrderRequest extends Partial<Omit<CreateOrderRequest, 'status'>> {
1074
- orderId: number;
1260
+ /** 要编辑的订单单号(4px 物流单号或客户订单号)。后端按单号反查主键。 */
1261
+ orderNo: string;
1075
1262
  status?: OrderWriteStatus;
1076
1263
  }
1077
1264
  export interface EditOrderResp {
@@ -21,4 +21,10 @@ export interface RunCommandConfig<TData> {
21
21
  * empty branch at all): `consume` owns every output decision.
22
22
  */
23
23
  export declare function withClient<TData>(globalOptions: GlobalOptions, spinnerText: string, fetch: (client: ApiClient) => Promise<TData>, consume: (data: TData) => void): Promise<void>;
24
+ /**
25
+ * 参数校验与文件读取发生在 `withClient` 之前,因此不会经过其统一错误
26
+ * 通道。本包装器确保这类失败仍输出 Agent 可解析的 JSON 错误信封,而不是
27
+ * 未处理的 Promise rejection。
28
+ */
29
+ export declare function preflight<T>(fn: () => Promise<T>): Promise<T>;
24
30
  export declare function runCommand<TData>(globalOptions: GlobalOptions, config: RunCommandConfig<TData>): Promise<void>;
@@ -40,6 +40,19 @@ export async function withClient(globalOptions, spinnerText, fetch, consume) {
40
40
  handleError(error);
41
41
  }
42
42
  }
43
+ /**
44
+ * 参数校验与文件读取发生在 `withClient` 之前,因此不会经过其统一错误
45
+ * 通道。本包装器确保这类失败仍输出 Agent 可解析的 JSON 错误信封,而不是
46
+ * 未处理的 Promise rejection。
47
+ */
48
+ export async function preflight(fn) {
49
+ try {
50
+ return await fn();
51
+ }
52
+ catch (e) {
53
+ handleError(e);
54
+ }
55
+ }
43
56
  export async function runCommand(globalOptions, config) {
44
57
  await withClient(globalOptions, config.spinner, (client) => config.exec(client), (data) => {
45
58
  if (globalOptions.output === 'json') {
@@ -1 +1 @@
1
- {"version":3,"file":"run-command.js","sourceRoot":"","sources":["../../src/utils/run-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAc3D;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,KAAK,UAAU,UAAU,CAC9B,aAA4B,EAC5B,MAA+B;IAE/B,MAAM,UAAU,CACd,aAAa,EACb,MAAM,CAAC,OAAO,EACd,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAC/B,CAAC,IAAI,EAAE,EAAE;QACP,IAAI,aAAa,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YACnD,OAAO;QACT,CAAC;QAED,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,YAAY,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC;YAChE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO;QACT,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cbs-4px-merchant-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.12",
4
4
  "description": "Cbs merchant CLI tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,6 +26,12 @@
26
26
  "build:cainiao:test": "SITE=cainiao ENV=test npm run build",
27
27
  "build:cainiao:pre": "SITE=cainiao ENV=pre npm run build",
28
28
  "package:role-skills": "bash scripts/package-role-skills.sh",
29
+ "build:binary:4px": "node scripts/build-binary.mjs --site 4px --env prod",
30
+ "build:binary:cainiao": "node scripts/build-binary.mjs --site cainiao --env prod",
31
+ "build:binary:host": "node scripts/build-binary.mjs --site 4px --env prod --host",
32
+ "oss:upload": "node scripts/oss-upload.mjs",
33
+ "oss:upload:dry": "node scripts/oss-upload.mjs --dry-run",
34
+ "release:binary": "npm run build:binary:4px && npm run build:binary:cainiao && npm run oss:upload",
29
35
  "dev:4px:test": "SITE=4px ENV=test npm run build && node dist/index.js skill install",
30
36
  "dev:4px:pre": "SITE=4px ENV=pre npm run build && node dist/index.js skill install",
31
37
  "dev:cainiao:test": "SITE=cainiao ENV=test npm run build && node dist/index.js skill install",
package/skill/SKILL.md CHANGED
@@ -119,7 +119,8 @@ description: >-
119
119
  用户提到"计费明细" → `fmc finance fee-detail`
120
120
  用户提到"地址簿/地址列表" → `fmc order address-book`
121
121
  用户提到"目的国/国家查询/搜索国家" → `fmc order country`
122
- 用户提到"下单/开单/建单/寄一个包裹" → `fmc order create --draft`(**写**,先建草稿让用户核对)
122
+ 用户提到"哪些字段必填/要填什么/这个字段怎么填" → `fmc order field-rules --product-code <code> --country <cc>`
123
+ 用户提到"下单/开单/建单/寄一个包裹" → 先 `fmc order field-rules --required-only` 查必填,再 `fmc order create --draft`(**写**,先建草稿让用户核对)
123
124
  用户提到"改单/修改订单/改地址改重量" → `fmc order edit`(**写**,仅草稿与已取消单可改)
124
125
  用户提到"提交预报/发出去/确认发货" → `fmc order forecast`(**写**)
125
126
  用户提到"取消订单/不寄了/作废" → `fmc order cancel`(**写**)
@@ -141,11 +142,12 @@ description: >-
141
142
  用户提到"验证码/收到短信了" → `fmc onboarding auth code`(**写**)
142
143
  用户提到"企业实名/公司认证" → `fmc onboarding auth organ`(**写**)
143
144
  用户提到"港澳台/海外客户认证" → `fmc onboarding auth gat`(**写**)
144
- 用户提到"对公打款/打款金额验证" → `fmc onboarding auth remit`(**写**)
145
+ 用户提到"对公打款/要不要打款" → 入驻流程已取消对公打款环节(`auth organ` 成功即认证完成),用 `fmc onboarding auth schedule` 佐证后告知"无需打款"
145
146
  用户提到"可开通品牌/有哪些品牌" → `fmc onboarding brand list`
146
147
  用户提到"开通品牌/申请合同" → `fmc onboarding brand open`(**写**)
148
+ 用户提到"重复入驻/账号重复注册/通知销售" → `fmc onboarding notify-saler`(**写**,仅在 `brand open` 报重复入驻时用,勿重复发送)
147
149
  用户提到"合同/我的合同" → `fmc onboarding contract list`
148
- 用户提到"签合同/签署链接/下载合同" → `fmc onboarding contract url`
150
+ 用户提到"签合同/签署链接/下载合同" → `fmc onboarding contract url`(须带 `--status`,取自 `contract list`)
149
151
  用户提到"登录/配置key/认证" → `fmc auth login`
150
152
  用户提到"升级/更新/新版本" → `fmc update`
151
153
 
@@ -209,8 +211,8 @@ export BPORTAL_API_KEY=sk-xxxxx
209
211
  | `platform sync` | 提交拉单任务(异步) |
210
212
  | `platform order push` | 订单进入物流履约流程 |
211
213
  | `onboarding auth indiv` / `auth code` / `auth organ` / `auth gat` | 提交实名认证资料 |
212
- | `onboarding auth remit` | 消耗打款校验重试次数 |
213
214
  | `onboarding brand open` | 开通品牌并发起合同申请 |
215
+ | `onboarding notify-saler` | 重复入驻时通知对应销售(勿重复发送) |
214
216
 
215
217
  执行规则:
216
218
 
@@ -225,8 +227,8 @@ export BPORTAL_API_KEY=sk-xxxxx
225
227
 
226
228
  1. `order create --file <json> --draft -y` → 拿到 `orderId`
227
229
  2. `order get <orderNo>` 把收件人、重量、申报品念给用户核对
228
- 3. 有错就 `order edit --order-id <id> --file <json> --draft -y` 改,改到对
229
- 4. 用户明确同意后 `order forecast --ids <id> -y` 提交预报
230
+ 3. 有错就 `order edit --orderNo <单号> --file <json> --draft -y` 改,改到对
231
+ 4. 用户明确同意后 `order forecast --orderNo <单号> -y` 提交预报
230
232
  5. `label get <orderNo>` 取面单
231
233
 
232
234
  只有用户明确说"直接下单/不用确认"时,才允许省掉 `--draft`。
@@ -252,14 +254,14 @@ fmc order list --status IN_TRANSIT
252
254
 
253
255
  # 下单(写操作)—— 先建草稿,用户核对无误后再预报
254
256
  fmc order create --file ./order.json --draft -y
255
- fmc order forecast --ids 1001 -y
257
+ fmc order forecast --orderNo ORD-20260907-001 -y
256
258
 
257
259
  # 改草稿(写操作,只传要改的字段)
258
- fmc order edit --order-id 1001 --file ./patch.json --draft -y
260
+ fmc order edit --orderNo ORD-20260907-001 --file ./patch.json --draft -y
259
261
 
260
262
  # 取消 / 拦截(写操作)
261
- fmc order cancel --ids 1001 --reason "客户取消" -y
262
- fmc order intercept --ids 1001 -y
263
+ fmc order cancel --orderNo 4PX3003136946232CN --reason "客户取消" -y
264
+ fmc order intercept --orderNo 4PX3003136946232CN -y
263
265
 
264
266
  # 获取推荐产品(寄美国)
265
267
  fmc product recommend --country US
@@ -292,9 +294,9 @@ fmc platform sync --seller-account-id 10086 \
292
294
  # 查询入驻进度
293
295
  fmc onboarding progress
294
296
 
295
- # 查询合同并获取签署链接
297
+ # 查询合同并获取签署链接(--status 必填,取自 contract list)
296
298
  fmc onboarding contract list
297
- fmc onboarding contract url CT20260801001
299
+ fmc onboarding contract url CT20260801001 --status 4
298
300
  ```
299
301
 
300
302
  ---
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cbs-4px-merchant-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.12",
4
4
  "description": "BPortal Merchant CLI (fmc) skill — BPortal",
5
5
  "files": [
6
6
  "SKILL.md",
@@ -4,7 +4,8 @@
4
4
 
5
5
  | Command | Description |
6
6
  | --- | --- |
7
- | `fmc auth login` | 配置 API Key |
7
+ | `fmc auth login` | 手动配置 API Key |
8
+ | `fmc auth agentz` | 通过已登录的 agentz-cli 获取并配置 API Key(AgentZ / 数字员工环境) |
8
9
  | `fmc auth status` | 查看当前认证状态 |
9
10
 
10
11
  ## Command details
@@ -35,6 +36,24 @@
35
36
  fmc auth login --api-key sk-xxxxx
36
37
  ```
37
38
 
39
+ ### `fmc auth agentz`
40
+
41
+ | Field | Value |
42
+ | --- | --- |
43
+ | **Name** | `auth agentz` |
44
+ | **Description** | 检测本机 `agentz-cli`,调用 `agentz-cli client token` 获取当前 AgentZ 客户端的 accessToken,再生成并保存商家 API Key |
45
+ | **Usage** | `fmc auth agentz` |
46
+
47
+ 仅在已安装并登录 `agentz-cli` 的 AgentZ / 数字员工环境中使用。accessToken 仅在当前进程中用于生成 API Key,不会写入配置、终端输出或日志;成功生成的 API Key 会保存至 `~/.bportal/config.json`,输出仅展示脱敏值。
48
+
49
+ 若本机没有 `agentz-cli`、客户端未登录或生成失败,请改用原有 `fmc auth login --api-key <key>`,或由运行环境注入 `BPORTAL_API_KEY`。不要手动复制或提供 accessToken。
50
+
51
+ #### Examples
52
+
53
+ ```bash
54
+ fmc auth agentz
55
+ ```
56
+
38
57
  ### `fmc auth status`
39
58
 
40
59
  | Field | Value |
@@ -83,9 +83,9 @@ Command **details** are in sibling `<group>.md` files in this directory.
83
83
  | `fmc onboarding auth code` | 提交验证码完成实名认证(写) | [onboarding.md](onboarding.md) |
84
84
  | `fmc onboarding auth organ` | 发起企业实名认证(写) | [onboarding.md](onboarding.md) |
85
85
  | `fmc onboarding auth gat` | 提交港澳台/海外实名资料(写) | [onboarding.md](onboarding.md) |
86
- | `fmc onboarding auth remit` | 校验对公打款金额(写) | [onboarding.md](onboarding.md) |
87
86
  | `fmc onboarding brand list` | 查询可开通品牌 | [onboarding.md](onboarding.md) |
88
87
  | `fmc onboarding brand open` | 开通品牌并申请合同(写) | [onboarding.md](onboarding.md) |
88
+ | `fmc onboarding notify-saler` | 重复入驻时通知对应销售(写) | [onboarding.md](onboarding.md) |
89
89
  | `fmc onboarding contract list` | 查询合同列表 | [onboarding.md](onboarding.md) |
90
90
  | `fmc onboarding contract url` | 获取合同签署/下载链接 | [onboarding.md](onboarding.md) |
91
91
  | `fmc update` | 升级 CLI 及对应 skill 到最新版本 | [update.md](update.md) |
@@ -111,7 +111,7 @@ Command **details** are in sibling `<group>.md` files in this directory.
111
111
  | `notice` | `list`, `detail`, `message list`, `message detail`, `message unread` | [notice.md](notice.md) |
112
112
  | `customs` | `cargo list`, `commodity list`, `commodity detail`, `hscode search`, `registration info` | [customs.md](customs.md) |
113
113
  | `platform` | `account list`, `sync`, `sync-record list`, `order list`, `order detail`, `order push` | [platform.md](platform.md) |
114
- | `onboarding` | `progress`, `customer-type`, `auth schedule`, `auth indiv`, `auth code`, `auth organ`, `auth gat`, `auth remit`, `brand list`, `brand open`, `contract list`, `contract url` | [onboarding.md](onboarding.md) |
114
+ | `onboarding` | `progress`, `customer-type`, `auth schedule`, `auth indiv`, `auth code`, `auth organ`, `auth gat`, `brand list`, `brand open`, `notify-saler`, `contract list`, `contract url` | [onboarding.md](onboarding.md) |
115
115
  | `update` | (no subcommand) | [update.md](update.md) |
116
116
  | `skill` | `install`, `status`, `uninstall` | [update.md](update.md) |
117
117
 
@@ -130,7 +130,7 @@ Command **details** are in sibling `<group>.md` files in this directory.
130
130
  - `track get` 命令无需认证即可使用。
131
131
  - 其余大部分命令需要先配置 API Key:`fmc auth login --api-key <key>`。Key 是控制台生成的原串(常见前缀 `SK_` 或 `sk-`),原样传入,不要校验或改写。
132
132
  - 新增的 `problem`、`service`、`finance`、`pickup`、`notice`、`customs`、`platform`、`onboarding` 模块均需要 API Key 认证。`order` 模块下的 `address-book`、`country` 子命令也需要认证。
133
- - **写操作**(`platform sync`、`platform order push`、`onboarding auth *`、`onboarding brand open`)默认在终端二次确认;非交互环境(管道、CI、AI Agent)必须显式加 `-y`,否则命令会拒绝执行并以退出码 1 结束。先用 `--dry-run` 可查看将发送的请求。
133
+ - **写操作**(`platform sync`、`platform order push`、`onboarding auth *`、`onboarding brand open`、`onboarding notify-saler`)默认在终端二次确认;非交互环境(管道、CI、AI Agent)必须显式加 `-y`,否则命令会拒绝执行并以退出码 1 结束。先用 `--dry-run` 可查看将发送的请求。
134
134
  - 实名认证会提交身份证号、银行卡号、验证码、手机号等敏感信息。这些参数在 `--verbose` / `--dry-run` 的**打印**里被遮蔽为 `****`,但真实值仍会随请求发送。
135
135
  - 配置文件位于 `~/.bportal/config.json`;升级状态缓存位于 `~/.bportal/update-state.json`。
136
136
  - 当检测到新版本可用时,stderr 会输出 `{"_notice":{"type":"update",...}}`;设置环境变量 `BPORTAL_NO_UPDATE_NOTIFIER=1` 可关闭。