replicas-cli 0.2.639 → 0.2.641

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/README.md CHANGED
@@ -41,6 +41,9 @@ Choose the organization used by organization-scoped commands. The selection pers
41
41
  ### `replicas connect <workspace-name>`
42
42
  Connect to a workspace via SSH.
43
43
 
44
+ ### `replicas code [workspace-name...]`
45
+ Open a workspace in VS Code via Remote SSH. Omit the argument to pick a workspace with the arrow keys and Enter, or pass a name or ID. Names with spaces work with or without quotes.
46
+
44
47
  ### Coding agents
45
48
  Use `replicas claude-auth` or `replicas codex-auth` to connect Claude Code or Codex credentials. Cursor uses a Cursor API key configured in Coding Agents settings.
46
49
 
package/dist/index.cjs CHANGED
@@ -27048,6 +27048,7 @@ var PLANS = {
27048
27048
  "Unlimited automations",
27049
27049
  "Warm pools and warm hooks",
27050
27050
  "Higher API rate limits",
27051
+ "Mobile app",
27051
27052
  "Access to a static egress IP",
27052
27053
  "Auto-upgraded sandbox resources (4 vCPU, 32 GB disk, 16 GB memory)",
27053
27054
  "Shared Slack support channel"
@@ -27064,6 +27065,7 @@ var PLANS = {
27064
27065
  "Unlimited automations",
27065
27066
  "Custom warm hooks and pools",
27066
27067
  "Custom API rates",
27068
+ "Mobile app",
27067
27069
  "Custom rate limits",
27068
27070
  "Shared Slack support channel",
27069
27071
  "SOC 2",
@@ -27250,7 +27252,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
27250
27252
  });
27251
27253
 
27252
27254
  // ../shared/src/cli-version.ts
27253
- var CLI_VERSION = "0.2.639";
27255
+ var CLI_VERSION = "0.2.641";
27254
27256
 
27255
27257
  // ../shared/src/version.ts
27256
27258
  function compareVersions(v1, v2) {
@@ -28510,27 +28512,37 @@ async function resolveWorkspaceRecord(workspaceName) {
28510
28512
  if (!canCallOrgApi()) {
28511
28513
  throw new Error('No organization selected. Please run "replicas org switch" first.');
28512
28514
  }
28513
- const exactWorkspace = await fetchWorkspaceById(workspaceName);
28514
- if (exactWorkspace) return exactWorkspace;
28515
- console.log(import_chalk5.default.blue(`
28516
- Searching for workspace: ${workspaceName}...`));
28517
- const response = await orgAuthenticatedFetch(
28518
- `/v1/workspaces?name=${encodeURIComponent(workspaceName)}`
28519
- );
28520
- if (response.workspaces.length === 0) {
28521
- throw new Error(`No workspaces found with name matching "${workspaceName}".`);
28515
+ if (workspaceName) {
28516
+ const exactWorkspace = await fetchWorkspaceById(workspaceName);
28517
+ if (exactWorkspace) return exactWorkspace;
28518
+ }
28519
+ console.log(import_chalk5.default.blue(workspaceName ? `
28520
+ Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
28521
+ const params = new URLSearchParams({ limit: "100" });
28522
+ if (workspaceName) params.set("name", workspaceName);
28523
+ const workspaces = [];
28524
+ for (let page = 1; ; page++) {
28525
+ params.set("page", String(page));
28526
+ const response = await orgAuthenticatedFetch(`/v1/workspaces?${params}`);
28527
+ workspaces.push(...response.workspaces);
28528
+ if (page >= response.totalPages || response.workspaces.length === 0) break;
28529
+ }
28530
+ if (workspaces.length === 0) {
28531
+ throw new Error(workspaceName ? `No workspaces found with name matching "${workspaceName}".` : "No workspaces found.");
28522
28532
  }
28523
28533
  let selectedWorkspace;
28524
- if (response.workspaces.length === 1) {
28525
- selectedWorkspace = response.workspaces[0];
28534
+ if (workspaceName && workspaces.length === 1) {
28535
+ selectedWorkspace = workspaces[0];
28526
28536
  } else {
28527
- console.log(import_chalk5.default.yellow(`
28528
- Found ${response.workspaces.length} workspaces matching "${workspaceName}":`));
28537
+ if (workspaceName) {
28538
+ console.log(import_chalk5.default.yellow(`
28539
+ Found ${workspaces.length} workspaces matching "${workspaceName}":`));
28540
+ }
28529
28541
  const selectResponse = await (0, import_prompts5.default)({
28530
28542
  type: "select",
28531
28543
  name: "workspaceId",
28532
28544
  message: "Select a workspace:",
28533
- choices: response.workspaces.map((ws) => ({
28545
+ choices: workspaces.map((ws) => ({
28534
28546
  title: `${ws.name} (${ws.status || "unknown"})`,
28535
28547
  value: ws.id,
28536
28548
  description: `Status: ${ws.status || "unknown"}`
@@ -28539,7 +28551,7 @@ Found ${response.workspaces.length} workspaces matching "${workspaceName}":`));
28539
28551
  if (!selectResponse.workspaceId) {
28540
28552
  throw new Error("Workspace selection cancelled.");
28541
28553
  }
28542
- const selected = response.workspaces.find((ws) => ws.id === selectResponse.workspaceId);
28554
+ const selected = workspaces.find((ws) => ws.id === selectResponse.workspaceId);
28543
28555
  if (!selected) {
28544
28556
  throw new Error("Selected workspace was not found.");
28545
28557
  }
@@ -28699,6 +28711,10 @@ async function codeCommand(workspaceName) {
28699
28711
  console.log(import_chalk7.default.red('Not logged in. Please run "replicas login" first.'));
28700
28712
  process.exit(1);
28701
28713
  }
28714
+ if (!workspaceName && !process.stdin.isTTY) {
28715
+ console.error(import_chalk7.default.red('Pass a workspace name or ID, or run "replicas code" in an interactive terminal.'));
28716
+ process.exit(1);
28717
+ }
28702
28718
  try {
28703
28719
  const { workspace, sshToken, sshHost, sshProxyCommand, repoName } = await prepareWorkspaceConnection(workspaceName);
28704
28720
  const hostAlias = getWorkspaceHostAlias(workspace.name);
@@ -32152,7 +32168,7 @@ Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
32152
32168
  process.exit(1);
32153
32169
  }
32154
32170
  });
32155
- program.command("code <workspace-name...>").description("Open a workspace in VSCode/Cursor via Remote SSH").action(async (workspaceName) => {
32171
+ program.command("code [workspace-name...]").description("Open a workspace in VSCode/Cursor via Remote SSH (pick a workspace if omitted)").action(async (workspaceName = []) => {
32156
32172
  try {
32157
32173
  await codeCommand(workspaceName.join(" "));
32158
32174
  } catch (error51) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.639",
3
+ "version": "0.2.641",
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": {