@optima-chat/browser-cli 0.9.1 → 0.10.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/dist/index.js +20 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -346,6 +346,12 @@ var BrowserAPI = class {
|
|
|
346
346
|
async getScriptTask(taskId) {
|
|
347
347
|
return request(`/api/script-tasks/${taskId}`);
|
|
348
348
|
}
|
|
349
|
+
async sendFile(src, dest) {
|
|
350
|
+
return request("/api/files/send", {
|
|
351
|
+
method: "POST",
|
|
352
|
+
body: JSON.stringify({ src, dest })
|
|
353
|
+
});
|
|
354
|
+
}
|
|
349
355
|
};
|
|
350
356
|
var api = new BrowserAPI();
|
|
351
357
|
|
|
@@ -1098,6 +1104,19 @@ function registerBitBrowserCommands(program2) {
|
|
|
1098
1104
|
});
|
|
1099
1105
|
}
|
|
1100
1106
|
|
|
1107
|
+
// src/commands/files.ts
|
|
1108
|
+
function registerFileCommands(program2) {
|
|
1109
|
+
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) => {
|
|
1110
|
+
try {
|
|
1111
|
+
const result = await api.sendFile(opts.src, opts.dest);
|
|
1112
|
+
console.log(result.local_path);
|
|
1113
|
+
} catch (err) {
|
|
1114
|
+
console.error(formatError(err));
|
|
1115
|
+
process.exit(1);
|
|
1116
|
+
}
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1101
1120
|
// src/index.ts
|
|
1102
1121
|
var require2 = createRequire(import.meta.url);
|
|
1103
1122
|
var { version } = require2("../package.json");
|
|
@@ -1118,4 +1137,5 @@ registerScriptCommands(program);
|
|
|
1118
1137
|
registerZiNiaoCommands(program);
|
|
1119
1138
|
registerRecipeCommands(program);
|
|
1120
1139
|
registerBitBrowserCommands(program);
|
|
1140
|
+
registerFileCommands(program);
|
|
1121
1141
|
program.parse();
|