replicas-cli 0.2.421 → 0.2.423

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 +30 -15
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -24171,7 +24171,7 @@ replicas automation create ... --disabled
24171
24171
  # Workspace lifecycle
24172
24172
  replicas automation create ... --lifecycle archive_when_done
24173
24173
  replicas automation create ... --lifecycle sleep_when_done
24174
- replicas automation create ... --lifecycle delete_after_inactivity --auto-stop-minutes 30
24174
+ replicas automation create ... --lifecycle default --auto-stop-minutes 30
24175
24175
  \`\`\`
24176
24176
 
24177
24177
  When the user says "make me an automation that...", default to **picking the environment for them by listing the available envs** and asking only when the user hasn't already pinned one. Same for repos in GitHub triggers. Don't pepper the user with questions you can answer by reading the existing config.
@@ -24492,7 +24492,7 @@ function formatTurnElapsed(ms) {
24492
24492
  }
24493
24493
 
24494
24494
  // ../shared/src/cli-version.ts
24495
- var CLI_VERSION = "0.2.421";
24495
+ var CLI_VERSION = "0.2.423";
24496
24496
 
24497
24497
  // ../shared/src/version.ts
24498
24498
  function compareVersions(v1, v2) {
@@ -24579,7 +24579,6 @@ var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"
24579
24579
  function isWorkspaceSuspendedStatus(status) {
24580
24580
  return status === "sleeping" || status === "archived";
24581
24581
  }
24582
- var VALID_LIFECYCLE_POLICIES = ["default", "archive_when_done", "sleep_when_done", "delete_after_inactivity"];
24583
24582
  function workspaceConfigWithCapabilities(config3, capabilities = {}) {
24584
24583
  const mergedCapabilities = {
24585
24584
  ...config3?.capabilities,
@@ -24662,8 +24661,14 @@ var AUDIT_LOG_ACTIONS = Object.values(AUDIT_LOG_ACTION);
24662
24661
 
24663
24662
  // ../shared/src/automations/types.ts
24664
24663
  var AUTOMATION_DEBOUNCE_MAX_SECONDS = 24 * 60 * 60;
24664
+ var AUTOMATION_LIFECYCLE_POLICIES = ["default", "archive_when_done", "sleep_when_done"];
24665
+ function toAutomationLifecyclePolicy(policy) {
24666
+ if (!policy) return "default";
24667
+ if (policy === "default" || policy === "archive_when_done" || policy === "sleep_when_done") return policy;
24668
+ return "archive_when_done";
24669
+ }
24665
24670
  function lifecyclePolicySupportsAutoStop(policy) {
24666
- return policy === "default" || policy === "delete_after_inactivity";
24671
+ return policy === "default";
24667
24672
  }
24668
24673
 
24669
24674
  // ../shared/src/automations/agent-validation.ts
@@ -27053,9 +27058,16 @@ async function orgAuthenticatedFetch(url2, options) {
27053
27058
  ...options?.headers || {}
27054
27059
  }, options);
27055
27060
  }
27061
+ var ApiError = class extends Error {
27062
+ constructor(message, status) {
27063
+ super(message);
27064
+ this.name = "ApiError";
27065
+ this.status = status;
27066
+ }
27067
+ };
27056
27068
  async function throwResponseError(response) {
27057
27069
  const error51 = await response.json().catch(() => ({ error: "Request failed" }));
27058
- throw new Error(error51.error || `Request failed with status ${response.status}`);
27070
+ throw new ApiError(error51.error || `Request failed with status ${response.status}`, response.status);
27059
27071
  }
27060
27072
  async function apiFetch(url2, headers, options) {
27061
27073
  const requestHeaders = {
@@ -27594,7 +27606,10 @@ async function fetchWorkspaceById(workspaceId) {
27594
27606
  const response = await orgAuthenticatedFetch(
27595
27607
  `/v1/workspaces/${encodeURIComponent(workspaceId)}`
27596
27608
  ).catch((error51) => {
27597
- if (error51 instanceof Error && error51.message.includes("Workspace not found")) return null;
27609
+ if (error51 instanceof ApiError) {
27610
+ if (error51.status === 404) return null;
27611
+ if (error51.status === 410) throw new Error(`Workspace ${workspaceId} has been deleted.`);
27612
+ }
27598
27613
  throw error51;
27599
27614
  });
27600
27615
  return response?.workspace ?? null;
@@ -29010,14 +29025,14 @@ function parseModelOption(value) {
29010
29025
  if (trimmed === "" || trimmed.toLowerCase() === "none") return null;
29011
29026
  return normalizeClaudeModel(trimmed) ?? trimmed;
29012
29027
  }
29013
- function isWorkspaceLifecyclePolicy(value) {
29014
- return VALID_LIFECYCLE_POLICIES.some((policy) => policy === value);
29028
+ function isAutomationLifecyclePolicy(value) {
29029
+ return AUTOMATION_LIFECYCLE_POLICIES.some((policy) => policy === value);
29015
29030
  }
29016
29031
  function parseWorkspaceLifecyclePolicyOption(value) {
29017
29032
  if (!value) return void 0;
29018
- if (isWorkspaceLifecyclePolicy(value)) return value;
29033
+ if (isAutomationLifecyclePolicy(value)) return value;
29019
29034
  console.log(chalk17.red(`Invalid lifecycle policy: ${value}`));
29020
- console.log(chalk17.gray(`Valid options: ${VALID_LIFECYCLE_POLICIES.join(", ")}`));
29035
+ console.log(chalk17.gray(`Valid options: ${AUTOMATION_LIFECYCLE_POLICIES.join(", ")}`));
29021
29036
  process.exit(1);
29022
29037
  }
29023
29038
  function parseExcludedActorsOption(value) {
@@ -29353,7 +29368,7 @@ async function automationCreateCommand(name, options) {
29353
29368
  ensureOrgApiAuthenticated();
29354
29369
  const lifecyclePolicy = parseAutomationLifecycleOptions(options);
29355
29370
  if (options.autoStopMinutes && !lifecyclePolicySupportsAutoStop(lifecyclePolicy ?? "default")) {
29356
- console.log(chalk17.red("--auto-stop-minutes requires --lifecycle default or delete_after_inactivity"));
29371
+ console.log(chalk17.red("--auto-stop-minutes requires --lifecycle default"));
29357
29372
  process.exit(1);
29358
29373
  }
29359
29374
  if (options.autoStopMinutes) {
@@ -29551,9 +29566,9 @@ async function automationEditCommand(id, options) {
29551
29566
  };
29552
29567
  try {
29553
29568
  const existing = await orgAuthenticatedFetch(`/v1/automations/${id}`);
29554
- const autoStopLifecyclePolicy = lifecyclePolicy ?? existing.automation.workspace_lifecycle_policy ?? "default";
29569
+ const autoStopLifecyclePolicy = lifecyclePolicy ?? toAutomationLifecyclePolicy(existing.automation.workspace_lifecycle_policy);
29555
29570
  if (options.autoStopMinutes && !lifecyclePolicySupportsAutoStop(autoStopLifecyclePolicy)) {
29556
- console.log(chalk17.red("--auto-stop-minutes requires --lifecycle default or delete_after_inactivity"));
29571
+ console.log(chalk17.red("--auto-stop-minutes requires --lifecycle default"));
29557
29572
  process.exit(1);
29558
29573
  }
29559
29574
  const agentSelection = applyAgentSelection(parsedAgent, {
@@ -37136,7 +37151,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
37136
37151
  process.exit(1);
37137
37152
  }
37138
37153
  });
37139
- automation.command("create [name]").description("Create a new automation").option("-p, --prompt <prompt>", "Prompt for the automation").option("-e, --environment <environment>", "Environment name or ID").option("--trigger-cron <schedule>", 'Cron schedule expression (e.g. "0 9 * * 1-5")').option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger (default: UTC)").option("--trigger-github <event>", 'GitHub event (e.g. "pull_request.opened")').option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-gitlab <event>", 'GitLab event (e.g. "merge_request.opened")').option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--lifecycle <policy>", "Workspace lifecycle: archive_when_done, sleep_when_done, delete_after_inactivity, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default or delete_after_inactivity)").option("--pr-followups", "Allow follow-up actions on matching PRs").option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor, relay (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode", "Run automation messages in plan mode").option("--goal-mode", "Set automation messages as Codex goals").option("--fast-mode", "Run automation messages in fast mode").option("--personal", "Create a personal automation owned by the authenticated user").option("--disabled", "Create in disabled state").action(async (name, options) => {
37154
+ automation.command("create [name]").description("Create a new automation").option("-p, --prompt <prompt>", "Prompt for the automation").option("-e, --environment <environment>", "Environment name or ID").option("--trigger-cron <schedule>", 'Cron schedule expression (e.g. "0 9 * * 1-5")').option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger (default: UTC)").option("--trigger-github <event>", 'GitHub event (e.g. "pull_request.opened")').option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-gitlab <event>", 'GitLab event (e.g. "merge_request.opened")').option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--lifecycle <policy>", "Workspace lifecycle: archive_when_done, sleep_when_done, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default)").option("--pr-followups", "Allow follow-up actions on matching PRs").option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor, relay (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode", "Run automation messages in plan mode").option("--goal-mode", "Set automation messages as Codex goals").option("--fast-mode", "Run automation messages in fast mode").option("--personal", "Create a personal automation owned by the authenticated user").option("--disabled", "Create in disabled state").action(async (name, options) => {
37140
37155
  try {
37141
37156
  await automationCreateCommand(name, {
37142
37157
  ...options,
@@ -37151,7 +37166,7 @@ automation.command("create [name]").description("Create a new automation").optio
37151
37166
  process.exit(1);
37152
37167
  }
37153
37168
  });
37154
- automation.command("edit <id>").description("Edit an existing automation").option("-n, --name <name>", "New name").option("-p, --prompt <prompt>", "New prompt").option("-e, --enabled <enabled>", "Enable or disable (true/false)").option("--trigger-cron <schedule>", "Set cron schedule (replaces existing triggers)").option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger").option("--trigger-github <event>", "Set GitHub event (replaces existing triggers)").option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-gitlab <event>", "Set GitLab event (replaces existing triggers)").option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--environment <environment>", "Environment name or ID").option("--lifecycle <policy>", "Workspace lifecycle: archive_when_done, sleep_when_done, delete_after_inactivity, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default or delete_after_inactivity)").option("--pr-followups <enabled>", "Allow follow-up actions on matching PRs (true/false)", parseBooleanOption).option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor, relay (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode <enabled>", "Run automation messages in plan mode (true/false)", parseBooleanOption).option("--goal-mode <enabled>", "Set automation messages as Codex goals (true/false)", parseBooleanOption).option("--fast-mode <enabled>", "Run automation messages in fast mode (true/false)", parseBooleanOption).action(async (id, options) => {
37169
+ automation.command("edit <id>").description("Edit an existing automation").option("-n, --name <name>", "New name").option("-p, --prompt <prompt>", "New prompt").option("-e, --enabled <enabled>", "Enable or disable (true/false)").option("--trigger-cron <schedule>", "Set cron schedule (replaces existing triggers)").option("--trigger-cron-timezone <timezone>", "Timezone for cron trigger").option("--trigger-github <event>", "Set GitHub event (replaces existing triggers)").option("--trigger-github-repos <repos>", "Comma-separated repo names to filter GitHub trigger").option("--trigger-github-exclude-users <users>", "Comma-separated GitHub usernames to exclude from triggering (pass empty string to clear the list)").option("--trigger-gitlab <event>", "Set GitLab event (replaces existing triggers)").option("--trigger-gitlab-repos <repos>", "Comma-separated repo names to filter GitLab trigger").option("--trigger-gitlab-exclude-users <users>", "Comma-separated GitLab usernames to exclude from triggering (pass empty string to clear the list)").option("--environment <environment>", "Environment name or ID").option("--lifecycle <policy>", "Workspace lifecycle: archive_when_done, sleep_when_done, default").option("--sleep-when-done", "Sleep automation workspaces as soon as the agent finishes").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle default)").option("--pr-followups <enabled>", "Allow follow-up actions on matching PRs (true/false)", parseBooleanOption).option("--agent-provider <provider>", 'Coding agent to use: claude, codex, cursor, relay (or "none" to inherit org default)').option("--model <model>", 'Model identifier (must be valid for --agent-provider; pass "none" to clear)').option("--thinking-level <level>", 'Thinking/reasoning level: low, medium, high, xhigh, max (or "none" to clear)').option("--plan-mode <enabled>", "Run automation messages in plan mode (true/false)", parseBooleanOption).option("--goal-mode <enabled>", "Set automation messages as Codex goals (true/false)", parseBooleanOption).option("--fast-mode <enabled>", "Run automation messages in fast mode (true/false)", parseBooleanOption).action(async (id, options) => {
37155
37170
  try {
37156
37171
  await automationEditCommand(id, options);
37157
37172
  } catch (error51) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.421",
3
+ "version": "0.2.423",
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": {