replicas-cli 0.2.168 → 0.2.170
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 +71 -7
- 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
|
|
@@ -8152,7 +8152,26 @@ var MODEL_LABELS = {
|
|
|
8152
8152
|
"gpt-5": "GPT-5"
|
|
8153
8153
|
};
|
|
8154
8154
|
|
|
8155
|
+
// ../shared/src/engine/v1.ts
|
|
8156
|
+
var MERGED_MESSAGE_SEPARATOR = "\n\n<!-- replicas:merged -->\n\n";
|
|
8157
|
+
|
|
8155
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
|
+
}
|
|
8156
8175
|
var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
|
|
8157
8176
|
var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
|
|
8158
8177
|
|
|
@@ -9158,9 +9177,21 @@ function parseAutomationTriggered(content) {
|
|
|
9158
9177
|
userPrompt: promptMatch?.[1]?.trim() ?? ""
|
|
9159
9178
|
};
|
|
9160
9179
|
}
|
|
9180
|
+
function parseSingleMessage(content) {
|
|
9181
|
+
return parseCIFailure(content) ?? parseGitHubIssueNew(content) ?? parseGitHubIssueExisting(content) ?? parseGitHubPRNew(content) ?? parseGitHubPRExistingPRReview(content) ?? parseGitHubPRExistingReview(content) ?? parseGitHubPRExistingGeneral(content) ?? parseSlackTask(content) ?? parseLinearIssue(content) ?? parseAutomationTriggered(content) ?? parseInlineDiffComments(content) ?? parsePlanQuote(content) ?? { source: "raw", content };
|
|
9182
|
+
}
|
|
9183
|
+
function parseMerged(content) {
|
|
9184
|
+
if (!content.includes(MERGED_MESSAGE_SEPARATOR)) return null;
|
|
9185
|
+
const chunks = content.split(MERGED_MESSAGE_SEPARATOR).map((chunk) => chunk.trim()).filter((chunk) => chunk.length > 0);
|
|
9186
|
+
if (chunks.length < 2) return null;
|
|
9187
|
+
return {
|
|
9188
|
+
source: "merged",
|
|
9189
|
+
messages: chunks.map((chunk) => parseSingleMessage(chunk))
|
|
9190
|
+
};
|
|
9191
|
+
}
|
|
9161
9192
|
function parseUserMessage(rawContent) {
|
|
9162
9193
|
const content = removeReplicasInstructions(rawContent).trim();
|
|
9163
|
-
return
|
|
9194
|
+
return parseMerged(content) ?? parseSingleMessage(content);
|
|
9164
9195
|
}
|
|
9165
9196
|
|
|
9166
9197
|
// ../shared/src/user-message-parser/source-config.ts
|
|
@@ -9176,7 +9207,8 @@ var SOURCE_CONFIG = {
|
|
|
9176
9207
|
slack_task: { label: "Slack", color: "#BF6CC2" },
|
|
9177
9208
|
automation_triggered: { label: "Automation", color: "#f59e0b" },
|
|
9178
9209
|
plan_quote: { label: "Plan", color: "#66bb6a" },
|
|
9179
|
-
inline_diff_comments: { label: "Diff Comments", color: "#66bb6a" }
|
|
9210
|
+
inline_diff_comments: { label: "Diff Comments", color: "#66bb6a" },
|
|
9211
|
+
merged: { label: "Merged", color: "#a78bfa" }
|
|
9180
9212
|
};
|
|
9181
9213
|
|
|
9182
9214
|
// ../shared/src/placeholder-names.ts
|
|
@@ -9310,6 +9342,7 @@ function createMockWorkspaceRecord(organizationId, name, environmentId) {
|
|
|
9310
9342
|
soft_delete: false,
|
|
9311
9343
|
lifecycle_policy: "default",
|
|
9312
9344
|
auto_stop_minutes: null,
|
|
9345
|
+
config: {},
|
|
9313
9346
|
environment_id: environmentId ?? null
|
|
9314
9347
|
};
|
|
9315
9348
|
}
|
|
@@ -10630,6 +10663,7 @@ function printAutomation(automation2) {
|
|
|
10630
10663
|
const lifecycle = automation2.workspace_lifecycle_policy === "delete_after_inactivity" ? `delete_after_inactivity (${automation2.workspace_auto_stop_minutes ?? 30}m)` : automation2.workspace_lifecycle_policy;
|
|
10631
10664
|
console.log(chalk17.gray(` Lifecycle: ${lifecycle}`));
|
|
10632
10665
|
}
|
|
10666
|
+
console.log(chalk17.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? chalk17.green("managed") : "read-only"}`));
|
|
10633
10667
|
console.log(chalk17.gray(` Created: ${formatDate2(automation2.created_at)}`));
|
|
10634
10668
|
console.log(chalk17.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
|
|
10635
10669
|
console.log();
|
|
@@ -10695,6 +10729,7 @@ Automation: ${automation2.name}
|
|
|
10695
10729
|
if (automation2.workspace_auto_stop_minutes) {
|
|
10696
10730
|
console.log(chalk17.gray(` Auto-stop: ${automation2.workspace_auto_stop_minutes} minutes`));
|
|
10697
10731
|
}
|
|
10732
|
+
console.log(chalk17.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? "managed" : "read-only"}`));
|
|
10698
10733
|
console.log(chalk17.gray(` Created: ${formatDate2(automation2.created_at)}`));
|
|
10699
10734
|
console.log(chalk17.gray(` Updated: ${formatDate2(automation2.updated_at)}`));
|
|
10700
10735
|
console.log();
|
|
@@ -10893,12 +10928,23 @@ async function automationCreateCommand(name, options) {
|
|
|
10893
10928
|
process.exit(1);
|
|
10894
10929
|
}
|
|
10895
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
|
+
}
|
|
10896
10941
|
const body = {
|
|
10897
10942
|
name: automationName,
|
|
10898
10943
|
prompt: automationPrompt,
|
|
10899
10944
|
environment_id: selectedEnvironmentId,
|
|
10900
10945
|
triggers,
|
|
10901
10946
|
enabled: options.enabled !== false,
|
|
10947
|
+
config: workspaceConfigWithPrFollowups(void 0, prFollowups),
|
|
10902
10948
|
...options.lifecycle ? { workspace_lifecycle_policy: options.lifecycle } : {},
|
|
10903
10949
|
...options.autoStopMinutes ? { workspace_auto_stop_minutes: parseInt(options.autoStopMinutes, 10) } : {}
|
|
10904
10950
|
};
|
|
@@ -10946,7 +10992,7 @@ async function automationEditCommand(id, options) {
|
|
|
10946
10992
|
try {
|
|
10947
10993
|
const existing = await orgAuthenticatedFetch(`/v1/automations/${id}`);
|
|
10948
10994
|
const body = {};
|
|
10949
|
-
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;
|
|
10950
10996
|
if (!hasOptions) {
|
|
10951
10997
|
const nameResponse = await prompts4({
|
|
10952
10998
|
type: "text",
|
|
@@ -10975,6 +11021,16 @@ async function automationEditCommand(id, options) {
|
|
|
10975
11021
|
if (enabledResponse.enabled !== void 0 && enabledResponse.enabled !== existing.automation.enabled) {
|
|
10976
11022
|
body.enabled = enabledResponse.enabled;
|
|
10977
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
|
+
}
|
|
10978
11034
|
const editTriggersResponse = await prompts4({
|
|
10979
11035
|
type: "confirm",
|
|
10980
11036
|
name: "edit",
|
|
@@ -10993,6 +11049,9 @@ async function automationEditCommand(id, options) {
|
|
|
10993
11049
|
if (options.enabled !== void 0) {
|
|
10994
11050
|
body.enabled = options.enabled === "true";
|
|
10995
11051
|
}
|
|
11052
|
+
if (options.prFollowups !== void 0) {
|
|
11053
|
+
body.config = workspaceConfigWithPrFollowups(existing.automation.config, options.prFollowups);
|
|
11054
|
+
}
|
|
10996
11055
|
if (options.triggerCron || options.triggerGithub) {
|
|
10997
11056
|
const triggers = [];
|
|
10998
11057
|
if (options.triggerCron) {
|
|
@@ -14868,7 +14927,12 @@ Deleted file ${pathOrId}.
|
|
|
14868
14927
|
}
|
|
14869
14928
|
|
|
14870
14929
|
// src/index.ts
|
|
14871
|
-
var CLI_VERSION = "0.2.
|
|
14930
|
+
var CLI_VERSION = "0.2.170";
|
|
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
|
+
}
|
|
14872
14936
|
var program = new Command();
|
|
14873
14937
|
program.name("replicas").description("CLI for managing Replicas workspaces").version(CLI_VERSION);
|
|
14874
14938
|
program.command("login").description("Authenticate with your Replicas account").action(async () => {
|
|
@@ -15126,7 +15190,7 @@ automation.command("get <id>").description("Get automation details by ID").actio
|
|
|
15126
15190
|
process.exit(1);
|
|
15127
15191
|
}
|
|
15128
15192
|
});
|
|
15129
|
-
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) => {
|
|
15130
15194
|
try {
|
|
15131
15195
|
await automationCreateCommand(name, {
|
|
15132
15196
|
...options,
|
|
@@ -15141,7 +15205,7 @@ automation.command("create [name]").description("Create a new automation").optio
|
|
|
15141
15205
|
process.exit(1);
|
|
15142
15206
|
}
|
|
15143
15207
|
});
|
|
15144
|
-
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) => {
|
|
15145
15209
|
try {
|
|
15146
15210
|
await automationEditCommand(id, options);
|
|
15147
15211
|
} catch (error) {
|