replicas-cli 0.3.185 → 0.3.187

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 +52 -4
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -17041,7 +17041,7 @@ var init_workspace_identity = __esm({
17041
17041
  });
17042
17042
 
17043
17043
  // ../shared/src/routes/environment.ts
17044
- var ENVIRONMENT_MCP_TRANSPORTS, stringMap, createEnvironmentMcpRequestSchema, updateEnvironmentMcpRequestSchema;
17044
+ var ENVIRONMENT_MCP_TRANSPORTS, stringMap, createEnvironmentMcpRequestSchema, updateEnvironmentMcpRequestSchema, createEnvironmentDeviceRequestSchema, updateEnvironmentDeviceRequestSchema, provisionedDeviceSchema;
17045
17045
  var init_environment = __esm({
17046
17046
  "../shared/src/routes/environment.ts"() {
17047
17047
  "use strict";
@@ -17059,6 +17059,20 @@ var init_environment = __esm({
17059
17059
  ]).describe("stdio: `{ command, args, env }`. http/sse: `{ url, headers }`.")
17060
17060
  });
17061
17061
  updateEnvironmentMcpRequestSchema = createEnvironmentMcpRequestSchema.partial();
17062
+ createEnvironmentDeviceRequestSchema = external_exports.object({
17063
+ name: external_exports.string().regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/, "Use lowercase letters, numbers and dashes").describe("SSH alias in workspaces, e.g. `mac-mini` for `ssh mac-mini`."),
17064
+ host: external_exports.string().max(253).regex(/^(?:[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?|[0-9A-Fa-f:]+)$/, "Enter a hostname or IP address").describe("Hostname or IP, such as a Tailscale MagicDNS name (`mac-mini`) or a public address."),
17065
+ port: external_exports.number().int().min(1).max(65535).optional().describe("SSH port. Defaults to 22."),
17066
+ username: external_exports.string().regex(/^[A-Za-z0-9_][A-Za-z0-9._-]{0,63}$/, "Enter the account name on the device").describe("Account the agent signs in as.")
17067
+ });
17068
+ updateEnvironmentDeviceRequestSchema = createEnvironmentDeviceRequestSchema.partial();
17069
+ provisionedDeviceSchema = external_exports.object({
17070
+ name: external_exports.string(),
17071
+ host: external_exports.string(),
17072
+ port: external_exports.number(),
17073
+ username: external_exports.string(),
17074
+ private_key: external_exports.string()
17075
+ });
17062
17076
  }
17063
17077
  });
17064
17078
 
@@ -17136,7 +17150,7 @@ var init_workspaces = __esm({
17136
17150
  });
17137
17151
 
17138
17152
  // ../shared/src/replicas-mcp.ts
17139
- var REPLICAS_MCP_TOOLS, automationToolInputSchema, automationCreateToolInputSchema, automationUpdateToolInputSchema, chatPath, provider, model, thinkingLevel, title, message, createChatToolInputSchema, forkChatToolInputSchema, renameChatToolInputSchema, runCommandToolInputSchema, environmentMcpPath, createEnvironmentMcpToolInputSchema, updateEnvironmentMcpToolInputSchema;
17153
+ var REPLICAS_MCP_TOOLS, automationToolInputSchema, automationCreateToolInputSchema, automationUpdateToolInputSchema, chatPath, provider, model, thinkingLevel, title, message, createChatToolInputSchema, forkChatToolInputSchema, renameChatToolInputSchema, runCommandToolInputSchema, environmentMcpPath, createEnvironmentMcpToolInputSchema, updateEnvironmentMcpToolInputSchema, createEnvironmentDeviceToolInputSchema;
17140
17154
  var init_replicas_mcp = __esm({
17141
17155
  "../shared/src/replicas-mcp.ts"() {
17142
17156
  "use strict";
@@ -17227,6 +17241,7 @@ var init_replicas_mcp = __esm({
17227
17241
  mcp_id: external_exports.string().describe("MCP ID"),
17228
17242
  ...updateEnvironmentMcpRequestSchema.shape
17229
17243
  });
17244
+ createEnvironmentDeviceToolInputSchema = external_exports.object({ ...environmentMcpPath, ...createEnvironmentDeviceRequestSchema.shape });
17230
17245
  }
17231
17246
  });
17232
17247
 
@@ -31112,7 +31127,7 @@ var CLI_VERSION;
31112
31127
  var init_cli_version = __esm({
31113
31128
  "../shared/src/cli-version.ts"() {
31114
31129
  "use strict";
31115
- CLI_VERSION = "0.3.185";
31130
+ CLI_VERSION = "0.3.187";
31116
31131
  }
31117
31132
  });
31118
31133
 
