replicas-cli 0.2.223 → 0.2.224

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.mjs +31 -14
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -8933,7 +8933,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
8933
8933
  var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
8934
8934
 
8935
8935
  // ../shared/src/cli-version.ts
8936
- var CLI_VERSION = "0.2.223";
8936
+ var CLI_VERSION = "0.2.224";
8937
8937
 
8938
8938
  // ../shared/src/engine/environment.ts
8939
8939
  var DESKTOP_NOVNC_PORT = 6080;
@@ -8991,6 +8991,29 @@ var MODEL_LABELS = {
8991
8991
  "gpt-5-codex": "GPT-5 Codex",
8992
8992
  "gpt-5": "GPT-5"
8993
8993
  };
8994
+ var CANVAS_KIND_BY_EXTENSION = {
8995
+ ".md": { kind: "markdown", mimeType: "text/markdown; charset=utf-8" },
8996
+ ".markdown": { kind: "markdown", mimeType: "text/markdown; charset=utf-8" },
8997
+ ".html": { kind: "html", mimeType: "text/html; charset=utf-8" },
8998
+ ".htm": { kind: "html", mimeType: "text/html; charset=utf-8" },
8999
+ ".png": { kind: "image", mimeType: "image/png" },
9000
+ ".jpg": { kind: "image", mimeType: "image/jpeg" },
9001
+ ".jpeg": { kind: "image", mimeType: "image/jpeg" },
9002
+ ".gif": { kind: "image", mimeType: "image/gif" },
9003
+ ".webp": { kind: "image", mimeType: "image/webp" },
9004
+ ".svg": { kind: "image", mimeType: "image/svg+xml" },
9005
+ ".mp4": { kind: "video", mimeType: "video/mp4" },
9006
+ ".webm": { kind: "video", mimeType: "video/webm" },
9007
+ ".mov": { kind: "video", mimeType: "video/quicktime" },
9008
+ ".mp3": { kind: "audio", mimeType: "audio/mpeg" },
9009
+ ".wav": { kind: "audio", mimeType: "audio/wav" },
9010
+ ".ogg": { kind: "audio", mimeType: "audio/ogg" }
9011
+ };
9012
+ function classifyCanvasFilename(filename) {
9013
+ const idx = filename.lastIndexOf(".");
9014
+ const ext = idx === -1 ? "" : filename.slice(idx).toLowerCase();
9015
+ return CANVAS_KIND_BY_EXTENSION[ext] ?? { kind: "other", mimeType: "application/octet-stream" };
9016
+ }
8994
9017
 
8995
9018
  // ../shared/src/engine/v1.ts
8996
9019
  var MERGED_MESSAGE_SEPARATOR = "\n\n<!-- replicas:merged -->\n\n";
@@ -13000,17 +13023,11 @@ async function previewRemoveCommand(workspaceId, options) {
13000
13023
  import fs4 from "fs";
13001
13024
  import path5 from "path";
13002
13025
  var MONOLITH_URL4 = process.env.MONOLITH_URL || process.env.REPLICAS_MONOLITH_URL || "https://api.tryreplicas.com";
13003
- var EXT_INFO = {
13004
- png: { kind: MEDIA_KIND.IMAGE, contentType: "image/png" },
13005
- jpg: { kind: MEDIA_KIND.IMAGE, contentType: "image/jpeg" },
13006
- jpeg: { kind: MEDIA_KIND.IMAGE, contentType: "image/jpeg" },
13007
- webp: { kind: MEDIA_KIND.IMAGE, contentType: "image/webp" },
13008
- svg: { kind: MEDIA_KIND.IMAGE, contentType: "image/svg+xml" },
13009
- mp4: { kind: MEDIA_KIND.VIDEO, contentType: "video/mp4" },
13010
- webm: { kind: MEDIA_KIND.VIDEO, contentType: "video/webm" },
13011
- mp3: { kind: MEDIA_KIND.AUDIO, contentType: "audio/mpeg" },
13012
- wav: { kind: MEDIA_KIND.AUDIO, contentType: "audio/wav" }
13013
- };
13026
+ function mediaInfo(ext) {
13027
+ const { kind, mimeType } = classifyCanvasFilename(`.${ext}`);
13028
+ if (kind !== "image" && kind !== "video" && kind !== "audio") return void 0;
13029
+ return { kind, contentType: mimeType };
13030
+ }
13014
13031
  function resolveKind(ext, override) {
13015
13032
  if (override) {
13016
13033
  if (!MEDIA_KINDS.includes(override)) {
@@ -13018,7 +13035,7 @@ function resolveKind(ext, override) {
13018
13035
  }
13019
13036
  return override;
13020
13037
  }
13021
- const inferred = EXT_INFO[ext]?.kind;
13038
+ const inferred = mediaInfo(ext)?.kind;
13022
13039
  if (!inferred) {
13023
13040
  throw new Error(`Cannot infer kind from extension '.${ext}'. Pass --kind explicitly.`);
13024
13041
  }
@@ -13039,7 +13056,7 @@ async function uploadOne(filePath, options) {
13039
13056
  const fileName = path5.basename(absPath);
13040
13057
  const ext = path5.extname(absPath).slice(1).toLowerCase();
13041
13058
  const kind = resolveKind(ext, options.kind);
13042
- const contentType = EXT_INFO[ext]?.contentType ?? "application/octet-stream";
13059
+ const contentType = mediaInfo(ext)?.contentType ?? "application/octet-stream";
13043
13060
  const form = new FormData();
13044
13061
  form.append("file", new Blob([fs4.readFileSync(absPath)], { type: contentType }), fileName);
13045
13062
  form.append("kind", kind);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.223",
3
+ "version": "0.2.224",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {