replicas-cli 0.2.169 → 0.2.171
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/dist/index.mjs +53 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7315,7 +7315,7 @@ var require_dist = __commonJS({
|
|
|
7315
7315
|
|
|
7316
7316
|
// src/index.ts
|
|
7317
7317
|
import "dotenv/config";
|
|
7318
|
-
import { Command } from "commander";
|
|
7318
|
+
import { Command, InvalidArgumentError } from "commander";
|
|
7319
7319
|
import chalk21 from "chalk";
|
|
7320
7320
|
|
|
7321
7321
|
// src/commands/login.ts
|
|
@@ -8156,6 +8156,22 @@ var MODEL_LABELS = {
|
|
|
8156
8156
|
var MERGED_MESSAGE_SEPARATOR = "\n\n<!-- replicas:merged -->\n\n";
|
|
8157
8157
|
|
|
8158
8158
|
// ../shared/src/routes/workspaces.ts
|
|
8159
|
+
function workspaceConfigWithCapabilities(config2, capabilities = {}) {
|
|
8160
|
+
const mergedCapabilities = {
|
|
8161
|
+
...config2?.capabilities,
|
|
8162
|
+
...capabilities
|
|
8163
|
+
};
|
|
8164
|
+
return {
|
|
8165
|
+
...config2,
|
|
8166
|
+
capabilities: {
|
|
8167
|
+
...mergedCapabilities,
|
|
8168
|
+
pr_followups: mergedCapabilities.pr_followups === true
|
|
8169
|
+
}
|
|
8170
|
+
};
|
|
8171
|
+
}
|
|
8172
|
+
function workspaceConfigWithPrFollowups(config2, prFollowups = config2?.capabilities?.pr_followups === true) {
|
|
8173
|
+
return workspaceConfigWithCapabilities(config2, { pr_followups: prFollowups });
|
|
8174
|
+
}
|
|
8159
8175
|
var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
|
|
8160
8176
|
var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
8161
8177
|
|
|
@@ -9326,6 +9342,7 @@ function createMockWorkspaceRecord(organizationId, name, environmentId) {
|
|
|
9326
9342
|
soft_delete: false,
|
|
9327
9343
|
lifecycle_policy: "default",
|
|
9328
9344
|
auto_stop_minutes: null,
|
|
9345
|
+
config: {},
|
|
9329
9346
|
environment_id: environmentId ?? null
|
|
9330
9347
|
};
|
|
9331
9348
|
}
|
|
@@ -10646,6 +10663,7 @@ function printAutomation(automation2) {
|
|
|
10646
10663
|
const lifecycle = automation2.workspace_lifecycle_policy === "delete_after_inactivity" ? `delete_after_inactivity (${automation2.workspace_auto_stop_minutes ?? 30}m)` : automation2.workspace_lifecycle_policy;
|
|
10647
10664
|
console.log(chalk17.gray(` Lifecycle: ${lifecycle}`));
|
|
10648
10665
|
}
|
|
10666
|
+
console.log(chalk17.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? chalk17.green("managed") : "read-only"}`));
|
|
10649
10667
|
console.log(chalk17.gray(` Created: ${formatDate2(automation2.created_at)}`));
|
|
10650
10668
|
console.log(chalk17.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
|
|
10651
10669
|
console.log();
|
|
@@ -10711,6 +10729,7 @@ Automation: ${automation2.name}
|
|
|
10711
10729
|
if (automation2.workspace_auto_stop_minutes) {
|
|
10712
10730
|
console.log(chalk17.gray(` Auto-stop: ${automation2.workspace_auto_stop_minutes} minutes`));
|
|
10713
10731
|
}
|
|
10732
|
+
console.log(chalk17.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? "managed" : "read-only"}`));
|
|
10714
10733
|
console.log(chalk17.gray(` Created: ${formatDate2(automation2.created_at)}`));
|
|
10715
10734
|
console.log(chalk17.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
|
|
10716
10735
|
console.log();
|
|
@@ -10909,12 +10928,23 @@ async function automationCreateCommand(name, options) {
|
|
|
10909
10928
|
process.exit(1);
|
|
10910
10929
|
}
|
|
10911
10930
|
}
|
|
10931
|
+
let prFollowups = options.prFollowups === true;
|
|
10932
|
+
if (options.prFollowups === void 0) {
|
|
10933
|
+
const prFollowupsResponse = await prompts4({
|
|
10934
|
+
type: "confirm",
|
|
10935
|
+
name: "prFollowups",
|
|
10936
|
+
message: "Allow PR follow-ups?",
|
|
10937
|
+
initial: false
|
|
10938
|
+
});
|
|
10939
|
+
prFollowups = prFollowupsResponse.prFollowups === true;
|
|
10940
|
+
}
|
|
10912
10941
|
const body = {
|
|
10913
10942
|
name: automationName,
|
|
10914
10943
|
prompt: automationPrompt,
|
|
10915
10944
|
environment_id: selectedEnvironmentId,
|
|
10916
10945
|
triggers,
|
|
10917
10946
|
enabled: options.enabled !== false,
|
|
10947
|
+
config: workspaceConfigWithPrFollowups(void 0, prFollowups),
|
|
10918
10948
|
...options.lifecycle ? { workspace_lifecycle_policy: options.lifecycle } : {},
|
|
10919
10949
|
...options.autoStopMinutes ? { workspace_auto_stop_minutes: parseInt(options.autoStopMinutes, 10) } : {}
|
|
10920
10950
|
};
|
|
@@ -10962,7 +10992,7 @@ async function automationEditCommand(id, options) {
|
|
|
10962
10992
|
try {
|
|
10963
10993
|
const existing = await orgAuthenticatedFetch(`/v1/automations/${id}`);
|
|
10964
10994
|
const body = {};
|
|
10965
|
-
const hasOptions = options.name || options.prompt || options.enabled !== void 0 || options.triggerCron || options.triggerGithub || options.environment || options.lifecycle || options.autoStopMinutes;
|
|
10995
|
+
const hasOptions = options.name || options.prompt || options.enabled !== void 0 || options.prFollowups !== void 0 || options.triggerCron || options.triggerGithub || options.environment || options.lifecycle || options.autoStopMinutes;
|
|
10966
10996
|
if (!hasOptions) {
|
|
10967
10997
|
const nameResponse = await prompts4({
|
|
10968
10998
|
type: "text",
|
|
@@ -10991,6 +11021,16 @@ async function automationEditCommand(id, options) {
|
|
|
10991
11021
|
if (enabledResponse.enabled !== void 0 && enabledResponse.enabled !== existing.automation.enabled) {
|
|
10992
11022
|
body.enabled = enabledResponse.enabled;
|
|
10993
11023
|
}
|
|
11024
|
+
const existingPrFollowups = existing.automation.config.capabilities?.pr_followups === true;
|
|
11025
|
+
const prFollowupsResponse = await prompts4({
|
|
11026
|
+
type: "confirm",
|
|
11027
|
+
name: "prFollowups",
|
|
11028
|
+
message: "Allow PR follow-ups?",
|
|
11029
|
+
initial: existingPrFollowups
|
|
11030
|
+
});
|
|
11031
|
+
if (prFollowupsResponse.prFollowups !== void 0 && prFollowupsResponse.prFollowups !== existingPrFollowups) {
|
|
11032
|
+
body.config = workspaceConfigWithPrFollowups(existing.automation.config, prFollowupsResponse.prFollowups);
|
|
11033
|
+
}
|
|
10994
11034
|
const editTriggersResponse = await prompts4({
|
|
10995
11035
|
type: "confirm",
|
|
10996
11036
|
name: "edit",
|
|
@@ -11009,6 +11049,9 @@ async function automationEditCommand(id, options) {
|
|
|
11009
11049
|
if (options.enabled !== void 0) {
|
|
11010
11050
|
body.enabled = options.enabled === "true";
|
|
11011
11051
|
}
|
|
11052
|
+
if (options.prFollowups !== void 0) {
|
|
11053
|
+
body.config = workspaceConfigWithPrFollowups(existing.automation.config, options.prFollowups);
|
|
11054
|
+
}
|
|
11012
11055
|
if (options.triggerCron || options.triggerGithub) {
|
|
11013
11056
|
const triggers = [];
|
|
11014
11057
|
if (options.triggerCron) {
|
|
@@ -14884,7 +14927,12 @@ Deleted file ${pathOrId}.
|
|
|
14884
14927
|
}
|
|
14885
14928
|
|
|
14886
14929
|
// src/index.ts
|
|
14887
|
-
var CLI_VERSION = "0.2.
|
|
14930
|
+
var CLI_VERSION = "0.2.171";
|
|
14931
|
+
function parseBooleanOption(value) {
|
|
14932
|
+
if (value === "true") return true;
|
|
14933
|
+
if (value === "false") return false;
|
|
14934
|
+
throw new InvalidArgumentError("must be true or false");
|
|
14935
|
+
}
|
|
14888
14936
|
var program = new Command();
|
|
14889
14937
|
program.name("replicas").description("CLI for managing Replicas workspaces").version(CLI_VERSION);
|
|
14890
14938
|
program.command("login").description("Authenticate with your Replicas account").action(async () => {
|
|
@@ -15142,7 +15190,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
|
|
|
15142
15190
|
process.exit(1);
|
|
15143
15191
|
}
|
|
15144
15192
|
});
|
|
15145
|
-
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("--lifecycle <policy>", "Workspace lifecycle: delete_when_done, delete_after_inactivity, default").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle delete_after_inactivity)").option("--disabled", "Create in disabled state").action(async (name, options) => {
|
|
15193
|
+
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("--lifecycle <policy>", "Workspace lifecycle: delete_when_done, delete_after_inactivity, default").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle delete_after_inactivity)").option("--pr-followups", "Allow follow-up actions on matching PRs").option("--disabled", "Create in disabled state").action(async (name, options) => {
|
|
15146
15194
|
try {
|
|
15147
15195
|
await automationCreateCommand(name, {
|
|
15148
15196
|
...options,
|
|
@@ -15157,7 +15205,7 @@ automation.command("create [name]").description("Create a new automation").optio
|
|
|
15157
15205
|
process.exit(1);
|
|
15158
15206
|
}
|
|
15159
15207
|
});
|
|
15160
|
-
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("--environment <environment>", "Environment name or ID").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done, delete_after_inactivity, default").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle delete_after_inactivity)").action(async (id, options) => {
|
|
15208
|
+
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("--environment <environment>", "Environment name or ID").option("--lifecycle <policy>", "Workspace lifecycle: delete_when_done, delete_after_inactivity, default").option("--auto-stop-minutes <minutes>", "Inactivity timeout in minutes (3-1440, requires --lifecycle delete_after_inactivity)").option("--pr-followups <enabled>", "Allow follow-up actions on matching PRs (true/false)", parseBooleanOption).action(async (id, options) => {
|
|
15161
15209
|
try {
|
|
15162
15210
|
await automationEditCommand(id, options);
|
|
15163
15211
|
} catch (error) {
|