@optima-chat/browser-cli 0.19.0 → 0.21.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.
Files changed (2) hide show
  1. package/dist/index.js +24 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1421,9 +1421,9 @@ function registerFeikuaCommands(program2) {
1421
1421
  // src/commands/files.ts
1422
1422
  function formatVideoList(videos) {
1423
1423
  if (videos.length === 0) {
1424
- return `No videos found. Put your videos in:
1425
- macOS/Linux: ~/Downloads/OptimaConnect/videos
1426
- Windows: C:\\Users\\<\u7528\u6237\u540D>\\Downloads\\OptimaConnect\\videos
1424
+ return `No videos found. Videos are listed from your OptimaConnect folder:
1425
+ macOS/Linux: ~/Downloads/OptimaConnect/<\u5E73\u53F0>/<\u8D27\u54C1>/videos/ (older files: ~/Downloads/OptimaConnect/videos)
1426
+ Windows: C:\\Users\\<\u7528\u6237\u540D>\\Downloads\\OptimaConnect\\<\u5E73\u53F0>\\<\u8D27\u54C1>\\videos\\ (older files: ...\\OptimaConnect\\videos)
1427
1427
  Then try again.`;
1428
1428
  }
1429
1429
  return videos.map((v) => {
@@ -1432,17 +1432,36 @@ Then try again.`;
1432
1432
  return `${v.name} \u2014 ${mb} MB, ${time}`;
1433
1433
  }).join("\n");
1434
1434
  }
1435
+ function mediaRefLine(result) {
1436
+ if (!result.media_ref) return null;
1437
+ return `\u4E0A\u4F20\u53C2\u6570\u586B\u4E0B\u4E00\u884C\u5F15\u53F7\u91CC\u7684\u5B8C\u6574\u503C(\u53EF\u80FD\u542B\u7A7A\u683C,\u522B\u81EA\u5DF1\u62FC\u6216\u8865\u6269\u5C55\u540D):
1438
+ media_ref=${JSON.stringify(result.media_ref)}`;
1439
+ }
1440
+ function collisionWarning(dest, localPath) {
1441
+ const wanted = dest.split(/[\\/]/).pop();
1442
+ const landed = localPath.split(/[\\/]/).pop();
1443
+ if (wanted === landed) return null;
1444
+ return `\u6CE8\u610F:\u672C\u673A\u5DF2\u6709\u540C\u540D\u6587\u4EF6 ${wanted}(\u65E7\u6587\u4EF6,\u4E0D\u662F\u8FD9\u6B21\u9001\u7684),\u8FD9\u6B21\u843D\u4E3A ${landed}\u3002\u5F15\u7528\u8FD9\u6B21\u7684\u6587\u4EF6\u522B\u7528 ${wanted}\u3002`;
1445
+ }
1435
1446
  function registerFileCommands(program2) {
1436
- program2.command("send-file").description("Send a file from your workspace to your local download folder").requiredOption("--src <path>", "Source path in your workspace (e.g. ~/output/report.pdf)").requiredOption("--dest <path>", "Destination path relative to the download folder").action(async (opts) => {
1447
+ program2.command("send-file").description("Send a file from your workspace to your local download folder").requiredOption("--src <path>", "Source path in your workspace (e.g. ~/output/report.pdf)").requiredOption("--dest <path>", "Destination path relative to the download folder").option("--json", "Print {local_path, media_ref} as JSON \u2014 read media_ref from here instead of parsing text").action(async (opts) => {
1437
1448
  try {
1438
1449
  const result = await api.sendFile(opts.src, opts.dest);
1450
+ const warning = collisionWarning(opts.dest, result.local_path);
1451
+ if (warning) console.error(warning);
1452
+ if (opts.json) {
1453
+ console.log(JSON.stringify(result));
1454
+ return;
1455
+ }
1439
1456
  console.log(result.local_path);
1457
+ const hint = mediaRefLine(result);
1458
+ if (hint) console.error(hint);
1440
1459
  } catch (err) {
1441
1460
  console.error(formatError(err));
1442
1461
  process.exit(1);
1443
1462
  }
1444
1463
  });
1445
- program2.command("list-videos").description("List videos in your local video folder (requires Desktop app online)").action(async () => {
1464
+ program2.command("list-videos").description("List videos in your local OptimaConnect folder (requires Desktop app online)").action(async () => {
1446
1465
  try {
1447
1466
  const { videos } = await api.listVideos();
1448
1467
  console.log(formatVideoList(videos));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/browser-cli",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {