replicas-cli 0.2.560 → 0.2.562

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.cjs +26 -22
  2. package/package.json +2 -1
package/dist/index.cjs CHANGED
@@ -23396,7 +23396,7 @@ If none of these apply, don't upload.
23396
23396
 
23397
23397
  \`replicas media upload\` is always the first delivery action. When the current task has an external destination, every other delivery step follows only after that command succeeds. For every file:
23398
23398
 
23399
- 1. First, run \`replicas media upload\` with the original file. Do not begin any destination upload until the command succeeds. This creates the canonical dashboard copy and prints the authenticated chat embed plus a per-file dashboard link.
23399
+ 1. First, run \`replicas media upload\` with the original file. Do not begin any destination upload until the command succeeds. This creates the canonical dashboard copy and prints a chat embed plus a per-file dashboard link. With public access, the printed Forge embed is the chat embed and is also safe to use on GitHub.
23400
23400
  2. Include the printed embed line in the Replicas chat reply, followed by the matching **View in Replicas** link. HTML uses its printed page link instead of an image embed.
23401
23401
  3. Identify every destination in the task and attempt to upload the same original bytes there. Use the destination's inline representation from the table below; do not replace the file with a Replicas link.
23402
23402
  4. Put the **View in Replicas** dashboard link next to the destination embed as a secondary link.
@@ -23436,10 +23436,11 @@ replicas media upload /tmp/before.png /tmp/after.png --name "Before fix" --name
23436
23436
 
23437
23437
  Names are normalized to hyphen-case (spaces become hyphens, e.g. \`Login page\` is stored as \`login-page\`). Give every asset a **distinct** name \u2014 duplicates are not rejected, but Replicas keeps the first as-is and adds a \`-1\`, \`-2\` suffix to later collisions, which produces confusing lists, so pick unique names yourself.
23438
23438
 
23439
- For each media file, the CLI prints two lines:
23439
+ For each media file, the CLI prints an embed line and a dashboard link:
23440
23440
 
23441
- 1. \`![filename](<api-url>)\` \u2014 the chat embed (renders inline in Replicas chat **only** \u2014 see below).
23442
- 2. \`View in Replicas: <deep-link>\` \u2014 a per-file dashboard URL of the form \`https://replicas.dev/workspaces/<workspace-id>?media=<media-id>\` that opens directly to that specific file.
23441
+ 1. Default and organization access print \`Replicas chat embed: ![filename](<api-url>)\`; this authenticated URL renders inline in Replicas chat **only** \u2014 see below.
23442
+ 2. Public access (\`--access public\` or \`--share\`) prints \`![filename](<public-url>)\` as the Forge embed instead. This is the public, stable bearer URL to paste into GitHub.
23443
+ 3. \`View in Replicas: <deep-link>\` is a per-file dashboard URL of the form \`https://replicas.dev/workspaces/<workspace-id>?media=<media-id>\` that opens directly to that specific file.
23443
23444
 
23444
23445
  Match each "View in Replicas" line to the embed line directly above it \u2014 that's the deep link for that file.
23445
23446
 
@@ -23459,7 +23460,7 @@ Use public access only when the media must render without Replicas authenticatio
23459
23460
  replicas media upload screenshot.png --name "Login page" --access public
23460
23461
  \`\`\`
23461
23462
 
23462
- \`--share\` remains an alias for \`--access public\`. Public access prints an additional \`Forge embed\` for image, video, or audio media, backed by an opt-in bearer URL. Anyone with that unguessable URL can view the asset until it is rotated or revoked. HTML pages only support organization access. Use \`replicas media share <media-id>\` to rotate a public media URL and \`replicas media revoke <media-id>\` to revoke it.
23463
+ \`--share\` remains an alias for \`--access public\`. Public access prints the raw \`Forge embed\` Markdown instead of the authenticated chat-only embed for image, video, or audio media, backed by an opt-in bearer URL. Anyone with that unguessable URL can view the asset until it is rotated or revoked. HTML pages only support organization access. Use \`replicas media share <media-id>\` to rotate a public media URL and \`replicas media revoke <media-id>\` to revoke it.
23463
23464
 
23464
23465
  ## The URLs the CLI gives you \u2014 and where each one is allowed
23465
23466
 
@@ -23467,7 +23468,7 @@ replicas media upload screenshot.png --name "Login page" --access public
23467
23468
  |---|---|---|
23468
23469
  | \`https://api.replicas.dev/v1/media/<id>\` (inside \`![\u2026](\u2026)\`) | Authenticated API redirect to a presigned blob \u2014 requires the Replicas chat session | **Only** in the Replicas chat reply. Nowhere else. |
23469
23470
  | \`https://replicas.dev/organizations/<organization-id>/media/<media-id>\` | Organization-only page printed by \`--access organization\` | Pull requests and other places where every viewer belongs to the Replicas organization. |
23470
- | \`https://api.replicas.dev/v1/media/public/<id>/<token>\` | Opt-in public bearer URL printed by \`--access public\` or \`--share\` | GitHub embeds for image, video, or audio media. |
23471
+ | \`https://api.replicas.dev/v1/media/public/<id>/<token>\` | Opt-in public bearer URL printed by \`--access public\` or \`--share\` | The Replicas chat reply and GitHub embeds, for image, video, or audio media. |
23471
23472
  | \`https://replicas.dev/workspaces/<workspace-id>?media=<media-id>\` | Authenticated dashboard deep link that opens the media file in the workspace | Everywhere external: Slack, GitHub, GitLab, Linear, PR bodies, comments, emails. |
23472
23473
 
23473
23474
  ### NEVER link the API redirect URL outside the Replicas chat reply
@@ -24430,7 +24431,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
24430
24431
  });
24431
24432
 
24432
24433
  // ../shared/src/cli-version.ts
24433
- var CLI_VERSION = "0.2.560";
24434
+ var CLI_VERSION = "0.2.562";
24434
24435
 
24435
24436
  // ../shared/src/version.ts
24436
24437
  function compareVersions(v1, v2) {
@@ -30337,6 +30338,10 @@ var MEDIA_ACCESS_VALUES = ["organization", "public"];
30337
30338
  function publicMediaUrl(mediaId, token) {
30338
30339
  return `${MONOLITH_URL}/v1/media/public/${mediaId}/${token}`;
30339
30340
  }
30341
+ function formatMediaEmbed(fileName, mediaId, publicUrl) {
30342
+ if (publicUrl) return `![${fileName}](${publicUrl})`;
30343
+ return `Replicas chat embed: ![${fileName}](${MONOLITH_URL}/v1/media/${mediaId})`;
30344
+ }
30340
30345
  async function shareMedia(mediaId) {
30341
30346
  const { token } = await agentFetch(`/v1/engine/media/${mediaId}/share`, {
30342
30347
  method: "POST"
@@ -30437,22 +30442,11 @@ async function mediaUploadCommand(filePaths, options) {
30437
30442
  const result = results[i];
30438
30443
  if (result.status === "fulfilled") {
30439
30444
  const { fileName, media } = result.value;
30440
- if (media.kind === MEDIA_KIND.HTML) {
30441
- console.log(`HTML page: [${fileName}](${MONOLITH_URL}/v1/media/${media.id})`);
30442
- } else {
30443
- console.log(`![${fileName}](${MONOLITH_URL}/v1/media/${media.id})`);
30444
- }
30445
- if (options.access === "organization") {
30446
- console.log(
30447
- `Forge link (organization only): [View ${options.name?.[i] ?? fileName}](${getOrganizationMediaUrl(media.organization_id, media.id)})`
30448
- );
30449
- }
30445
+ const shareResult = publicAccess ? shareResults[i] : void 0;
30446
+ const publicUrl = shareResult?.status === "fulfilled" ? shareResult.value ?? void 0 : void 0;
30450
30447
  if (publicAccess) {
30451
- const shareResult = shareResults[i];
30452
- if (shareResult.status === "fulfilled" && shareResult.value) {
30453
- console.log(`Forge embed: ![${fileName}](${shareResult.value})`);
30454
- } else {
30455
- const error51 = shareResult.status === "rejected" ? shareResult.reason : new Error("Missing public share URL");
30448
+ if (!publicUrl) {
30449
+ const error51 = shareResult?.status === "rejected" ? shareResult.reason : new Error("Missing public share URL");
30456
30450
  failures.push({
30457
30451
  filePath: filePaths[i],
30458
30452
  operation: "share",
@@ -30460,6 +30454,16 @@ async function mediaUploadCommand(filePaths, options) {
30460
30454
  });
30461
30455
  }
30462
30456
  }
30457
+ if (media.kind === MEDIA_KIND.HTML) {
30458
+ console.log(`HTML page: [${fileName}](${MONOLITH_URL}/v1/media/${media.id})`);
30459
+ } else if (!publicAccess || publicUrl) {
30460
+ console.log(formatMediaEmbed(fileName, media.id, publicUrl));
30461
+ }
30462
+ if (options.access === "organization") {
30463
+ console.log(
30464
+ `Forge link (organization only): [View ${options.name?.[i] ?? fileName}](${getOrganizationMediaUrl(media.organization_id, media.id)})`
30465
+ );
30466
+ }
30463
30467
  if (config3?.workspace_id) {
30464
30468
  const deepLink = getWorkspaceDashboardUrl(config3.workspace_id, {
30465
30469
  mode: "media",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.560",
3
+ "version": "0.2.562",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {
@@ -18,6 +18,7 @@
18
18
  "dev": "bun run src/index.ts",
19
19
  "dev-pack": "bun run build && node scripts/pack-dev-tarball.mjs",
20
20
  "start": "node dist/index.cjs",
21
+ "test": "bun test",
21
22
  "prepublishOnly": "bun run build"
22
23
  },
23
24
  "keywords": [