cbs-4px-merchant-cli 0.0.1 → 0.0.3

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 (70) hide show
  1. package/dist/cli.js +536 -42
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/address.d.ts +2 -0
  4. package/dist/commands/address.js +59 -0
  5. package/dist/commands/address.js.map +1 -0
  6. package/dist/commands/claim.js +8 -2
  7. package/dist/commands/claim.js.map +1 -1
  8. package/dist/commands/config.js +333 -0
  9. package/dist/commands/config.js.map +1 -1
  10. package/dist/commands/country.d.ts +5 -0
  11. package/dist/commands/country.js +50 -0
  12. package/dist/commands/country.js.map +1 -0
  13. package/dist/commands/customs.d.ts +23 -0
  14. package/dist/commands/customs.js +176 -0
  15. package/dist/commands/customs.js.map +1 -0
  16. package/dist/commands/finance.d.ts +62 -0
  17. package/dist/commands/finance.js +509 -0
  18. package/dist/commands/finance.js.map +1 -0
  19. package/dist/commands/label.js +7 -1
  20. package/dist/commands/label.js.map +1 -1
  21. package/dist/commands/notice.d.ts +18 -0
  22. package/dist/commands/notice.js +210 -0
  23. package/dist/commands/notice.js.map +1 -0
  24. package/dist/commands/order.d.ts +12 -0
  25. package/dist/commands/order.js +76 -1
  26. package/dist/commands/order.js.map +1 -1
  27. package/dist/commands/pickup.d.ts +21 -0
  28. package/dist/commands/pickup.js +249 -0
  29. package/dist/commands/pickup.js.map +1 -0
  30. package/dist/commands/problem.d.ts +41 -0
  31. package/dist/commands/problem.js +371 -0
  32. package/dist/commands/problem.js.map +1 -0
  33. package/dist/commands/product.d.ts +28 -0
  34. package/dist/commands/product.js +249 -1
  35. package/dist/commands/product.js.map +1 -1
  36. package/dist/commands/service.d.ts +41 -0
  37. package/dist/commands/service.js +395 -0
  38. package/dist/commands/service.js.map +1 -0
  39. package/dist/commands/skill.d.ts +15 -0
  40. package/dist/commands/skill.js +374 -0
  41. package/dist/commands/skill.js.map +1 -0
  42. package/dist/commands/track.d.ts +13 -0
  43. package/dist/commands/track.js +92 -1
  44. package/dist/commands/track.js.map +1 -1
  45. package/dist/commands/update.d.ts +1 -1
  46. package/dist/commands/update.js +72 -9
  47. package/dist/commands/update.js.map +1 -1
  48. package/dist/services/api-client.d.ts +49 -2
  49. package/dist/services/api-client.js +464 -6
  50. package/dist/services/api-client.js.map +1 -1
  51. package/dist/services/skill-installer.d.ts +174 -0
  52. package/dist/services/skill-installer.js +540 -0
  53. package/dist/services/skill-installer.js.map +1 -0
  54. package/dist/types/index.d.ts +609 -0
  55. package/package.json +8 -6
  56. package/scripts/postinstall.js +31 -161
  57. package/skill/SKILL.md +72 -14
  58. package/skill/package.json +25 -0
  59. package/skill/reference/customs.md +220 -0
  60. package/skill/reference/finance.md +337 -0
  61. package/skill/reference/index.md +62 -6
  62. package/skill/reference/notice.md +238 -0
  63. package/skill/reference/order.md +172 -0
  64. package/skill/reference/pickup.md +222 -0
  65. package/skill/reference/problem.md +318 -0
  66. package/skill/reference/product.md +203 -0
  67. package/skill/reference/service.md +406 -0
  68. package/skill/reference/track.md +105 -0
  69. package/skill/reference/update.md +99 -14
  70. package/skill/reference/claim.md +0 -66
package/dist/cli.js CHANGED
@@ -1,28 +1,28 @@
1
1
  import { Command } from 'commander';
2
2
  import chalk from 'chalk';
3
3
  import { createRequire } from 'module';
4
- import { existsSync, readFileSync } from 'fs';
5
- import { join } from 'path';
6
- import { homedir } from 'os';
7
4
  import { authLogin, authStatus } from './commands/auth.js';
8
5
  import { configSet, configList, configExportSchema } from './commands/config.js';
9
- import { trackCommand } from './commands/track.js';
6
+ import { trackCommand, trackSubscriptionOrderCommand, trackSubscriptionProductCommand } from './commands/track.js';
10
7
  import { labelCommand } from './commands/label.js';
11
- import { orderCommand } from './commands/order.js';
12
- import { productCommand } from './commands/product.js';
13
- import { claimCommand } from './commands/claim.js';
8
+ import { orderCommand, orderListCommand } from './commands/order.js';
9
+ import { productCommand, productListCommand, productDetailCommand, productDeliveryTimeCommand, productSearchCommand } from './commands/product.js';
10
+ import { claimCommand } from './commands/claim.js'; // re-homed under `service`
11
+ import { problemListCommand, problemSuggestCommand, problemNotifyCommand, problemLastmileCommand, problemArrearCommand, problemInterceptedCommand, problemNotifyTypeCommand } from './commands/problem.js';
12
+ import { serviceRepairCommand, serviceCheckCommand, serviceComplaintCommand, serviceDetailCommand, serviceRecordCommand, serviceClaimDetailCommand, serviceClaimReasonCommand } from './commands/service.js';
13
+ import { financeBalanceCommand, financeBillCommand, financeDailyFeeCommand, financeUnbilledDetailCommand, financeUnbilledCommand, financeRechargeCommand, financeRechargeOfflineCommand, financeFeeDetailCommand, financeFrozenCommand } from './commands/finance.js';
14
+ import { addressListCommand } from './commands/address.js';
15
+ import { countrySearchCommand } from './commands/country.js';
16
+ import { pickupMaterialCommand, pickupMaterialDetailCommand, pickupMaterialQuotaCommand, pickupAddressCommand } from './commands/pickup.js';
17
+ import { noticeListCommand, noticeDetailCommand, messageListCommand, messageDetailCommand, unreadCountCommand } from './commands/notice.js';
14
18
  import { buildUpdateCommand } from './commands/update.js';
19
+ import { buildSkillCommand } from './commands/skill.js';
20
+ import { customsCargoListCommand, customsCommodityListCommand, customsCommodityDetailCommand, customsHsCodeCommand, customsRegistrationInfoCommand } from './commands/customs.js';
15
21
  import { checkCachedSync, refreshCache } from './services/update-checker.js';
22
+ import { listSkillDirs, readInstalledVersion } from './services/skill-installer.js';
16
23
  import { PACKAGE_NAME, BIN_NAME } from './generated/site.js';
17
24
  const require = createRequire(import.meta.url);
18
25
  const { version: VERSION } = require('../package.json');
19
- /** Skill install dir name derived from package name (e.g. cbs-4px-merchant-cli). */
20
- const SKILL_DIR_NAME = PACKAGE_NAME.replace(/^@[^/]+\//, '');
21
- /** AI tool directories where skills may be installed. */
22
- const SKILL_TARGET_DIRS = [
23
- '.qoder', '.claude', '.cline', '.qwen', '.cursor',
24
- '.qoderwork', '.codex', '.kilo', '.openclaw',
25
- ];
26
26
  /**
27
27
  * Emit a structured _notice.update banner to stderr when the local cache
28
28
  * indicates a newer CLI version is available. Zero network I/O — relies on
@@ -51,37 +51,56 @@ function checkUpdateAvailable() {
51
51
  process.stderr.write(JSON.stringify(notice) + '\n');
52
52
  }
53
53
  /**
54
- * Check if installed skill version matches current CLI version.
54
+ * Check whether the installed skill version matches the current CLI version.
55
55
  * Outputs structured _notice.skills to stderr when drift is detected.
56
56
  * Never blocks execution — purely informational for AI Agents.
57
+ *
58
+ * Every candidate dir is scanned, not just the first one that answers: with an
59
+ * early break the result depended on array order, so a stale .claude install
60
+ * could be masked by an up-to-date .qoder one.
57
61
  */
58
62
  function checkSkillDrift() {
59
- const home = homedir();
60
- let installedVersion = null;
61
- for (const dir of SKILL_TARGET_DIRS) {
62
- const versionFile = join(home, dir, 'skills', SKILL_DIR_NAME, '.skill-version');
63
- if (existsSync(versionFile)) {
64
- try {
65
- installedVersion = readFileSync(versionFile, 'utf-8').trim();
66
- break;
67
- }
68
- catch { /* ignore unreadable files */ }
69
- }
63
+ let installedVersions;
64
+ try {
65
+ installedVersions = listSkillDirs()
66
+ .map((dir) => readInstalledVersion(dir))
67
+ .filter((v) => v !== null);
68
+ }
69
+ catch {
70
+ // Never let a broken skill probe take a business command down with it.
71
+ return;
70
72
  }
71
73
  // Cold start: skill never installed — not an error
72
- if (installedVersion === null)
74
+ if (installedVersions.length === 0)
73
75
  return;
74
- if (installedVersion !== VERSION) {
75
- const notice = {
76
- _notice: {
77
- type: 'skills',
78
- current: installedVersion,
79
- expected: VERSION,
80
- hint: `Run: ${BIN_NAME} skill install to sync skills with CLI v${VERSION}`,
81
- },
82
- };
83
- process.stderr.write(JSON.stringify(notice) + '\n');
76
+ const drifted = [...new Set(installedVersions.filter((v) => v !== VERSION))];
77
+ if (drifted.length === 0)
78
+ return;
79
+ const notice = {
80
+ _notice: {
81
+ type: 'skills',
82
+ current: drifted.length === 1 ? drifted[0] : drifted,
83
+ expected: VERSION,
84
+ hint: `Run: ${BIN_NAME} skill install to sync skills with CLI v${VERSION}`,
85
+ },
86
+ };
87
+ process.stderr.write(JSON.stringify(notice) + '\n');
88
+ }
89
+ /**
90
+ * Nudge shown on bare `mc` / `mc --help` when no skill is installed anywhere.
91
+ * Distinct from checkSkillDrift, which covers "installed but wrong version";
92
+ * this one covers "the second install step was never run".
93
+ */
94
+ function skillMissingHint() {
95
+ try {
96
+ const anyInstalled = listSkillDirs().some((dir) => readInstalledVersion(dir) !== null);
97
+ if (anyInstalled)
98
+ return null;
99
+ }
100
+ catch {
101
+ return null;
84
102
  }
103
+ return `未检测到已安装的 skill,执行 ${BIN_NAME} skill install 注册到本机 AI 工具`;
85
104
  }
86
105
  function printBanner() {
87
106
  const c = chalk.bold.hex('#5B9BD5');
@@ -96,7 +115,7 @@ function printBanner() {
96
115
  ` ${c('╚═════╝ ╚═════╝ ╚════╝')}`,
97
116
  ` ${d('- - - - - - - - - - - - - - - - -')}`,
98
117
  ` ${chalk.bold.white('🌏 跨境物流 · 商家 CLI')} ${chalk.dim(`v${VERSION}`)}`,
99
- ` ${chalk.gray('Cross-Border Supply Chain')}`,
118
+ ` ${chalk.gray('Cross-Border Logistics')}`,
100
119
  ` ${chalk.dim('📦 轨迹查询 · 面单获取 · 订单管理 ...')}`,
101
120
  '',
102
121
  ];
@@ -143,6 +162,10 @@ export function buildProgram() {
143
162
  const originalHelp = program.helpInformation.bind(program);
144
163
  program.helpInformation = function () {
145
164
  printBanner();
165
+ const hint = skillMissingHint();
166
+ if (hint) {
167
+ process.stderr.write(` ${chalk.yellow('⚠')} ${chalk.yellow(hint)}\n\n`);
168
+ }
146
169
  return originalHelp();
147
170
  };
148
171
  // mc auth login / mc auth status
@@ -184,6 +207,8 @@ export function buildProgram() {
184
207
  });
185
208
  program.addCommand(config);
186
209
  // mc track get <orderNo>
210
+ // mc track subscription-order --track-nos <nos>
211
+ // mc track subscription-product [--product-code] [--country-code]
187
212
  const track = new Command('track').description('物流轨迹');
188
213
  track
189
214
  .command('get <orderNo>')
@@ -191,6 +216,27 @@ export function buildProgram() {
191
216
  .action(async (orderNo, _opts, cmd) => {
192
217
  await trackCommand(orderNo, globals(cmd));
193
218
  });
219
+ const trackSub = new Command('sub').description('轨迹订阅');
220
+ trackSub
221
+ .command('order')
222
+ .description('按订单维度查询轨迹订阅列表')
223
+ .requiredOption('--track-nos <nos>', '物流单号,多个用逗号分隔')
224
+ .option('--page <num>', '页码,默认 1')
225
+ .option('--size <num>', '每页数量,默认 10,最大 100')
226
+ .action(async (opts, cmd) => {
227
+ await trackSubscriptionOrderCommand({ ...globals(cmd), ...opts });
228
+ });
229
+ trackSub
230
+ .command('product')
231
+ .description('按产品维度查询轨迹订阅列表')
232
+ .option('--product-code <code>', '产品编码')
233
+ .option('--country-code <code>', '目的国家二字码')
234
+ .option('--page <num>', '页码,默认 1')
235
+ .option('--size <num>', '每页数量,默认 10,最大 100')
236
+ .action(async (opts, cmd) => {
237
+ await trackSubscriptionProductCommand({ ...globals(cmd), ...opts });
238
+ });
239
+ track.addCommand(trackSub);
194
240
  program.addCommand(track);
195
241
  // mc label get <orderNo>
196
242
  const label = new Command('label').description('面单管理');
@@ -202,6 +248,7 @@ export function buildProgram() {
202
248
  });
203
249
  program.addCommand(label);
204
250
  // mc order get <orderNo>
251
+ // mc order list [--status] [--start-date] ...
205
252
  const order = new Command('order').description('订单管理');
206
253
  order
207
254
  .command('get <orderNo>')
@@ -209,9 +256,37 @@ export function buildProgram() {
209
256
  .action(async (orderNo, _opts, cmd) => {
210
257
  await orderCommand(orderNo, globals(cmd));
211
258
  });
259
+ order
260
+ .command('list')
261
+ .description('查询订单列表')
262
+ .option('--status <name>', '订单状态: INFO_RECEIVED/IN_TRANSIT/DELIVERED/CANCEL/DRAFT/ALL')
263
+ .option('--customer-order-no <no>', '客户订单号')
264
+ .option('--fpx-track-no <no>', '物流单号')
265
+ .option('--start-date <date>', '起始日期 (yyyy-MM-dd)')
266
+ .option('--end-date <date>', '结束日期 (yyyy-MM-dd)')
267
+ .option('--product-code <code>', '产品代码')
268
+ .option('--destination-country <code>', '目的国家二字码')
269
+ .option('--page <num>', '页码,默认 1')
270
+ .option('--size <num>', '每页数量,默认 10,最大 100')
271
+ .action(async (opts, cmd) => {
272
+ await orderListCommand({ ...globals(cmd), ...opts });
273
+ });
274
+ order
275
+ .command('address-book')
276
+ .description('查询发件地址簿(商家预存的发件/揽收/退件地址)')
277
+ .action(async (_opts, cmd) => {
278
+ await addressListCommand(globals(cmd));
279
+ });
280
+ order
281
+ .command('country <keyword>')
282
+ .description('按关键词模糊搜索目的国家')
283
+ .option('--product-code <code>', '产品编码,过滤该产品可发的国家')
284
+ .action(async (keyword, opts, cmd) => {
285
+ await countrySearchCommand(keyword, { ...globals(cmd), ...opts });
286
+ });
212
287
  program.addCommand(order);
213
- // mc product recommend --country <code> [--start-city] [--weight] ...
214
- const product = new Command('product').description('产品推荐');
288
+ // mc product recommend / list / detail / fee / delivery-time / search
289
+ const product = new Command('product').description('产品与报价');
215
290
  product
216
291
  .command('recommend')
217
292
  .description('根据条件获取推荐物流产品及报价')
@@ -224,8 +299,172 @@ export function buildProgram() {
224
299
  .action(async (opts, cmd) => {
225
300
  await productCommand({ ...globals(cmd), ...opts });
226
301
  });
302
+ product
303
+ .command('list')
304
+ .description('按目的国家查询可用物流产品列表')
305
+ .requiredOption('--country <code>', '目的国家二字码,如 US')
306
+ .option('--start-city <city>', '起运城市中文名,默认深圳')
307
+ .action(async (opts, cmd) => {
308
+ await productListCommand({ ...globals(cmd), ...opts });
309
+ });
310
+ product
311
+ .command('detail <productCode>')
312
+ .description('查询产品属性详情')
313
+ .option('--country <code>', '目的国家二字码')
314
+ .option('--weight <kg>', '重量(kg),默认 1')
315
+ .action(async (productCode, opts, cmd) => {
316
+ await productDetailCommand(productCode, { ...globals(cmd), ...opts });
317
+ });
318
+ product
319
+ .command('eta')
320
+ .description('查询预估时效')
321
+ .requiredOption('--country-code <code>', '目的国家二字码')
322
+ .requiredOption('--product-code <code>', '产品编码')
323
+ .action(async (opts, cmd) => {
324
+ await productDeliveryTimeCommand({ ...globals(cmd), ...opts });
325
+ });
326
+ product
327
+ .command('search <keyword>')
328
+ .description('按关键词模糊搜索物流产品')
329
+ .option('--country-code <code>', '目的国家二字码,过滤可用产品')
330
+ .action(async (keyword, opts, cmd) => {
331
+ await productSearchCommand(keyword, { ...globals(cmd), ...opts });
332
+ });
227
333
  program.addCommand(product);
228
- // mc claim list [--biz-no] [--start-time] [--end-time] [--status] [--page] [--size]
334
+ // mc problem list / suggest / notify / lastmile / arrear / intercepted / notify-type
335
+ const problem = new Command('problem').description('异常件管理');
336
+ problem
337
+ .command('list')
338
+ .description('查询问题件/异常单列表')
339
+ .option('--order-nos <nos>', '单号,多个用逗号分隔')
340
+ .option('--abnormal-status <status>', '异常状态')
341
+ .option('--abnormal-type <type>', '异常类型')
342
+ .option('--start-date <date>', '起始日期 (yyyy-MM-dd)')
343
+ .option('--end-date <date>', '结束日期 (yyyy-MM-dd)')
344
+ .option('--page <num>', '页码,默认 1')
345
+ .option('--size <num>', '每页数量,默认 10,最大 100')
346
+ .action(async (opts, cmd) => {
347
+ await problemListCommand({ ...globals(cmd), ...opts });
348
+ });
349
+ problem
350
+ .command('suggest')
351
+ .description('获取异常订单的 AI 处理建议')
352
+ .requiredOption('--order-nos <nos>', '单号,多个用逗号分隔')
353
+ .action(async (opts, cmd) => {
354
+ await problemSuggestCommand({ ...globals(cmd), ...opts });
355
+ });
356
+ const problemNotify = new Command('notify').description('通知件与异常类型');
357
+ problemNotify
358
+ .command('list')
359
+ .description('查询通知件列表(仓外异常通知)')
360
+ .option('--page <num>', '页码,默认 1')
361
+ .option('--size <num>', '每页数量,默认 10,最大 100')
362
+ .action(async (opts, cmd) => {
363
+ await problemNotifyCommand({ ...globals(cmd), ...opts });
364
+ });
365
+ problemNotify
366
+ .command('type')
367
+ .description('查询尾程异常类型枚举列表')
368
+ .action(async (_opts, cmd) => {
369
+ await problemNotifyTypeCommand(globals(cmd));
370
+ });
371
+ problem.addCommand(problemNotify);
372
+ const problemLastmile = new Command('lastmile').description('尾程异常');
373
+ problemLastmile
374
+ .command('list')
375
+ .description('查询尾程异常列表')
376
+ .option('--page <num>', '页码,默认 1')
377
+ .option('--size <num>', '每页数量,默认 10,最大 100')
378
+ .action(async (opts, cmd) => {
379
+ await problemLastmileCommand({ ...globals(cmd), ...opts });
380
+ });
381
+ problem.addCommand(problemLastmile);
382
+ const problemArrear = new Command('arrear').description('欠费件');
383
+ problemArrear
384
+ .command('list')
385
+ .description('查询欠费件列表')
386
+ .option('--keyword <word>', '搜索关键词(物流单号)')
387
+ .option('--page <num>', '页码,默认 1')
388
+ .option('--size <num>', '每页数量,默认 10,最大 100')
389
+ .action(async (opts, cmd) => {
390
+ await problemArrearCommand({ ...globals(cmd), ...opts });
391
+ });
392
+ problem.addCommand(problemArrear);
393
+ const problemIntercepted = new Command('intercepted').description('拦截件');
394
+ problemIntercepted
395
+ .command('list')
396
+ .description('查询已拦截的订单列表')
397
+ .option('--customer-order-no <no>', '客户订单号')
398
+ .option('--fpx-track-no <no>', '物流单号')
399
+ .option('--start-date <date>', '起始日期 (yyyy-MM-dd)')
400
+ .option('--end-date <date>', '结束日期 (yyyy-MM-dd)')
401
+ .option('--page <num>', '页码,默认 1')
402
+ .option('--size <num>', '每页数量,默认 10,最大 100')
403
+ .action(async (opts, cmd) => {
404
+ await problemInterceptedCommand({ ...globals(cmd), ...opts });
405
+ });
406
+ problem.addCommand(problemIntercepted);
407
+ program.addCommand(problem);
408
+ // mc service repair list / check list / complaint list / detail / record / claim list|detail|reason
409
+ const service = new Command('service').description('服务中心');
410
+ const serviceRepair = new Command('repair').description('售后工单');
411
+ serviceRepair
412
+ .command('list')
413
+ .description('查询售后服务单(工单)列表')
414
+ .option('--order-codes <codes>', '业务单号,多个用逗号分隔')
415
+ .option('--business-line-id <id>', '业务线ID')
416
+ .option('--category-id <id>', '反馈类型ID')
417
+ .option('--biz-status <status>', '工单状态')
418
+ .option('--start-date <date>', '起始日期 (yyyy-MM-dd)')
419
+ .option('--end-date <date>', '结束日期 (yyyy-MM-dd)')
420
+ .option('--page <num>', '页码,默认 1')
421
+ .option('--size <num>', '每页数量,默认 10,最大 100')
422
+ .action(async (opts, cmd) => {
423
+ await serviceRepairCommand({ ...globals(cmd), ...opts });
424
+ });
425
+ service.addCommand(serviceRepair);
426
+ const serviceCheck = new Command('check').description('查件');
427
+ serviceCheck
428
+ .command('list')
429
+ .description('查询查件服务单列表')
430
+ .option('--biz-no <no>', '业务单号')
431
+ .option('--service-no <no>', '服务单号')
432
+ .option('--service-status <status>', '状态:0 待受理、1 受理中、2 已退回、3 已解决')
433
+ .option('--start-date <date>', '创建起始日期 (yyyy-MM-dd)')
434
+ .option('--end-date <date>', '创建结束日期 (yyyy-MM-dd)')
435
+ .option('--page <num>', '页码,默认 1')
436
+ .option('--size <num>', '每页数量,默认 10,最大 100')
437
+ .action(async (opts, cmd) => {
438
+ await serviceCheckCommand({ ...globals(cmd), ...opts });
439
+ });
440
+ service.addCommand(serviceCheck);
441
+ const serviceComplaint = new Command('complaint').description('投诉');
442
+ serviceComplaint
443
+ .command('list')
444
+ .description('查询投诉列表')
445
+ .option('--biz-no <no>', '业务单号')
446
+ .option('--service-no <no>', '服务单号')
447
+ .option('--service-status <status>', '状态:0 待受理、1 受理中、2 已退回、3 已解决')
448
+ .option('--start-date <date>', '创建起始日期 (yyyy-MM-dd)')
449
+ .option('--end-date <date>', '创建结束日期 (yyyy-MM-dd)')
450
+ .option('--page <num>', '页码,默认 1')
451
+ .option('--size <num>', '每页数量,默认 10,最大 100')
452
+ .action(async (opts, cmd) => {
453
+ await serviceComplaintCommand({ ...globals(cmd), ...opts });
454
+ });
455
+ service.addCommand(serviceComplaint);
456
+ service
457
+ .command('detail <serviceNo>')
458
+ .description('查询查件/咨询服务单详情')
459
+ .action(async (serviceNo, _opts, cmd) => {
460
+ await serviceDetailCommand(serviceNo, globals(cmd));
461
+ });
462
+ service
463
+ .command('record <serviceNo>')
464
+ .description('查询服务单处理记录')
465
+ .action(async (serviceNo, _opts, cmd) => {
466
+ await serviceRecordCommand(serviceNo, globals(cmd));
467
+ });
229
468
  const claim = new Command('claim').description('理赔管理');
230
469
  claim
231
470
  .command('list')
@@ -239,9 +478,264 @@ export function buildProgram() {
239
478
  .action(async (opts, cmd) => {
240
479
  await claimCommand({ ...globals(cmd), ...opts });
241
480
  });
242
- program.addCommand(claim);
481
+ claim
482
+ .command('detail <claimNo>')
483
+ .description('查询直发理赔详情')
484
+ .action(async (claimNo, _opts, cmd) => {
485
+ await serviceClaimDetailCommand(claimNo, globals(cmd));
486
+ });
487
+ claim
488
+ .command('reason')
489
+ .description('查询理赔原因列表')
490
+ .requiredOption('--level <num>', '理赔原因级别:1 一级、2 二级')
491
+ .requiredOption('--dict-type <type>', '字典类型:fb4ClaimType(仓发)或 dssClaimType(直发)')
492
+ .option('--dict-code <code>', '上级字典code(查二级时必填)')
493
+ .action(async (opts, cmd) => {
494
+ await serviceClaimReasonCommand({ ...globals(cmd), ...opts });
495
+ });
496
+ service.addCommand(claim);
497
+ program.addCommand(service);
498
+ // mc finance balance / bill list / daily-fee list / unbilled list / recharge list / fee detail / frozen list
499
+ const finance = new Command('finance').description('财务管理');
500
+ finance
501
+ .command('balance')
502
+ .description('查询账户余额')
503
+ .option('--business-system <system>', '品牌(业务系统),默认 DSS')
504
+ .action(async (opts, cmd) => {
505
+ await financeBalanceCommand({ ...globals(cmd), ...opts });
506
+ });
507
+ const financeBill = new Command('bill').description('账单');
508
+ financeBill
509
+ .command('list')
510
+ .description('查询已出账单列表')
511
+ .option('--business-system <system>', '品牌(业务系统),默认 GRS')
512
+ .option('--bill-no <no>', '账单编号')
513
+ .option('--bill-month <month>', '账单月份 (yyyy-MM)')
514
+ .option('--page <num>', '页码,默认 1')
515
+ .option('--size <num>', '每页数量,默认 10,最大 100')
516
+ .action(async (opts, cmd) => {
517
+ await financeBillCommand({ ...globals(cmd), ...opts });
518
+ });
519
+ finance.addCommand(financeBill);
520
+ const financeDailyFee = new Command('daily-fee').description('每日费用');
521
+ financeDailyFee
522
+ .command('list')
523
+ .description('查询每日充值/消费费用列表')
524
+ .option('--business-system <system>', '品牌(业务系统),默认 GRS')
525
+ .option('--currency-code <code>', '币种编码')
526
+ .option('--start-date <date>', '起始日期 (yyyy-MM-dd)')
527
+ .option('--end-date <date>', '结束日期 (yyyy-MM-dd)')
528
+ .option('--page <num>', '页码,默认 1')
529
+ .option('--size <num>', '每页数量,默认 10,最大 100')
530
+ .action(async (opts, cmd) => {
531
+ await financeDailyFeeCommand({ ...globals(cmd), ...opts });
532
+ });
533
+ finance.addCommand(financeDailyFee);
534
+ const financeUnbilled = new Command('unbilled').description('未出账单');
535
+ financeUnbilled
536
+ .command('list')
537
+ .description('查询未出账单(传 --business-no 查明细,不传查列表)')
538
+ .option('--business-no <no>', '业务单号(传入则查该单计费明细)')
539
+ .option('--currency-code <code>', '币种编码(查明细时必填)')
540
+ .option('--business-system <system>', '品牌(业务系统),默认 GRS')
541
+ .option('--bill-no <no>', '账单编号(查列表时筛选)')
542
+ .option('--page <num>', '页码,默认 1')
543
+ .option('--size <num>', '每页数量,默认 10,最大 100')
544
+ .action(async (opts, cmd) => {
545
+ const allOpts = { ...globals(cmd), ...opts };
546
+ if (allOpts.businessNo) {
547
+ await financeUnbilledDetailCommand(allOpts);
548
+ }
549
+ else {
550
+ await financeUnbilledCommand(allOpts);
551
+ }
552
+ });
553
+ finance.addCommand(financeUnbilled);
554
+ const financeRecharge = new Command('recharge').description('充值记录');
555
+ financeRecharge
556
+ .command('list')
557
+ .description('查询充值记录(加 --offline 查线下水单)')
558
+ .option('--offline', '查询线下充值记录(水单)')
559
+ .option('--business-system <system>', '品牌(业务系统),默认 DSS')
560
+ .option('--start-date <date>', '起始日期 (yyyy-MM-dd)')
561
+ .option('--end-date <date>', '结束日期 (yyyy-MM-dd)')
562
+ .option('--currency <code>', '币种(仅线下)')
563
+ .option('--trade-no <no>', '付款凭证号(仅线下)')
564
+ .option('--status <code>', '水单状态(仅线下)')
565
+ .option('--page <num>', '页码,默认 1')
566
+ .option('--size <num>', '每页数量,默认 10,最大 100')
567
+ .action(async (opts, cmd) => {
568
+ const allOpts = { ...globals(cmd), ...opts };
569
+ if (allOpts.offline) {
570
+ await financeRechargeOfflineCommand(allOpts);
571
+ }
572
+ else {
573
+ await financeRechargeCommand(allOpts);
574
+ }
575
+ });
576
+ finance.addCommand(financeRecharge);
577
+ const fee = new Command('fee').description('费用');
578
+ fee
579
+ .command('detail <businessNo>')
580
+ .description('查询计费明细')
581
+ .action(async (businessNo, _opts, cmd) => {
582
+ await financeFeeDetailCommand(businessNo, globals(cmd));
583
+ });
584
+ finance.addCommand(fee);
585
+ const financeFrozen = new Command('frozen').description('冻结流水');
586
+ financeFrozen
587
+ .command('list')
588
+ .description('查询冻结流水')
589
+ .option('--brand <brand>', '品牌(业务系统)')
590
+ .option('--currency <code>', '币种编码')
591
+ .option('--business-no <no>', '业务单号')
592
+ .option('--page <num>', '页码,默认 1')
593
+ .option('--size <num>', '每页数量,默认 10,最大 100')
594
+ .action(async (opts, cmd) => {
595
+ await financeFrozenCommand({ ...globals(cmd), ...opts });
596
+ });
597
+ finance.addCommand(financeFrozen);
598
+ program.addCommand(finance);
599
+ // mc pickup material list|detail|quota / pickup address list
600
+ const pickup = new Command('pickup').description('揽收管理');
601
+ const material = new Command('material').description('物料申请');
602
+ material
603
+ .command('list')
604
+ .description('查询物料申请单列表')
605
+ .option('--order-nos <nos>', '申请单号,多个用逗号分隔')
606
+ .option('--status <codes>', '申请单状态,多个用逗号分隔')
607
+ .option('--material-type <type>', '物料类型')
608
+ .option('--page <num>', '页码,默认 1')
609
+ .option('--size <num>', '每页数量,默认 10,最大 100')
610
+ .action(async (opts, cmd) => {
611
+ await pickupMaterialCommand({ ...globals(cmd), ...opts });
612
+ });
613
+ material
614
+ .command('detail <orderNo>')
615
+ .description('查询物料申请单详情')
616
+ .action(async (orderNo, _opts, cmd) => {
617
+ await pickupMaterialDetailCommand(orderNo, globals(cmd));
618
+ });
619
+ material
620
+ .command('quota')
621
+ .description('查询本月物料申请额度')
622
+ .requiredOption('--bundle <num>', '本次拟申请捆数')
623
+ .option('--apply-type <type>', '申请类型')
624
+ .action(async (opts, cmd) => {
625
+ await pickupMaterialQuotaCommand({ ...globals(cmd), ...opts });
626
+ });
627
+ pickup.addCommand(material);
628
+ const address = new Command('address').description('揽收地址');
629
+ address
630
+ .command('list')
631
+ .description('查询揽收地址列表')
632
+ .option('--keyword <word>', '搜索关键词(联系人/电话/地址)')
633
+ .option('--page <num>', '页码,默认 1')
634
+ .option('--size <num>', '每页数量,默认 10,最大 100')
635
+ .action(async (opts, cmd) => {
636
+ await pickupAddressCommand({ ...globals(cmd), ...opts });
637
+ });
638
+ pickup.addCommand(address);
639
+ program.addCommand(pickup);
640
+ // mc notice list / detail / message-list / message-detail / unread
641
+ const notice = new Command('notice').description('系统公告与站内消息');
642
+ notice
643
+ .command('list')
644
+ .description('查询系统公告列表')
645
+ .option('--category <category>', '公告分类')
646
+ .option('--page <num>', '页码,默认 1')
647
+ .option('--size <num>', '每页数量,默认 10,最大 100')
648
+ .action(async (opts, cmd) => {
649
+ await noticeListCommand({ ...globals(cmd), ...opts });
650
+ });
651
+ notice
652
+ .command('detail <code>')
653
+ .description('查询公告详情')
654
+ .action(async (code, _opts, cmd) => {
655
+ await noticeDetailCommand(code, globals(cmd));
656
+ });
657
+ const message = new Command('message').description('站内消息');
658
+ message
659
+ .command('list')
660
+ .description('查询站内消息列表')
661
+ .option('--biz-code <code>', '业务编码')
662
+ .option('--read <bool>', '是否已读:true / false')
663
+ .option('--keyword <word>', '搜索关键词')
664
+ .option('--page <num>', '页码,默认 1')
665
+ .option('--size <num>', '每页数量,默认 10,最大 100')
666
+ .action(async (opts, cmd) => {
667
+ await messageListCommand({ ...globals(cmd), ...opts });
668
+ });
669
+ message
670
+ .command('detail <recordId>')
671
+ .description('查询站内消息详情')
672
+ .action(async (recordId, _opts, cmd) => {
673
+ await messageDetailCommand(recordId, globals(cmd));
674
+ });
675
+ message
676
+ .command('unread')
677
+ .description('查询未读消息数量')
678
+ .action(async (_opts, cmd) => {
679
+ await unreadCountCommand(globals(cmd));
680
+ });
681
+ notice.addCommand(message);
682
+ program.addCommand(notice);
683
+ // mc customs cargo list / commodity list|detail / hs search / declare info
684
+ const customs = new Command('customs').description('海关申报');
685
+ const cargo = new Command('cargo').description('申报品');
686
+ cargo
687
+ .command('list')
688
+ .description('查询申报品列表')
689
+ .option('--keyword <word>', '搜索关键词')
690
+ .option('--page <num>', '页码,默认 1')
691
+ .option('--size <num>', '每页数量,默认 10,最大 100')
692
+ .action(async (opts, cmd) => {
693
+ await customsCargoListCommand({ ...globals(cmd), ...opts });
694
+ });
695
+ customs.addCommand(cargo);
696
+ const commodity = new Command('commodity').description('商品备案');
697
+ commodity
698
+ .command('list')
699
+ .description('查询商品备案列表')
700
+ .option('--en-name <name>', '英文品名')
701
+ .option('--cn-name <name>', '中文品名')
702
+ .option('--page <num>', '页码,默认 1')
703
+ .option('--size <num>', '每页数量,默认 10,最大 100')
704
+ .action(async (opts, cmd) => {
705
+ await customsCommodityListCommand({ ...globals(cmd), ...opts });
706
+ });
707
+ commodity
708
+ .command('detail <commodityId>')
709
+ .description('查询商品备案详情')
710
+ .action(async (commodityId, _opts, cmd) => {
711
+ await customsCommodityDetailCommand(commodityId, globals(cmd));
712
+ });
713
+ customs.addCommand(commodity);
714
+ const hscode = new Command('hscode').description('海关编码');
715
+ hscode
716
+ .command('search')
717
+ .description('查询海关编码')
718
+ .option('--code <code>', '海关编码')
719
+ .option('--name <name>', '品名关键词')
720
+ .option('--page <num>', '页码,默认 1')
721
+ .option('--size <num>', '每页数量,默认 10,最大 100')
722
+ .action(async (opts, cmd) => {
723
+ await customsHsCodeCommand({ ...globals(cmd), ...opts });
724
+ });
725
+ customs.addCommand(hscode);
726
+ const registration = new Command('registration').description('客户备案');
727
+ registration
728
+ .command('info')
729
+ .description('查询客户海关备案信息')
730
+ .action(async (_opts, cmd) => {
731
+ await customsRegistrationInfoCommand(globals(cmd));
732
+ });
733
+ customs.addCommand(registration);
734
+ program.addCommand(customs);
243
735
  // mc update [--check] [--tag] [--force] [-y] [--output json]
244
736
  program.addCommand(buildUpdateCommand());
737
+ // mc skill install | status | uninstall (roadmap ext-1)
738
+ program.addCommand(buildSkillCommand());
245
739
  return program;
246
740
  }
247
741
  //# sourceMappingURL=cli.js.map