@erdoai/cli 0.279.0 → 0.280.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 +3 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11676,7 +11676,7 @@ declarationsCmd.command("upsert").description("Write one declaration. The same n
|
|
|
11676
11676
|
});
|
|
11677
11677
|
var knowledgeCmd = program.command("knowledge").description("Knowledge objects");
|
|
11678
11678
|
var filesCmd = program.command("files").description("Organization files");
|
|
11679
|
-
filesCmd.command("upload [path]").description("Upload a local file or download a public URL into the selected organization").option("--url <url>", "HTTP(S) source URL (downloaded by the service)").option("--filename <name>", "filename for a URL download").option("--source-ref <ref>", "stable retry target; the same bytes and ref return the existing file").option("--source <source>", "provenance: upload, download, generated, screenshot, code_output, email, or attachment_backfill").option("--access <access>", "org or private", "org").action(async (path, opts) => {
|
|
11679
|
+
filesCmd.command("upload [path]").description("Upload a local file or download a public URL into the selected organization").option("--url <url>", "HTTP(S) source URL (downloaded by the service)").option("--filename <name>", "override the provider filename for a URL download").option("--source-ref <ref>", "stable retry target; the same bytes and ref return the existing file").option("--source <source>", "provenance: upload, download, generated, screenshot, code_output, email, or attachment_backfill").option("--access <access>", "org or private", "org").action(async (path, opts) => {
|
|
11680
11680
|
try {
|
|
11681
11681
|
if (Boolean(opts.url) === Boolean(path)) throw new Error("provide exactly one local path or --url");
|
|
11682
11682
|
if (!(opts.access === "org" || opts.access === "private")) throw new Error("--access must be org or private");
|
|
@@ -11684,16 +11684,8 @@ filesCmd.command("upload [path]").description("Upload a local file or download a
|
|
|
11684
11684
|
if (opts.url) {
|
|
11685
11685
|
const sourceURL = new URL(opts.url);
|
|
11686
11686
|
if (!["http:", "https:"].includes(sourceURL.protocol) || sourceURL.username || sourceURL.password) throw new Error("--url must be an HTTP(S) URL without credentials");
|
|
11687
|
-
|
|
11688
|
-
if (
|
|
11689
|
-
try {
|
|
11690
|
-
filename = basename2(decodeURIComponent(sourceURL.pathname));
|
|
11691
|
-
} catch {
|
|
11692
|
-
filename = basename2(sourceURL.pathname);
|
|
11693
|
-
}
|
|
11694
|
-
}
|
|
11695
|
-
if (!filename || filename === "/") throw new Error("provide --filename when the URL has no filename");
|
|
11696
|
-
input = { filename: basename2(filename), source_url: opts.url, source: opts.source ?? "download", access: opts.access };
|
|
11687
|
+
input = { source_url: opts.url, source: opts.source ?? "download", access: opts.access };
|
|
11688
|
+
if (opts.filename) input.filename = basename2(opts.filename);
|
|
11697
11689
|
} else {
|
|
11698
11690
|
if (!path) throw new Error("provide a local path or --url");
|
|
11699
11691
|
if (statSync2(path).size > 50 * 1024 * 1024) throw new Error("file exceeds the 50 MiB limit");
|