replicas-cli 0.2.423 → 0.2.424

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 +85 -5
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -24492,7 +24492,7 @@ function formatTurnElapsed(ms) {
24492
24492
  }
24493
24493
 
24494
24494
  // ../shared/src/cli-version.ts
24495
- var CLI_VERSION = "0.2.423";
24495
+ var CLI_VERSION = "0.2.424";
24496
24496
 
24497
24497
  // ../shared/src/version.ts
24498
24498
  function compareVersions(v1, v2) {
@@ -24671,6 +24671,15 @@ function lifecyclePolicySupportsAutoStop(policy) {
24671
24671
  return policy === "default";
24672
24672
  }
24673
24673
 
24674
+ // ../shared/src/automations/github-checks.ts
24675
+ var AUTOMATION_CHECK_CONCLUSIONS = ["success", "failure"];
24676
+ function isAutomationCheckConclusion(value) {
24677
+ return AUTOMATION_CHECK_CONCLUSIONS.some((conclusion) => conclusion === value);
24678
+ }
24679
+ function normalizeAutomationGithubCheckNames(names) {
24680
+ return names.map((name) => name.trim()).filter(Boolean);
24681
+ }
24682
+
24674
24683
  // ../shared/src/automations/agent-validation.ts
24675
24684
  function validateAgentSelection(body, existing) {
24676
24685
  const agentProvider = body.agent_provider;
@@ -29153,6 +29162,9 @@ function printAutomation(automation2) {
29153
29162
  if (automation2.triggers.length > 0) {
29154
29163
  console.log(chalk17.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
29155
29164
  }
29165
+ if (automation2.github_check_names.length > 0) {
29166
+ console.log(chalk17.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
29167
+ }
29156
29168
  console.log(chalk17.gray(` Prompt: ${truncate2(automation2.prompt, 80)}`));
29157
29169
  if (automation2.cron_next_fire_at) {
29158
29170
  console.log(chalk17.gray(` Next Run: ${formatDate2(automation2.cron_next_fire_at)}`));
@@ -29179,6 +29191,9 @@ async function automationListCommand(options) {
29179
29191
  if (options.limit) params.set("limit", options.limit);
29180
29192
  const scope = parseScopeFilter(options.owner);
29181
29193
  if (scope) params.set("scope", scope);
29194
+ if (options.triggerType) params.set("trigger_type", options.triggerType);
29195
+ if (options.enabled) params.set("enabled", options.enabled);
29196
+ if (options.search) params.set("search", options.search);
29182
29197
  const query = params.toString();
29183
29198
  const response = await orgAuthenticatedFetch(
29184
29199
  `/v1/automations${query ? "?" + query : ""}`
@@ -29217,6 +29232,9 @@ Automation: ${automation2.name}
29217
29232
  console.log(chalk17.gray(` - ${formatTrigger(trigger)}`));
29218
29233
  }
29219
29234
  }
29235
+ if (automation2.github_check_names.length > 0) {
29236
+ console.log(chalk17.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
29237
+ }
29220
29238
  console.log(chalk17.gray(` Prompt: ${automation2.prompt}`));
29221
29239
  console.log(chalk17.gray(` Environment: ${automation2.environment_id}`));
29222
29240
  if (automation2.cron_expression) {
@@ -29510,6 +29528,7 @@ async function automationCreateCommand(name, options) {
29510
29528
  environment_id: selectedEnvironmentId,
29511
29529
  triggers,
29512
29530
  enabled: options.enabled !== false,
29531
+ ...options.githubChecks !== void 0 ? { github_check_names: normalizeAutomationGithubCheckNames(options.githubChecks.split(",")) } : {},
29513
29532
  config: workspaceConfigWithPrFollowups(void 0, prFollowups),
29514
29533
  ...lifecyclePolicy ? { workspace_lifecycle_policy: lifecyclePolicy } : {},
29515
29534
  ...options.autoStopMinutes ? { workspace_auto_stop_minutes: parseInt(options.autoStopMinutes, 10) } : {},
@@ -29576,7 +29595,7 @@ async function automationEditCommand(id, options) {
29576
29595
  model: existing.automation.model
29577
29596
  });
29578
29597
  const body = {};
29579
- const hasOptions = options.name || options.prompt || options.enabled !== void 0 || options.prFollowups !== void 0 || options.triggerCron || options.triggerGithub || options.triggerGitlab || options.environment || options.triggerGithubExcludeUsers !== void 0 || options.triggerGitlabExcludeUsers !== void 0 || options.lifecycle || options.sleepWhenDone || options.autoStopMinutes || options.agentProvider !== void 0 || options.model !== void 0 || options.thinkingLevel !== void 0 || options.planMode !== void 0 || options.goalMode !== void 0 || options.fastMode !== void 0;
29598
+ const hasOptions = options.name || options.prompt || options.enabled !== void 0 || options.prFollowups !== void 0 || options.triggerCron || options.triggerGithub || options.triggerGitlab || options.environment || options.triggerGithubExcludeUsers !== void 0 || options.triggerGitlabExcludeUsers !== void 0 || options.githubChecks !== void 0 || options.addGithubChecks !== void 0 || options.lifecycle || options.sleepWhenDone || options.autoStopMinutes || options.agentProvider !== void 0 || options.model !== void 0 || options.thinkingLevel !== void 0 || options.planMode !== void 0 || options.goalMode !== void 0 || options.fastMode !== void 0;
29580
29599
  if (!hasOptions) {
29581
29600
  const nameResponse = await prompts5({
29582
29601
  type: "text",
@@ -29636,6 +29655,15 @@ async function automationEditCommand(id, options) {
29636
29655
  if (options.prFollowups !== void 0) {
29637
29656
  body.config = workspaceConfigWithPrFollowups(existing.automation.config, options.prFollowups);
29638
29657
  }
29658
+ if (options.githubChecks !== void 0) {
29659
+ body.github_check_names = normalizeAutomationGithubCheckNames(options.githubChecks.split(","));
29660
+ }
29661
+ if (options.addGithubChecks !== void 0) {
29662
+ body.github_check_names = [.../* @__PURE__ */ new Set([
29663
+ ...existing.automation.github_check_names,
29664
+ ...normalizeAutomationGithubCheckNames(options.addGithubChecks.split(","))
29665
+ ])];
29666
+ }
29639
29667
  if (options.triggerCron || options.triggerGithub || options.triggerGitlab) {
29640
29668
  const triggers = [];
29641
29669
  if (options.triggerCron) {
@@ -29816,6 +29844,46 @@ Automation "${automationName}" (${id}) deleted.
29816
29844
  process.exit(1);
29817
29845
  }
29818
29846
  }
29847
+ async function automationCheckCommand(checkRunId, options) {
29848
+ const id = Number(checkRunId);
29849
+ if (!Number.isSafeInteger(id)) {
29850
+ console.error(chalk17.red("Error: check run ID must be an integer"));
29851
+ process.exit(1);
29852
+ }
29853
+ if (!options.token) {
29854
+ console.error(chalk17.red("Error: --token is required"));
29855
+ process.exit(1);
29856
+ }
29857
+ const { conclusion } = options;
29858
+ if (!isAutomationCheckConclusion(conclusion)) {
29859
+ console.error(chalk17.red(`Error: --conclusion must be one of ${AUTOMATION_CHECK_CONCLUSIONS.join(", ")}`));
29860
+ process.exit(1);
29861
+ }
29862
+ if (!options.title?.trim()) {
29863
+ console.error(chalk17.red("Error: --title is required"));
29864
+ process.exit(1);
29865
+ }
29866
+ const body = {
29867
+ token: options.token,
29868
+ conclusion,
29869
+ title: options.title.trim(),
29870
+ ...options.summary?.trim() ? { summary: options.summary.trim() } : {}
29871
+ };
29872
+ try {
29873
+ const response = await orgAuthenticatedFetch(
29874
+ `/v1/automations/checks/${id}`,
29875
+ { method: "POST", body }
29876
+ );
29877
+ console.log(response.reported ? chalk17.green(`
29878
+ Reported ${conclusion} for "${response.name}".
29879
+ `) : chalk17.yellow(`
29880
+ Skipped "${response.name}" \u2014 a newer run of this automation owns it and will report the verdict.
29881
+ `));
29882
+ } catch (error51) {
29883
+ console.error(chalk17.red(`Error: ${error51 instanceof Error ? error51.message : "Unknown error"}`));
29884
+ process.exit(1);
29885
+ }
29886
+ }
29819
29887
 
29820
29888
  // src/commands/preview.ts
29821
29889
  import chalk18 from "chalk";
@@ -37127,7 +37195,7 @@ program.command("read <id>").description("Read conversation history of a replica
37127
37195
  }
37128
37196
  });
37129
37197
  var automation = program.command("automation").alias("auto").description("Manage automations");
37130
- automation.command("list").description("List all automations").option("-p, --page <page>", "Page number").option("-l, --limit <limit>", "Number of items per page").option("--owner <owner>", "Ownership filter: org, user, all").action(async (options) => {
37198
+ automation.command("list").description("List all automations").option("-p, --page <page>", "Page number").option("-l, --limit <limit>", "Number of items per page").option("--owner <owner>", "Ownership filter: org, user, all").option("--trigger-type <type>", "Only automations with a trigger of this type (cron, github, gitlab, slack, sentry, custom)").option("--enabled <enabled>", "Only enabled or disabled automations (true/false)").option("--search <search>", "Case-insensitive substring match on the name").action(async (options) => {
37131
37199
  try {
37132
37200
  await automationListCommand(options);
37133
37201
  } catch (error51) {
@@ -37151,7 +37219,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
37151
37219
  process.exit(1);
37152
37220
  }
37153
37221
  });
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) => {
37222
+ 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("--github-checks <names>", "Comma-separated GitHub check names to create on matching PRs (requires a PR opened/updated trigger)").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) => {
37155
37223
  try {
37156
37224
  await automationCreateCommand(name, {
37157
37225
  ...options,
@@ -37166,7 +37234,7 @@ automation.command("create [name]").description("Create a new automation").optio
37166
37234
  process.exit(1);
37167
37235
  }
37168
37236
  });
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) => {
37237
+ 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("--github-checks <names>", "Comma-separated GitHub check names to create on matching PRs (replaces the current list; pass empty string to remove them)").option("--add-github-checks <names>", "Comma-separated GitHub check names to add, keeping the ones already configured").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) => {
37170
37238
  try {
37171
37239
  await automationEditCommand(id, options);
37172
37240
  } catch (error51) {
@@ -37202,6 +37270,18 @@ automation.command("delete <id>").description("Delete an automation").option("-f
37202
37270
  process.exit(1);
37203
37271
  }
37204
37272
  });
37273
+ automation.command("check <checkRunId>").description("Report this automation run's verdict on one of its GitHub checks").requiredOption("--token <token>", "Ownership token for this check, exactly as given in the prompt").requiredOption("--conclusion <conclusion>", "success or failure").requiredOption("--title <title>", "One-line verdict shown on the check").option("--summary <summary>", "What was checked and why it passed or failed").action(async (checkRunId, options) => {
37274
+ try {
37275
+ await automationCheckCommand(checkRunId, options);
37276
+ } catch (error51) {
37277
+ if (error51 instanceof Error) {
37278
+ console.error(chalk24.red(`
37279
+ \u2717 ${error51.message}
37280
+ `));
37281
+ }
37282
+ process.exit(1);
37283
+ }
37284
+ });
37205
37285
  automation.action(async () => {
37206
37286
  try {
37207
37287
  await automationListCommand({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.423",
3
+ "version": "0.2.424",
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": {