@@ -35720,6 +35735,31 @@ async function envMcpsRemoveCommand(env, nameOrId) {
35720
35735
  await orgAuthenticatedFetch(`/v1/environments/${id}/mcps/${mcp.id}`, { method: "DELETE" });
35721
35736
  outputSuccess(`Removed MCP server ${mcp.name}`);
35722
35737
  }
35738
+ async function envDevicesListCommand(env) {
35739
+ const response = await orgAuthenticatedFetch(
35740
+ `/v1/environments/${await resolveEnvironmentId(env)}/devices`
35741
+ );
35742
+ output(response, ({ environment_devices }) => {
35743
+ for (const device of environment_devices) console.log(`${device.id} ${device.name} ${device.username}@${device.host}:${device.port}`);
35744
+ });
35745
+ }
35746
+ async function envDevicesAddCommand(env, name, options) {
35747
+ const id = await resolveEnvironmentId(env);
35748
+ const body = { name, host: options.host, username: options.user, port: options.port };
35749
+ const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`, { method: "POST", body });
35750
+ output(response, ({ environment_device }) => {
35751
+ console.log(import_chalk20.default.green(`Added device ${name}. Allow its key by running this on the device as ${options.user}:`));
35752
+ console.log(`mkdir -p ~/.ssh && echo '${environment_device.public_key}' >> ~/.ssh/authorized_keys`);
35753
+ });
35754
+ }
35755
+ async function envDevicesRemoveCommand(env, nameOrId) {
35756
+ const id = await resolveEnvironmentId(env);
35757
+ const { environment_devices } = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`);
35758
+ const device = resolveByNameOrId(nameOrId, environment_devices);
35759
+ if (!device) throw new Error(`Device not found: ${nameOrId}`);
35760
+ await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}`, { method: "DELETE" });
35761
+ outputSuccess(`Removed device ${device.name}`);
35762
+ }
35723
35763
  function envWarmPoolCommand(enabled) {
35724
35764
  return async (env) => {
35725
35765
  const id = await resolveEnvironmentId(env);
@@ -38872,7 +38912,7 @@ function registerEnvironmentHookCommands(parent, config3) {
38872
38912
  }
38873
38913
  hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action(run(config3.repositoryHooks));
38874
38914
  }
38875
- var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, media, environment, envVars, envFiles, envSkills, envMcps, envWarmPool, preview, authenticatedPreviewHelp;
38915
+ var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, media, environment, envVars, envFiles, envSkills, envMcps, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
38876
38916
  var init_src2 = __esm({
38877
38917
  "src/index.ts"() {
38878
38918
  "use strict";
@@ -39103,6 +39143,14 @@ var init_src2 = __esm({
39103
39143
  envMcps.command("list <env>").description("List MCP servers").action(run(envMcpsListCommand));
39104
39144
  envMcps.command("add <env> <name>").description("Add a remote (--url) or stdio (--command) MCP server").option("-u, --url <url>", "Remote server URL").addOption(new import_commander.Option("--transport <transport>", "Remote transport").choices(["http", "sse"])).option("-H, --header <key=value>", "HTTP header (repeatable)", collect, []).option("-c, --command <command>", "Executable for a stdio server").option("--arg <arg>", "Argument for the stdio command (repeatable)", collect, []).option("--env <key=value>", "Environment variable for the stdio command (repeatable)", collect, []).action(run(envMcpsAddCommand));
39105
39145
  envMcps.command("remove <env> <name-or-id>").description("Remove an MCP server").action(run(envMcpsRemoveCommand));
39146
+ envDevices = environment.command("devices", { hidden: true }).description("Computers the agent reaches over SSH, like a Mac mini or your own laptop");
39147
+ envDevices.command("list <env>").description("List devices").action(run(envDevicesListCommand));
39148
+ envDevices.command("add <env> <name>").description("Add a device and print the command that allows its key on the device").requiredOption("--host <host>", "Hostname or IP, such as its Tailscale name").requiredOption("--user <user>", "Account the agent signs in as").option("--port <port>", "SSH port (default 22)", (value) => {
39149
+ const port = Number(value);
39150
+ if (!Number.isInteger(port)) throw new import_commander.InvalidArgumentError("must be a whole number");
39151
+ return port;
39152
+ }).action(run(envDevicesAddCommand));
39153
+ envDevices.command("remove <env> <name-or-id>").description("Remove a device and delete its key").action(run(envDevicesRemoveCommand));
39106
39154
  envWarmPool = environment.command("warm-pool").description("Keep pre-warmed workspaces ready for an environment");
39107
39155
  envWarmPool.command("enable <env>").description("Enable the warm pool").action(run(envWarmPoolCommand(true)));
39108
39156
  envWarmPool.command("disable <env>").description("Disable the warm pool").action(run(envWarmPoolCommand(false)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.185",
3
+ "version": "0.3.187",
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": {