@cargo-ai/cli 1.0.138 → 1.0.140

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.
@@ -1 +1 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/commands/content/file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CAwQ7E"}
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/commands/content/file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAIxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CA0Q7E"}
@@ -1,5 +1,6 @@
1
1
  import { readFile, writeFile } from "node:fs/promises";
2
- import { basename, extname } from "node:path";
2
+ import { basename } from "node:path";
3
+ import { guessContentType } from "../../utils/contentType.js";
3
4
  import { handleApiCall, outputJson } from "../runHandler.js";
4
5
  export function registerFileCommands(parent, getApi) {
5
6
  const file = parent.command("file").description("Storage file operations");
@@ -52,7 +53,9 @@ export function registerFileCommands(parent, getApi) {
52
53
  .action(async (opts) => {
53
54
  const buffer = await readFile(opts.file);
54
55
  const name = basename(opts.file);
55
- const fileObj = new File([buffer], name);
56
+ const fileObj = new File([buffer], name, {
57
+ type: guessContentType(opts.file),
58
+ });
56
59
  const api = getApi();
57
60
  await handleApiCall(() => new Promise((resolve, reject) => {
58
61
  api.content.file.upload({
@@ -68,9 +71,9 @@ export function registerFileCommands(parent, getApi) {
68
71
  outputJson(result);
69
72
  resolve();
70
73
  },
71
- onError: () => {
74
+ onError: (error) => {
72
75
  process.stderr.write("\n");
73
- reject(new Error("Upload failed"));
76
+ reject(error);
74
77
  },
75
78
  });
76
79
  }));
@@ -100,9 +103,9 @@ export function registerFileCommands(parent, getApi) {
100
103
  process.stderr.write("\n");
101
104
  resolve(result);
102
105
  },
103
- onError: () => {
106
+ onError: (error) => {
104
107
  process.stderr.write("\n");
105
- reject(new Error("Upload failed"));
108
+ reject(error);
106
109
  },
107
110
  });
108
111
  }));
@@ -207,29 +210,3 @@ const parseVisibility = (value) => {
207
210
  }
208
211
  throw new Error(`--visibility must be private or public, got ${value}`);
209
212
  };
210
- const CONTENT_TYPES_BY_EXTENSION = {
211
- ".csv": "text/csv",
212
- ".gif": "image/gif",
213
- ".html": "text/html",
214
- ".jpeg": "image/jpeg",
215
- ".jpg": "image/jpeg",
216
- ".json": "application/json",
217
- ".md": "text/markdown",
218
- ".mp3": "audio/mpeg",
219
- ".mp4": "video/mp4",
220
- ".pdf": "application/pdf",
221
- ".png": "image/png",
222
- ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
223
- ".svg": "image/svg+xml",
224
- ".txt": "text/plain",
225
- ".wav": "audio/wav",
226
- ".webm": "video/webm",
227
- ".webp": "image/webp",
228
- ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
229
- ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
230
- ".zip": "application/zip",
231
- };
232
- const guessContentType = (filePath) => {
233
- const contentType = CONTENT_TYPES_BY_EXTENSION[extname(filePath).toLowerCase()];
234
- return contentType !== undefined ? contentType : "application/octet-stream";
235
- };
@@ -1 +1 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/commands/workspaceManagement/file.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CA+C7E"}
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/commands/workspaceManagement/file.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAIxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CAiD7E"}
@@ -1,5 +1,6 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { basename } from "node:path";
3
+ import { guessContentType } from "../../utils/contentType.js";
3
4
  import { handleApiCall, outputJson } from "../runHandler.js";
4
5
  export function registerFileCommands(parent, getApi) {
5
6
  const file = parent.command("file").description("Workspace file operations");
@@ -10,7 +11,9 @@ export function registerFileCommands(parent, getApi) {
10
11
  .action(async (opts) => {
11
12
  const buffer = await readFile(opts.file);
12
13
  const name = basename(opts.file);
13
- const fileObj = new File([buffer], name);
14
+ const fileObj = new File([buffer], name, {
15
+ type: guessContentType(opts.file),
16
+ });
14
17
  const api = getApi();
15
18
  await handleApiCall(() => new Promise((resolve, reject) => {
16
19
  api.workspaceManagement.file.upload({
@@ -23,9 +26,9 @@ export function registerFileCommands(parent, getApi) {
23
26
  outputJson(result);
24
27
  resolve();
25
28
  },
26
- onError: () => {
29
+ onError: (error) => {
27
30
  process.stderr.write("\n");
28
- reject(new Error("Upload failed"));
31
+ reject(error);
29
32
  },
30
33
  });
31
34
  }));
@@ -0,0 +1,2 @@
1
+ export declare const guessContentType: (filePath: string) => string;
2
+ //# sourceMappingURL=contentType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentType.d.ts","sourceRoot":"","sources":["../../src/utils/contentType.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,gBAAgB,aAAc,MAAM,KAAG,MAKnD,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { extname } from "node:path";
2
+ // Uploads carry this as their type: without it the API stores the file as
3
+ // application/octet-stream under a `.bin` key, and an image shows up as a
4
+ // document.
5
+ const CONTENT_TYPES_BY_EXTENSION = {
6
+ ".csv": "text/csv",
7
+ ".gif": "image/gif",
8
+ ".html": "text/html",
9
+ ".jpeg": "image/jpeg",
10
+ ".jpg": "image/jpeg",
11
+ ".json": "application/json",
12
+ ".md": "text/markdown",
13
+ ".mov": "video/quicktime",
14
+ ".mp3": "audio/mpeg",
15
+ ".mp4": "video/mp4",
16
+ ".pdf": "application/pdf",
17
+ ".png": "image/png",
18
+ ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
19
+ ".svg": "image/svg+xml",
20
+ ".txt": "text/plain",
21
+ ".wav": "audio/wav",
22
+ ".webm": "video/webm",
23
+ ".webp": "image/webp",
24
+ ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
25
+ ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
26
+ ".zip": "application/zip",
27
+ };
28
+ export const guessContentType = (filePath) => {
29
+ const contentType = CONTENT_TYPES_BY_EXTENSION[extname(filePath).toLowerCase()];
30
+ return contentType !== undefined ? contentType : "application/octet-stream";
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargo-ai/cli",
3
- "version": "1.0.138",
3
+ "version": "1.0.140",
4
4
  "mcpName": "io.github.getcargohq/cargo",
5
5
  "private": false,
6
6
  "license": "UNLICENSED",
@@ -74,9 +74,9 @@
74
74
  "dependencies": {
75
75
  "@ai-sdk/harness": "1.0.144",
76
76
  "@ai-sdk/harness-claude-code": "1.0.148",
77
- "@cargo-ai/api": "^1.0.103",
77
+ "@cargo-ai/api": "^1.0.105",
78
78
  "@cargo-ai/app-sdk": "^1.0.11",
79
- "@cargo-ai/cdk": "^1.0.127",
79
+ "@cargo-ai/cdk": "^1.0.133",
80
80
  "@cargo-ai/types": "^1.0.104",
81
81
  "@cargo-ai/utils": "^1.0.35",
82
82
  "@cargo-ai/worker-sdk": "^1.0.21",