replicas-cli 0.3.440 → 0.3.442
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.cjs +533 -461
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25709,7 +25709,8 @@ Use this when:
|
|
|
25709
25709
|
- The user asks you to manage environments, environment variables, or environment files
|
|
25710
25710
|
- The user asks "what envs / repos / automations do I have?"
|
|
25711
25711
|
- The user asks you to scaffold a \`replicas.json\` / \`replicas.yaml\` in a repo
|
|
25712
|
-
- You need to run a long-lived service (dev server, daemon) \u2014 always use \`replicas service start\` so it survives workspace sleep/wake
|
|
25712
|
+
- You need to run a long-lived service (dev server, daemon) \u2014 always use \`replicas service start\` so it survives workspace sleep/wake
|
|
25713
|
+
- The user asks you to change how their Replicas app looks (theme, colors, accent) \u2014 use \`replicas theme set\` (see *Themes*)`;
|
|
25713
25714
|
REFERENCE12 = `# Replicas (in-workspace CLI)
|
|
25714
25715
|
|
|
25715
25716
|
This guide covers how to take action *with* Replicas itself from inside a Replicas workspace \u2014 managing automations, environments (and their variables/files), repos, previews, and the user's \`replicas.json\` config \u2014 using the pre-installed \`replicas\` CLI.
|
|
@@ -25757,6 +25758,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
|
|
|
25757
25758
|
| \`replicas skills suggest <SKILL.md> --title <text>\` | Suggest saving a lasting user instruction as a learning (an organization skill); the user accepts or dismisses it |
|
|
25758
25759
|
| \`replicas skills suggest --delete <name-or-id>\` | When the user asks you to delete a learning, suggest removing it; the user accepts or dismisses it |
|
|
25759
25760
|
| \`replicas slack thread ...\` | Attach or switch Slack thread routing (covered in \`SLACK.md\`) |
|
|
25761
|
+
| \`replicas theme get\` / \`replicas theme set ...\` | Show or change the web and desktop app theme of the person who wrote in this workspace (see *Themes*) |
|
|
25760
25762
|
|
|
25761
25763
|
\`replicas <command> --help\` is always the source of truth for flags.
|
|
25762
25764
|
|
|
@@ -25780,6 +25782,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
|
|
|
25780
25782
|
| "Ignore Dependabot for this PR automation" | \`replicas automation edit <id> --trigger-github-exclude-users 'dependabot[bot]'\` |
|
|
25781
25783
|
| "Also run this PR automation on every push" | \`replicas automation edit <id> --keep-triggers --trigger-github pull_request.synchronize --trigger-github-repos acme/web\` |
|
|
25782
25784
|
| "What repos are connected?" | \`replicas repos\` |
|
|
25785
|
+
| "Make my Replicas dark / purple / match these colors" | \`replicas theme set ...\` (see *Themes*) |
|
|
25783
25786
|
| "Set up a \`replicas.json\` in this repo" | \`replicas init\` (\`-y\` for YAML) |
|
|
25784
25787
|
|
|
25785
25788
|
## Environments
|
|
@@ -25979,6 +25982,23 @@ Notes:
|
|
|
25979
25982
|
- Logs stream to \`~/.replicas/services/<name>.log\`.
|
|
25980
25983
|
- After starting, verify the service is actually healthy (check \`logs\`, then \`curl\` its port) before telling the user it's up or creating a preview for it.
|
|
25981
25984
|
|
|
25985
|
+
## Themes
|
|
25986
|
+
|
|
25987
|
+
When the user asks you to change how their Replicas app looks, change it for them. It is saved to their account, so their open web and desktop apps repaint on their own, on every computer. The phone app has its own setting and does not follow it.
|
|
25988
|
+
|
|
25989
|
+
\`\`\`bash
|
|
25990
|
+
replicas theme get
|
|
25991
|
+
replicas theme set --theme light
|
|
25992
|
+
replicas theme set --theme dark --color-theme slate
|
|
25993
|
+
replicas theme set --accent purple
|
|
25994
|
+
replicas theme set --accent ff5500
|
|
25995
|
+
replicas theme set --code 0d1117,e6ecf4,ff5500
|
|
25996
|
+
\`\`\`
|
|
25997
|
+
|
|
25998
|
+
A color theme always goes with \`--theme light\` or \`--theme dark\`. An accent is a preset name or any hex color. A theme code is three hex colors: background, text, accent. Write hex colors without the \`#\`, which the shell reads as a comment. \`replicas theme set --help\` lists the names. For a look the presets don't cover, choose the three colors yourself and pass them as \`--code\`; the text has to read clearly on the background, or it is refused.
|
|
25999
|
+
|
|
26000
|
+
It changes the theme of the one person who has written in this workspace, and prints their email. You cannot pick someone else. When several people have written here, or nobody has yet (a workspace started by an automation, another agent, the API or the CLI, until its person sends a message in it), it refuses: tell them they can change their own under **Themes** in the account menu. A workspace created before this command existed answers \`unknown command\`: say the same.
|
|
26001
|
+
|
|
25982
26002
|
## Repositories
|
|
25983
26003
|
|
|
25984
26004
|
Read-only listing of repos connected to the org. Use when the user asks "what repos can I use?", or to validate a \`--repository\` value before passing it to \`environment create\` / \`automation create\`:
|
|
@@ -26616,7 +26636,6 @@ var init_replicas_agent = __esm({
|
|
|
26616
26636
|
"../shared/src/default-skills/replicas-agent/index.ts"() {
|
|
26617
26637
|
"use strict";
|
|
26618
26638
|
init_registry();
|
|
26619
|
-
init_replicas();
|
|
26620
26639
|
init_registry();
|
|
26621
26640
|
}
|
|
26622
26641
|
});
|
|
@@ -38650,7 +38669,7 @@ var CLI_VERSION;
|
|
|
38650
38669
|
var init_cli_version = __esm({
|
|
38651
38670
|
"../shared/src/cli-version.ts"() {
|
|
38652
38671
|
"use strict";
|
|
38653
|
-
CLI_VERSION = "0.3.
|
|
38672
|
+
CLI_VERSION = "0.3.441";
|
|
38654
38673
|
}
|
|
38655
38674
|
});
|
|
38656
38675
|
|
|
@@ -50952,6 +50971,113 @@ var init_logout = __esm({
|
|
|
50952
50971
|
}
|
|
50953
50972
|
});
|
|
50954
50973
|
|
|
50974
|
+
// ../shared/src/currency.ts
|
|
50975
|
+
function formatCents(cents) {
|
|
50976
|
+
return `$${(cents / 100).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
50977
|
+
}
|
|
50978
|
+
var init_currency = __esm({
|
|
50979
|
+
"../shared/src/currency.ts"() {
|
|
50980
|
+
"use strict";
|
|
50981
|
+
}
|
|
50982
|
+
});
|
|
50983
|
+
|
|
50984
|
+
// src/lib/command-utils.ts
|
|
50985
|
+
function formatDate(dateString) {
|
|
50986
|
+
return new Date(dateString).toLocaleString();
|
|
50987
|
+
}
|
|
50988
|
+
function printReplicaActivity(activity) {
|
|
50989
|
+
console.log(import_chalk6.default.gray(` Agent: ${activity.state.replaceAll("_", " ")}${activity.current_step ? ` \xB7 ${activity.current_step}` : ""}`));
|
|
50990
|
+
if (activity.last_agent_message) console.log(import_chalk6.default.gray(` Last message: ${activity.last_agent_message}`));
|
|
50991
|
+
}
|
|
50992
|
+
function ensureOrgApiAuthenticated() {
|
|
50993
|
+
if (!canCallOrgApi()) {
|
|
50994
|
+
throw new Error('Not logged in. Run "replicas login" or "replicas login --api-key".');
|
|
50995
|
+
}
|
|
50996
|
+
}
|
|
50997
|
+
function resolveByNameOrId(input2, items) {
|
|
50998
|
+
return items.find((item) => item.id === input2 || item.name === input2);
|
|
50999
|
+
}
|
|
51000
|
+
function parseKeyValuePairs(pairs) {
|
|
51001
|
+
return Object.fromEntries(pairs.map((pair) => {
|
|
51002
|
+
const separator = pair.indexOf("=");
|
|
51003
|
+
if (separator < 1) throw new Error(`Expected key=value, got: ${pair}`);
|
|
51004
|
+
return [pair.slice(0, separator), pair.slice(separator + 1)];
|
|
51005
|
+
}));
|
|
51006
|
+
}
|
|
51007
|
+
async function confirmAction(message2) {
|
|
51008
|
+
if (!isInteractive()) throw new Error(`${message2} Pass -f to confirm without a terminal.`);
|
|
51009
|
+
const { confirm } = await (0, import_prompts8.default)({ type: "confirm", name: "confirm", message: message2, initial: false });
|
|
51010
|
+
if (!confirm) console.log(import_chalk6.default.yellow("\nCancelled."));
|
|
51011
|
+
return Boolean(confirm);
|
|
51012
|
+
}
|
|
51013
|
+
function parseRequestTimeout(value) {
|
|
51014
|
+
if (!value) return VARIABLE_REQUEST_WAIT.defaultMs;
|
|
51015
|
+
const timeout = /^(\d+)(s|m)?$/.exec(value.trim());
|
|
51016
|
+
if (!timeout) throw new Error(`Invalid timeout "${value}". Use seconds or minutes, for example 90s or 10m`);
|
|
51017
|
+
return Math.min(Math.max(Number(timeout[1]) * (timeout[2] === "m" ? 6e4 : 1e3), VARIABLE_REQUEST_WAIT.pollMs), VARIABLE_REQUEST_WAIT.maxMs);
|
|
51018
|
+
}
|
|
51019
|
+
async function waitForUser(params) {
|
|
51020
|
+
const { timeoutMs } = params;
|
|
51021
|
+
if (!isJsonMode()) console.log(import_chalk6.default.gray(`
|
|
51022
|
+
${params.asked} Waiting up to ${timeoutMs >= 6e4 ? `${Math.round(timeoutMs / 6e4)} minute(s)` : `${timeoutMs / 1e3} seconds`}\u2026`));
|
|
51023
|
+
let value = params.initial;
|
|
51024
|
+
const deadline = Date.now() + timeoutMs;
|
|
51025
|
+
while (!params.settled(value) && Date.now() < deadline) {
|
|
51026
|
+
await new Promise((resolve4) => setTimeout(resolve4, VARIABLE_REQUEST_WAIT.pollMs));
|
|
51027
|
+
value = await params.poll(true);
|
|
51028
|
+
}
|
|
51029
|
+
return params.settled(value) ? value : params.poll(false);
|
|
51030
|
+
}
|
|
51031
|
+
var import_chalk6, import_prompts8;
|
|
51032
|
+
var init_command_utils = __esm({
|
|
51033
|
+
"src/lib/command-utils.ts"() {
|
|
51034
|
+
"use strict";
|
|
51035
|
+
import_chalk6 = __toESM(require("chalk"));
|
|
51036
|
+
init_src();
|
|
51037
|
+
import_prompts8 = __toESM(require("prompts"));
|
|
51038
|
+
init_config();
|
|
51039
|
+
init_output();
|
|
51040
|
+
}
|
|
51041
|
+
});
|
|
51042
|
+
|
|
51043
|
+
// src/commands/billing.ts
|
|
51044
|
+
async function billingCommand() {
|
|
51045
|
+
output2(await orgAuthenticatedFetch("/v1/organization/billing/balance"), ({ plan, period_start, period_end, credit, limit, blocked }) => {
|
|
51046
|
+
console.log(brand.bold("\n Billing\n"));
|
|
51047
|
+
field("Plan", plan);
|
|
51048
|
+
field("Period", `${formatDate(period_start)} \u2013 ${formatDate(period_end)}`);
|
|
51049
|
+
if (credit) {
|
|
51050
|
+
field("Balance", `${import_chalk7.default.bold(formatCents(credit.remaining_cents))} left, ${formatCents(credit.used_cents)} used of ${formatCents(credit.total_cents)}`);
|
|
51051
|
+
if (credit.one_time_cents) field("Credit", `${formatCents(credit.plan_cents)} plan + ${formatCents(credit.one_time_cents)} one-time`);
|
|
51052
|
+
if (credit.overage_cents) field("Overage", formatCents(credit.overage_cents));
|
|
51053
|
+
}
|
|
51054
|
+
field("Limit", limit ? `${formatCents(limit.remaining_cents)} left before workspaces stop (${limit.kind === "credit" ? "credit" : "usage limit"} ${formatCents(limit.limit_cents)})` : "none");
|
|
51055
|
+
if (blocked) field("Blocked", import_chalk7.default.red(blocked.message));
|
|
51056
|
+
console.log();
|
|
51057
|
+
});
|
|
51058
|
+
}
|
|
51059
|
+
async function billingUsageCommand(options) {
|
|
51060
|
+
const query = new URLSearchParams(Object.entries(options).filter((entry) => !!entry[1]));
|
|
51061
|
+
const usage = await orgAuthenticatedFetch(`/v1/organization/billing/usage${query.size ? `?${query}` : ""}`);
|
|
51062
|
+
output2(usage, ({ points, sources }) => {
|
|
51063
|
+
for (const point of points) console.log(`${point.bucket} ${formatCents(point.cents)}`);
|
|
51064
|
+
console.log(import_chalk7.default.gray(`
|
|
51065
|
+
${sources.map((source) => `${source.source} ${formatCents(source.cents)}`).join(", ") || "No usage"}`));
|
|
51066
|
+
});
|
|
51067
|
+
}
|
|
51068
|
+
var import_chalk7;
|
|
51069
|
+
var init_billing2 = __esm({
|
|
51070
|
+
"src/commands/billing.ts"() {
|
|
51071
|
+
"use strict";
|
|
51072
|
+
import_chalk7 = __toESM(require("chalk"));
|
|
51073
|
+
init_currency();
|
|
51074
|
+
init_api2();
|
|
51075
|
+
init_command_utils();
|
|
51076
|
+
init_oauth_flow_ui();
|
|
51077
|
+
init_output();
|
|
51078
|
+
}
|
|
51079
|
+
});
|
|
51080
|
+
|
|
50955
51081
|
// src/commands/identity.ts
|
|
50956
51082
|
async function fetchToken(audience, awsSourceIdentity) {
|
|
50957
51083
|
let response;
|
|
@@ -51000,12 +51126,12 @@ async function identityTokenCommand(options) {
|
|
|
51000
51126
|
}
|
|
51001
51127
|
async function identityExecCommand(command, options) {
|
|
51002
51128
|
if (command.length === 0) {
|
|
51003
|
-
console.error(
|
|
51129
|
+
console.error(import_chalk8.default.red("Provide a command to run: replicas identity exec -- <command>"));
|
|
51004
51130
|
process.exit(1);
|
|
51005
51131
|
}
|
|
51006
51132
|
const tokenResult = await fetchToken(options.audience);
|
|
51007
51133
|
if (!tokenResult.ok) {
|
|
51008
|
-
console.error(
|
|
51134
|
+
console.error(import_chalk8.default.red(tokenResult.error.message));
|
|
51009
51135
|
process.exitCode = 1;
|
|
51010
51136
|
return;
|
|
51011
51137
|
}
|
|
@@ -51029,7 +51155,7 @@ async function identityAwsCredentialsCommand(options) {
|
|
|
51029
51155
|
}
|
|
51030
51156
|
const result = await fetchToken(options.audience, options.sourceIdentity);
|
|
51031
51157
|
if (!result.ok) {
|
|
51032
|
-
console.error(
|
|
51158
|
+
console.error(import_chalk8.default.red(result.error.message));
|
|
51033
51159
|
process.exitCode = 1;
|
|
51034
51160
|
return;
|
|
51035
51161
|
}
|
|
@@ -51076,7 +51202,7 @@ async function identityAwsCredentialsCommand(options) {
|
|
|
51076
51202
|
(0, import_node_fs.rmSync)(directory, { recursive: true, force: true });
|
|
51077
51203
|
}
|
|
51078
51204
|
}
|
|
51079
|
-
var import_node_crypto, import_node_fs, import_node_child_process, import_node_os, import_node_path,
|
|
51205
|
+
var import_node_crypto, import_node_fs, import_node_child_process, import_node_os, import_node_path, import_chalk8;
|
|
51080
51206
|
var init_identity = __esm({
|
|
51081
51207
|
"src/commands/identity.ts"() {
|
|
51082
51208
|
"use strict";
|
|
@@ -51085,71 +51211,12 @@ var init_identity = __esm({
|
|
|
51085
51211
|
import_node_child_process = require("child_process");
|
|
51086
51212
|
import_node_os = require("os");
|
|
51087
51213
|
import_node_path = require("path");
|
|
51088
|
-
|
|
51214
|
+
import_chalk8 = __toESM(require("chalk"));
|
|
51089
51215
|
init_output();
|
|
51090
51216
|
init_src();
|
|
51091
51217
|
}
|
|
51092
51218
|
});
|
|
51093
51219
|
|
|
51094
|
-
// src/lib/command-utils.ts
|
|
51095
|
-
function formatDate(dateString) {
|
|
51096
|
-
return new Date(dateString).toLocaleString();
|
|
51097
|
-
}
|
|
51098
|
-
function printReplicaActivity(activity) {
|
|
51099
|
-
console.log(import_chalk7.default.gray(` Agent: ${activity.state.replaceAll("_", " ")}${activity.current_step ? ` \xB7 ${activity.current_step}` : ""}`));
|
|
51100
|
-
if (activity.last_agent_message) console.log(import_chalk7.default.gray(` Last message: ${activity.last_agent_message}`));
|
|
51101
|
-
}
|
|
51102
|
-
function ensureOrgApiAuthenticated() {
|
|
51103
|
-
if (!canCallOrgApi()) {
|
|
51104
|
-
throw new Error('Not logged in. Run "replicas login" or "replicas login --api-key".');
|
|
51105
|
-
}
|
|
51106
|
-
}
|
|
51107
|
-
function resolveByNameOrId(input2, items) {
|
|
51108
|
-
return items.find((item) => item.id === input2 || item.name === input2);
|
|
51109
|
-
}
|
|
51110
|
-
function parseKeyValuePairs(pairs) {
|
|
51111
|
-
return Object.fromEntries(pairs.map((pair) => {
|
|
51112
|
-
const separator = pair.indexOf("=");
|
|
51113
|
-
if (separator < 1) throw new Error(`Expected key=value, got: ${pair}`);
|
|
51114
|
-
return [pair.slice(0, separator), pair.slice(separator + 1)];
|
|
51115
|
-
}));
|
|
51116
|
-
}
|
|
51117
|
-
async function confirmAction(message2) {
|
|
51118
|
-
if (!isInteractive()) throw new Error(`${message2} Pass -f to confirm without a terminal.`);
|
|
51119
|
-
const { confirm } = await (0, import_prompts8.default)({ type: "confirm", name: "confirm", message: message2, initial: false });
|
|
51120
|
-
if (!confirm) console.log(import_chalk7.default.yellow("\nCancelled."));
|
|
51121
|
-
return Boolean(confirm);
|
|
51122
|
-
}
|
|
51123
|
-
function parseRequestTimeout(value) {
|
|
51124
|
-
if (!value) return VARIABLE_REQUEST_WAIT.defaultMs;
|
|
51125
|
-
const timeout = /^(\d+)(s|m)?$/.exec(value.trim());
|
|
51126
|
-
if (!timeout) throw new Error(`Invalid timeout "${value}". Use seconds or minutes, for example 90s or 10m`);
|
|
51127
|
-
return Math.min(Math.max(Number(timeout[1]) * (timeout[2] === "m" ? 6e4 : 1e3), VARIABLE_REQUEST_WAIT.pollMs), VARIABLE_REQUEST_WAIT.maxMs);
|
|
51128
|
-
}
|
|
51129
|
-
async function waitForUser(params) {
|
|
51130
|
-
const { timeoutMs } = params;
|
|
51131
|
-
if (!isJsonMode()) console.log(import_chalk7.default.gray(`
|
|
51132
|
-
${params.asked} Waiting up to ${timeoutMs >= 6e4 ? `${Math.round(timeoutMs / 6e4)} minute(s)` : `${timeoutMs / 1e3} seconds`}\u2026`));
|
|
51133
|
-
let value = params.initial;
|
|
51134
|
-
const deadline = Date.now() + timeoutMs;
|
|
51135
|
-
while (!params.settled(value) && Date.now() < deadline) {
|
|
51136
|
-
await new Promise((resolve4) => setTimeout(resolve4, VARIABLE_REQUEST_WAIT.pollMs));
|
|
51137
|
-
value = await params.poll(true);
|
|
51138
|
-
}
|
|
51139
|
-
return params.settled(value) ? value : params.poll(false);
|
|
51140
|
-
}
|
|
51141
|
-
var import_chalk7, import_prompts8;
|
|
51142
|
-
var init_command_utils = __esm({
|
|
51143
|
-
"src/lib/command-utils.ts"() {
|
|
51144
|
-
"use strict";
|
|
51145
|
-
import_chalk7 = __toESM(require("chalk"));
|
|
51146
|
-
init_src();
|
|
51147
|
-
import_prompts8 = __toESM(require("prompts"));
|
|
51148
|
-
init_config();
|
|
51149
|
-
init_output();
|
|
51150
|
-
}
|
|
51151
|
-
});
|
|
51152
|
-
|
|
51153
51220
|
// src/lib/ssh.ts
|
|
51154
51221
|
function buildSSHArgs(token, host, proxyCommand, localForward) {
|
|
51155
51222
|
return [
|
|
@@ -51248,7 +51315,7 @@ async function resolveWorkspaceRecord(workspaceName) {
|
|
|
51248
51315
|
const exactWorkspace = await fetchWorkspaceById(workspaceName);
|
|
51249
51316
|
if (exactWorkspace) return exactWorkspace;
|
|
51250
51317
|
}
|
|
51251
|
-
console.log(
|
|
51318
|
+
console.log(import_chalk9.default.blue(workspaceName ? `
|
|
51252
51319
|
Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
|
|
51253
51320
|
const params = new URLSearchParams({ limit: "100" });
|
|
51254
51321
|
if (workspaceName) params.set("name", workspaceName);
|
|
@@ -51267,7 +51334,7 @@ Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
|
|
|
51267
51334
|
selectedWorkspace = workspaces[0];
|
|
51268
51335
|
} else {
|
|
51269
51336
|
if (workspaceName) {
|
|
51270
|
-
console.log(
|
|
51337
|
+
console.log(import_chalk9.default.yellow(`
|
|
51271
51338
|
Found ${workspaces.length} workspaces matching "${workspaceName}":`));
|
|
51272
51339
|
}
|
|
51273
51340
|
const selectResponse = await ask({
|
|
@@ -51289,9 +51356,9 @@ Found ${workspaces.length} workspaces matching "${workspaceName}":`));
|
|
|
51289
51356
|
}
|
|
51290
51357
|
selectedWorkspace = selected;
|
|
51291
51358
|
}
|
|
51292
|
-
console.log(
|
|
51359
|
+
console.log(import_chalk9.default.green(`
|
|
51293
51360
|
\u2713 Selected workspace: ${selectedWorkspace.name}`));
|
|
51294
|
-
console.log(
|
|
51361
|
+
console.log(import_chalk9.default.gray(` Status: ${selectedWorkspace.status || "unknown"}`));
|
|
51295
51362
|
return selectedWorkspace;
|
|
51296
51363
|
}
|
|
51297
51364
|
async function prepareWorkspaceConnection(workspaceName) {
|
|
@@ -51301,12 +51368,12 @@ async function prepareWorkspaceConnection(workspaceName) {
|
|
|
51301
51368
|
`Workspace is currently ${selectedWorkspace.status}. Wake it at ${DEFAULT_WEB_APP_URL}`
|
|
51302
51369
|
);
|
|
51303
51370
|
}
|
|
51304
|
-
console.log(
|
|
51371
|
+
console.log(import_chalk9.default.blue("\nRequesting SSH access token..."));
|
|
51305
51372
|
const tokenResponse = await orgAuthenticatedFetch(
|
|
51306
51373
|
`/v1/workspaces/${selectedWorkspace.id}/ssh-token`,
|
|
51307
51374
|
{ method: "POST" }
|
|
51308
51375
|
);
|
|
51309
|
-
console.log(
|
|
51376
|
+
console.log(import_chalk9.default.green("\u2713 SSH token received"));
|
|
51310
51377
|
let repoName = null;
|
|
51311
51378
|
if (isInsideGitRepo()) {
|
|
51312
51379
|
try {
|
|
@@ -51322,11 +51389,11 @@ async function prepareWorkspaceConnection(workspaceName) {
|
|
|
51322
51389
|
repoName
|
|
51323
51390
|
};
|
|
51324
51391
|
}
|
|
51325
|
-
var
|
|
51392
|
+
var import_chalk9;
|
|
51326
51393
|
var init_workspace_connection = __esm({
|
|
51327
51394
|
"src/lib/workspace-connection.ts"() {
|
|
51328
51395
|
"use strict";
|
|
51329
|
-
|
|
51396
|
+
import_chalk9 = __toESM(require("chalk"));
|
|
51330
51397
|
init_src();
|
|
51331
51398
|
init_config();
|
|
51332
51399
|
init_api2();
|
|
@@ -51339,19 +51406,19 @@ var init_workspace_connection = __esm({
|
|
|
51339
51406
|
async function connectCommand(workspaceName) {
|
|
51340
51407
|
ensureOrgApiAuthenticated();
|
|
51341
51408
|
const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
|
|
51342
|
-
console.log(
|
|
51409
|
+
console.log(import_chalk10.default.blue(`
|
|
51343
51410
|
Connecting to ${workspace.name}...`));
|
|
51344
51411
|
const sshCommand = `ssh ${sshToken}@${sshHost}`;
|
|
51345
|
-
console.log(
|
|
51346
|
-
console.log(
|
|
51412
|
+
console.log(import_chalk10.default.gray(`SSH command: ${sshCommand}`));
|
|
51413
|
+
console.log(import_chalk10.default.gray("\nPress Ctrl+D to disconnect.\n"));
|
|
51347
51414
|
await connectSSH(sshToken, sshHost, sshProxyCommand);
|
|
51348
|
-
console.log(
|
|
51415
|
+
console.log(import_chalk10.default.green("\n\u2713 Disconnected from workspace.\n"));
|
|
51349
51416
|
}
|
|
51350
|
-
var
|
|
51417
|
+
var import_chalk10;
|
|
51351
51418
|
var init_connect = __esm({
|
|
51352
51419
|
"src/commands/connect.ts"() {
|
|
51353
51420
|
"use strict";
|
|
51354
|
-
|
|
51421
|
+
import_chalk10 = __toESM(require("chalk"));
|
|
51355
51422
|
init_command_utils();
|
|
51356
51423
|
init_ssh();
|
|
51357
51424
|
init_workspace_connection();
|
|
@@ -51460,22 +51527,22 @@ async function codeCommand(workspaceName) {
|
|
|
51460
51527
|
}
|
|
51461
51528
|
const { workspace, sshToken, sshHost, sshProxyCommand, repoName } = await prepareWorkspaceConnection(workspaceName);
|
|
51462
51529
|
const hostAlias = getWorkspaceHostAlias(workspace.name);
|
|
51463
|
-
console.log(
|
|
51530
|
+
console.log(import_chalk11.default.blue("\nConfiguring SSH connection..."));
|
|
51464
51531
|
addOrUpdateSSHConfigEntry({
|
|
51465
51532
|
host: hostAlias,
|
|
51466
51533
|
hostname: sshHost,
|
|
51467
51534
|
user: sshToken,
|
|
51468
51535
|
proxyCommand: sshProxyCommand
|
|
51469
51536
|
});
|
|
51470
|
-
console.log(
|
|
51537
|
+
console.log(import_chalk11.default.green(`\u2713 SSH config entry created: ${hostAlias}`));
|
|
51471
51538
|
const paths = SANDBOX_PATHS;
|
|
51472
51539
|
const remotePath = repoName ? `${paths.WORKSPACES_DIR}/${repoName}` : paths.HOME_DIR;
|
|
51473
51540
|
const ideCommand = getIdeCommand();
|
|
51474
51541
|
const fullCommand = `${ideCommand} --remote ssh-remote+${hostAlias} ${remotePath}`;
|
|
51475
|
-
console.log(
|
|
51542
|
+
console.log(import_chalk11.default.blue(`
|
|
51476
51543
|
Opening ${ideCommand} for workspace ${workspace.name}...`));
|
|
51477
|
-
console.log(
|
|
51478
|
-
console.log(
|
|
51544
|
+
console.log(import_chalk11.default.gray(`Command: ${fullCommand}`));
|
|
51545
|
+
console.log(import_chalk11.default.yellow(`
|
|
51479
51546
|
Note: SSH tokens expire after 3 hours. Run this command again to refresh.`));
|
|
51480
51547
|
const ide = (0, import_child_process3.spawn)(ideCommand, [
|
|
51481
51548
|
"--remote",
|
|
@@ -51486,26 +51553,26 @@ Note: SSH tokens expire after 3 hours. Run this command again to refresh.`));
|
|
|
51486
51553
|
detached: false
|
|
51487
51554
|
});
|
|
51488
51555
|
ide.on("error", (error62) => {
|
|
51489
|
-
console.error(
|
|
51556
|
+
console.error(import_chalk11.default.red(`
|
|
51490
51557
|
Failed to launch ${ideCommand}: ${error62.message}`));
|
|
51491
|
-
console.log(
|
|
51558
|
+
console.log(import_chalk11.default.yellow(`
|
|
51492
51559
|
Make sure ${ideCommand} is installed and available in your PATH.`));
|
|
51493
|
-
console.log(
|
|
51560
|
+
console.log(import_chalk11.default.gray(`You can configure a different IDE with: replicas config set ide <command>`));
|
|
51494
51561
|
process.exit(1);
|
|
51495
51562
|
});
|
|
51496
51563
|
ide.on("close", (code) => {
|
|
51497
51564
|
if (code === 0) {
|
|
51498
|
-
console.log(
|
|
51565
|
+
console.log(import_chalk11.default.green(`
|
|
51499
51566
|
\u2713 ${ideCommand} closed successfully.
|
|
51500
51567
|
`));
|
|
51501
51568
|
}
|
|
51502
51569
|
});
|
|
51503
51570
|
}
|
|
51504
|
-
var
|
|
51571
|
+
var import_chalk11, import_child_process3;
|
|
51505
51572
|
var init_code = __esm({
|
|
51506
51573
|
"src/commands/code.ts"() {
|
|
51507
51574
|
"use strict";
|
|
51508
|
-
|
|
51575
|
+
import_chalk11 = __toESM(require("chalk"));
|
|
51509
51576
|
import_child_process3 = require("child_process");
|
|
51510
51577
|
init_src();
|
|
51511
51578
|
init_config();
|
|
@@ -51522,16 +51589,16 @@ async function tunnelCommand(workspaceName, options) {
|
|
|
51522
51589
|
const remotePort = parsePort(options.port);
|
|
51523
51590
|
const localPort = options.localPort ? parsePort(options.localPort) : remotePort;
|
|
51524
51591
|
const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
|
|
51525
|
-
console.log(
|
|
51592
|
+
console.log(import_chalk12.default.green(`
|
|
51526
51593
|
\u2713 Forwarding localhost:${localPort} to ${workspace.name}:${remotePort}`));
|
|
51527
|
-
console.log(
|
|
51594
|
+
console.log(import_chalk12.default.gray(" Press Ctrl+C to stop.\n"));
|
|
51528
51595
|
await connectSSH(sshToken, sshHost, sshProxyCommand, { localPort, remotePort });
|
|
51529
51596
|
}
|
|
51530
|
-
var
|
|
51597
|
+
var import_chalk12;
|
|
51531
51598
|
var init_tunnel = __esm({
|
|
51532
51599
|
"src/commands/tunnel.ts"() {
|
|
51533
51600
|
"use strict";
|
|
51534
|
-
|
|
51601
|
+
import_chalk12 = __toESM(require("chalk"));
|
|
51535
51602
|
init_command_utils();
|
|
51536
51603
|
init_port();
|
|
51537
51604
|
init_ssh();
|
|
@@ -51545,8 +51612,8 @@ async function orgCommand() {
|
|
|
51545
51612
|
const { organization } = await orgAuthenticatedFetch("/v1/whoami");
|
|
51546
51613
|
output2({ organization }, () => {
|
|
51547
51614
|
console.log(brand.bold("\n Active organization\n"));
|
|
51548
|
-
field("Organization",
|
|
51549
|
-
console.log(
|
|
51615
|
+
field("Organization", import_chalk13.default.bold(organization.name));
|
|
51616
|
+
console.log(import_chalk13.default.gray("\n Fixed by your API key. Use a key from another organization to switch.\n"));
|
|
51550
51617
|
});
|
|
51551
51618
|
return;
|
|
51552
51619
|
}
|
|
@@ -51555,8 +51622,8 @@ async function orgCommand() {
|
|
|
51555
51622
|
const organizations = await fetchOrganizations();
|
|
51556
51623
|
if (!currentOrgId) {
|
|
51557
51624
|
output2({ organization: null }, () => {
|
|
51558
|
-
console.log(
|
|
51559
|
-
console.log(
|
|
51625
|
+
console.log(import_chalk13.default.yellow("\n No organization selected."));
|
|
51626
|
+
console.log(import_chalk13.default.gray(' Run "replicas org switch" to select one.\n'));
|
|
51560
51627
|
});
|
|
51561
51628
|
return;
|
|
51562
51629
|
}
|
|
@@ -51564,8 +51631,8 @@ async function orgCommand() {
|
|
|
51564
51631
|
if (!currentOrg) {
|
|
51565
51632
|
clearOrganizationId();
|
|
51566
51633
|
output2({ organization: null }, () => {
|
|
51567
|
-
console.log(
|
|
51568
|
-
console.log(
|
|
51634
|
+
console.log(import_chalk13.default.yellow("\n The selected organization is no longer available to you."));
|
|
51635
|
+
console.log(import_chalk13.default.gray(' Run "replicas org switch" to select another.\n'));
|
|
51569
51636
|
});
|
|
51570
51637
|
return;
|
|
51571
51638
|
}
|
|
@@ -51578,7 +51645,7 @@ async function orgCommand() {
|
|
|
51578
51645
|
renderIdentity({ account, role, organizationName: currentOrg.name });
|
|
51579
51646
|
if (organizations.length > 1) {
|
|
51580
51647
|
console.log(
|
|
51581
|
-
|
|
51648
|
+
import_chalk13.default.gray(`
|
|
51582
51649
|
${organizations.length} organizations available. "replicas org switch" to change.`)
|
|
51583
51650
|
);
|
|
51584
51651
|
}
|
|
@@ -51601,7 +51668,7 @@ async function orgSwitchCommand() {
|
|
|
51601
51668
|
if (organizations.length > 1) {
|
|
51602
51669
|
const chosen = await promptForOrganization(organizations, currentOrgId);
|
|
51603
51670
|
if (!chosen) {
|
|
51604
|
-
console.log(
|
|
51671
|
+
console.log(import_chalk13.default.yellow("\n Cancelled. The active organization is unchanged.\n"));
|
|
51605
51672
|
return;
|
|
51606
51673
|
}
|
|
51607
51674
|
selectedId = chosen.id;
|
|
@@ -51626,11 +51693,11 @@ async function orgMembersCommand() {
|
|
|
51626
51693
|
}
|
|
51627
51694
|
});
|
|
51628
51695
|
}
|
|
51629
|
-
var
|
|
51696
|
+
var import_chalk13, NOT_LOGGED_IN;
|
|
51630
51697
|
var init_org = __esm({
|
|
51631
51698
|
"src/commands/org.ts"() {
|
|
51632
51699
|
"use strict";
|
|
51633
|
-
|
|
51700
|
+
import_chalk13 = __toESM(require("chalk"));
|
|
51634
51701
|
init_api2();
|
|
51635
51702
|
init_command_utils();
|
|
51636
51703
|
init_oauth_flow_ui();
|
|
@@ -51649,7 +51716,7 @@ function assertKnownKey(key) {
|
|
|
51649
51716
|
async function configGetCommand(key) {
|
|
51650
51717
|
ensureOrgApiAuthenticated();
|
|
51651
51718
|
assertKnownKey(key);
|
|
51652
|
-
output2({ ide: getIdeCommand() }, ({ ide }) => console.log(
|
|
51719
|
+
output2({ ide: getIdeCommand() }, ({ ide }) => console.log(import_chalk14.default.green(`
|
|
51653
51720
|
IDE command: ${ide}
|
|
51654
51721
|
`)));
|
|
51655
51722
|
}
|
|
@@ -51657,7 +51724,7 @@ async function configSetCommand(key, value) {
|
|
|
51657
51724
|
ensureOrgApiAuthenticated();
|
|
51658
51725
|
assertKnownKey(key);
|
|
51659
51726
|
setIdeCommand(value);
|
|
51660
|
-
output2({ ide: value }, () => console.log(
|
|
51727
|
+
output2({ ide: value }, () => console.log(import_chalk14.default.green(`
|
|
51661
51728
|
\u2713 IDE command set to: ${value}
|
|
51662
51729
|
`)));
|
|
51663
51730
|
}
|
|
@@ -51666,17 +51733,17 @@ async function configListCommand() {
|
|
|
51666
51733
|
const config3 = readConfig();
|
|
51667
51734
|
if (!config3) throw new Error("No config found. Please login first.");
|
|
51668
51735
|
output2({ organization_id: config3.organization_id ?? null, ide: config3.ide_command ?? null }, () => {
|
|
51669
|
-
console.log(
|
|
51670
|
-
console.log(
|
|
51671
|
-
console.log(
|
|
51736
|
+
console.log(import_chalk14.default.green("\nCurrent configuration:"));
|
|
51737
|
+
console.log(import_chalk14.default.gray(` Organization ID: ${config3.organization_id || (config3.api_key ? "(set by API key)" : "(not set)")}`));
|
|
51738
|
+
console.log(import_chalk14.default.gray(` IDE command: ${config3.ide_command || "code (default)"}`));
|
|
51672
51739
|
console.log();
|
|
51673
51740
|
});
|
|
51674
51741
|
}
|
|
51675
|
-
var
|
|
51742
|
+
var import_chalk14;
|
|
51676
51743
|
var init_config2 = __esm({
|
|
51677
51744
|
"src/commands/config.ts"() {
|
|
51678
51745
|
"use strict";
|
|
51679
|
-
|
|
51746
|
+
import_chalk14 = __toESM(require("chalk"));
|
|
51680
51747
|
init_config();
|
|
51681
51748
|
init_command_utils();
|
|
51682
51749
|
init_output();
|
|
@@ -51862,11 +51929,11 @@ async function withAuthRecovery(operation, afterReauthentication) {
|
|
|
51862
51929
|
throw error62;
|
|
51863
51930
|
}
|
|
51864
51931
|
const message2 = error62 instanceof NotAuthenticatedError ? "You're not signed in to Replicas. Signing in..." : "Your Replicas session expired. Re-authenticating...";
|
|
51865
|
-
console.log(
|
|
51932
|
+
console.log(import_chalk15.default.yellow(`
|
|
51866
51933
|
${message2}`));
|
|
51867
51934
|
await loginCommand();
|
|
51868
51935
|
await afterReauthentication?.();
|
|
51869
|
-
console.log(
|
|
51936
|
+
console.log(import_chalk15.default.gray(" Retrying..."));
|
|
51870
51937
|
return { result: await operation(), reauthenticated: true };
|
|
51871
51938
|
}
|
|
51872
51939
|
}
|
|
@@ -51942,12 +52009,12 @@ async function runCredentialAuthFlow(options, flow) {
|
|
|
51942
52009
|
return completionUrl.toString();
|
|
51943
52010
|
});
|
|
51944
52011
|
}
|
|
51945
|
-
var
|
|
52012
|
+
var import_chalk15, UPLOAD_STEPS;
|
|
51946
52013
|
var init_credential_upload = __esm({
|
|
51947
52014
|
"src/lib/credential-upload.ts"() {
|
|
51948
52015
|
"use strict";
|
|
51949
52016
|
init_urls();
|
|
51950
|
-
|
|
52017
|
+
import_chalk15 = __toESM(require("chalk"));
|
|
51951
52018
|
init_api2();
|
|
51952
52019
|
init_auth();
|
|
51953
52020
|
init_oauth_flow_ui();
|
|
@@ -52015,7 +52082,7 @@ async function promptForAuthorizationCode() {
|
|
|
52015
52082
|
const rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
52016
52083
|
return new Promise((resolve4) => {
|
|
52017
52084
|
rl.on("close", () => resolve4(""));
|
|
52018
|
-
rl.question(
|
|
52085
|
+
rl.question(import_chalk16.default.gray(" Paste code here: "), (answer) => {
|
|
52019
52086
|
resolve4(answer.trim());
|
|
52020
52087
|
rl.close();
|
|
52021
52088
|
});
|
|
@@ -52091,12 +52158,12 @@ async function runClaudeOAuthFlow(totalSteps) {
|
|
|
52091
52158
|
}
|
|
52092
52159
|
return exchangeCodeForTokens2(code, returnedState, state, pkce.codeVerifier);
|
|
52093
52160
|
}
|
|
52094
|
-
var import_readline,
|
|
52161
|
+
var import_readline, import_chalk16, DEFAULT_CLIENT_ID, CLAUDE_CLIENT_ID, AUTHORIZATION_ENDPOINT2, TOKEN_ENDPOINT2, REDIRECT_URI, SCOPES;
|
|
52095
52162
|
var init_claude_oauth = __esm({
|
|
52096
52163
|
"src/lib/claude-oauth.ts"() {
|
|
52097
52164
|
"use strict";
|
|
52098
52165
|
import_readline = __toESM(require("readline"));
|
|
52099
|
-
|
|
52166
|
+
import_chalk16 = __toESM(require("chalk"));
|
|
52100
52167
|
init_oauth_flow_ui();
|
|
52101
52168
|
init_output();
|
|
52102
52169
|
init_pkce();
|
|
@@ -52287,27 +52354,27 @@ function initCommand(options) {
|
|
|
52287
52354
|
}
|
|
52288
52355
|
const higherPriority = REPLICAS_CONFIG_FILENAMES.slice(0, REPLICAS_CONFIG_FILENAMES.indexOf(targetFilename)).filter((filename) => import_fs3.default.existsSync(import_path4.default.join(process.cwd(), filename)));
|
|
52289
52356
|
output2({ path: configPath, shadowed_by: higherPriority }, () => {
|
|
52290
|
-
console.log(
|
|
52357
|
+
console.log(import_chalk17.default.green(`\u2713 Created ${targetFilename}`));
|
|
52291
52358
|
for (const filename of higherPriority) {
|
|
52292
52359
|
console.log("");
|
|
52293
|
-
console.log(
|
|
52294
|
-
console.log(
|
|
52360
|
+
console.log(import_chalk17.default.yellow(`Warning: ${filename} already exists and takes priority over ${targetFilename}.`));
|
|
52361
|
+
console.log(import_chalk17.default.gray(`Remove or rename ${filename} for ${targetFilename} to take effect.`));
|
|
52295
52362
|
}
|
|
52296
52363
|
console.log("");
|
|
52297
|
-
console.log(
|
|
52298
|
-
console.log(
|
|
52299
|
-
console.log(
|
|
52364
|
+
console.log(import_chalk17.default.gray("Configuration options:"));
|
|
52365
|
+
console.log(import_chalk17.default.gray(" systemPrompt - Custom instructions for AI coding assistants"));
|
|
52366
|
+
console.log(import_chalk17.default.gray(" startHook - Commands to run on workspace startup"));
|
|
52300
52367
|
if (!isYaml) {
|
|
52301
52368
|
console.log("");
|
|
52302
|
-
console.log(
|
|
52369
|
+
console.log(import_chalk17.default.gray("Tip: Use --yaml for YAML format with multiline system prompt support."));
|
|
52303
52370
|
}
|
|
52304
52371
|
});
|
|
52305
52372
|
}
|
|
52306
|
-
var
|
|
52373
|
+
var import_chalk17, import_fs3, import_path4;
|
|
52307
52374
|
var init_init = __esm({
|
|
52308
52375
|
"src/commands/init.ts"() {
|
|
52309
52376
|
"use strict";
|
|
52310
|
-
|
|
52377
|
+
import_chalk17 = __toESM(require("chalk"));
|
|
52311
52378
|
import_fs3 = __toESM(require("fs"));
|
|
52312
52379
|
import_path4 = __toESM(require("path"));
|
|
52313
52380
|
init_src();
|
|
@@ -52351,10 +52418,10 @@ async function readSecret(service, name) {
|
|
|
52351
52418
|
async function credentialsListCommand(agent) {
|
|
52352
52419
|
const response = await orgAuthenticatedFetch(`/v1/agents/${agent}/credentials`);
|
|
52353
52420
|
output2(response, ({ credentials: credentials2, selected }) => {
|
|
52354
|
-
if (credentials2.length === 0) console.log(
|
|
52421
|
+
if (credentials2.length === 0) console.log(import_chalk18.default.yellow(`No credentials connected for ${agent}.`));
|
|
52355
52422
|
for (const { method, scope } of credentials2) {
|
|
52356
52423
|
const isSelected = selected?.method === method && selected.scope === scope;
|
|
52357
|
-
console.log(`${method} ${scope}${isSelected ?
|
|
52424
|
+
console.log(`${method} ${scope}${isSelected ? import_chalk18.default.green(" (used by new workspaces)") : ""}`);
|
|
52358
52425
|
}
|
|
52359
52426
|
});
|
|
52360
52427
|
}
|
|
@@ -52362,12 +52429,12 @@ async function credentialsGetCommand(service, options) {
|
|
|
52362
52429
|
const status = await orgAuthenticatedFetch(credentialsPath(service, options));
|
|
52363
52430
|
output2(status, ({ hasCredentials, ...fields }) => {
|
|
52364
52431
|
if (!hasCredentials) {
|
|
52365
|
-
console.log(
|
|
52432
|
+
console.log(import_chalk18.default.yellow(`No ${scopeLabel(options)} ${service} credentials.`));
|
|
52366
52433
|
return;
|
|
52367
52434
|
}
|
|
52368
52435
|
const width = Math.max(...Object.keys(fields).map((key) => key.length)) + 2;
|
|
52369
52436
|
for (const [key, value] of Object.entries(fields)) {
|
|
52370
|
-
console.log(`${
|
|
52437
|
+
console.log(`${import_chalk18.default.gray(key.padEnd(width))}${typeof value === "string" ? value : JSON.stringify(value)}`);
|
|
52371
52438
|
}
|
|
52372
52439
|
});
|
|
52373
52440
|
}
|
|
@@ -52381,35 +52448,35 @@ async function credentialsSetCommand(service, options) {
|
|
|
52381
52448
|
[secretField]: await readSecret(service, secretField === "api_key" ? "API key" : "AWS secret access key")
|
|
52382
52449
|
};
|
|
52383
52450
|
const response = await orgAuthenticatedFetch(path11, { method: "POST", body });
|
|
52384
|
-
output2(response, () => console.log(
|
|
52451
|
+
output2(response, () => console.log(import_chalk18.default.green(`Saved ${scopeLabel(options)} ${service} credentials.`)));
|
|
52385
52452
|
}
|
|
52386
52453
|
async function credentialsRemoveCommand(service, options) {
|
|
52387
52454
|
const response = await orgAuthenticatedFetch(credentialsPath(service, options), { method: "DELETE" });
|
|
52388
|
-
output2(response, ({ success: success2 }) => console.log(success2 ?
|
|
52455
|
+
output2(response, ({ success: success2 }) => console.log(success2 ? import_chalk18.default.green(`Removed ${scopeLabel(options)} ${service} credentials.`) : `No ${scopeLabel(options)} ${service} credentials to remove.`));
|
|
52389
52456
|
}
|
|
52390
52457
|
async function credentialsUsageCommand({ org: org2, user }) {
|
|
52391
52458
|
const scope = org2 ? "org" : user ? "user" : null;
|
|
52392
52459
|
const response = await orgAuthenticatedFetch(`/v1/agents/subscription-usage${scope ? `?scope=${scope}` : ""}`);
|
|
52393
52460
|
output2(response, ({ accounts }) => {
|
|
52394
|
-
if (accounts.length === 0) console.log(
|
|
52461
|
+
if (accounts.length === 0) console.log(import_chalk18.default.yellow("No Claude or Codex subscriptions connected."));
|
|
52395
52462
|
for (const account of accounts) {
|
|
52396
|
-
const limits = account.reconnectRequired ?
|
|
52463
|
+
const limits = account.reconnectRequired ? import_chalk18.default.yellow(`Reconnect required: run ${getSubscriptionAuthCommand(account.provider, account.scope)} with the same account`) : !account.windows ? import_chalk18.default.gray("Usage unavailable, try again in a few minutes") : account.windows.length === 0 ? "No usage limits" : account.windows.map((window) => [
|
|
52397
52464
|
window.kind === "session" ? "5-hour" : "weekly",
|
|
52398
52465
|
window.model,
|
|
52399
52466
|
`${Math.round(window.usedPercent)}%`,
|
|
52400
|
-
window.resetsAt &&
|
|
52467
|
+
window.resetsAt && import_chalk18.default.gray(`(resets ${formatDate(window.resetsAt)})`)
|
|
52401
52468
|
].filter(Boolean).join(" ")).join(", ");
|
|
52402
52469
|
const label = [account.email ?? account.credentialId, account.planType].filter(Boolean).join(" ");
|
|
52403
52470
|
console.log(`${account.provider} ${scopeLabel({ org: account.scope === "org" })} ${label} ${limits}`);
|
|
52404
|
-
if (account.exhaustedUntil) console.log(
|
|
52471
|
+
if (account.exhaustedUntil) console.log(import_chalk18.default.gray(` Workspaces skip this account until ${formatDate(account.exhaustedUntil)}`));
|
|
52405
52472
|
}
|
|
52406
52473
|
});
|
|
52407
52474
|
}
|
|
52408
|
-
var
|
|
52475
|
+
var import_chalk18, OPTIONAL_SECRET_SERVICES, scopeLabel;
|
|
52409
52476
|
var init_credentials2 = __esm({
|
|
52410
52477
|
"src/commands/credentials.ts"() {
|
|
52411
52478
|
"use strict";
|
|
52412
|
-
|
|
52479
|
+
import_chalk18 = __toESM(require("chalk"));
|
|
52413
52480
|
init_src();
|
|
52414
52481
|
init_subscription_usage();
|
|
52415
52482
|
init_api2();
|
|
@@ -52440,7 +52507,7 @@ function startUpdateCheck(currentVersion) {
|
|
|
52440
52507
|
}
|
|
52441
52508
|
const latestVersion = payload.version;
|
|
52442
52509
|
if (compareVersions(latestVersion, currentVersion) > 0) {
|
|
52443
|
-
notice =
|
|
52510
|
+
notice = import_chalk19.default.dim(
|
|
52444
52511
|
`
|
|
52445
52512
|
Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm install -g replicas-cli@latest
|
|
52446
52513
|
`
|
|
@@ -52450,11 +52517,11 @@ Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm in
|
|
|
52450
52517
|
}
|
|
52451
52518
|
})();
|
|
52452
52519
|
}
|
|
52453
|
-
var
|
|
52520
|
+
var import_chalk19, VERSION_CHECK_TIMEOUT;
|
|
52454
52521
|
var init_version_check = __esm({
|
|
52455
52522
|
"src/lib/version-check.ts"() {
|
|
52456
52523
|
"use strict";
|
|
52457
|
-
|
|
52524
|
+
import_chalk19 = __toESM(require("chalk"));
|
|
52458
52525
|
init_src();
|
|
52459
52526
|
init_monolith_url();
|
|
52460
52527
|
init_output();
|
|
@@ -52467,20 +52534,20 @@ async function repositoriesListCommand() {
|
|
|
52467
52534
|
ensureOrgApiAuthenticated();
|
|
52468
52535
|
output2(await orgAuthenticatedFetch("/v1/repositories"), ({ repositories }) => {
|
|
52469
52536
|
if (repositories.length === 0) {
|
|
52470
|
-
console.log(
|
|
52537
|
+
console.log(import_chalk20.default.yellow("\nNo repositories found.\n"));
|
|
52471
52538
|
return;
|
|
52472
52539
|
}
|
|
52473
|
-
console.log(
|
|
52540
|
+
console.log(import_chalk20.default.green(`
|
|
52474
52541
|
Repositories (${repositories.length}):
|
|
52475
52542
|
`));
|
|
52476
52543
|
for (const repo of repositories) {
|
|
52477
|
-
console.log(
|
|
52478
|
-
console.log(
|
|
52479
|
-
console.log(
|
|
52480
|
-
console.log(
|
|
52481
|
-
console.log(
|
|
52544
|
+
console.log(import_chalk20.default.white(` ${repo.name}`));
|
|
52545
|
+
console.log(import_chalk20.default.gray(` ID: ${repo.id}`));
|
|
52546
|
+
console.log(import_chalk20.default.gray(` URL: ${repo.url}`));
|
|
52547
|
+
console.log(import_chalk20.default.gray(` Default Branch: ${repo.default_branch}`));
|
|
52548
|
+
console.log(import_chalk20.default.gray(` Created: ${formatDate(repo.created_at)}`));
|
|
52482
52549
|
if (repo.github_repository_id) {
|
|
52483
|
-
console.log(
|
|
52550
|
+
console.log(import_chalk20.default.gray(` GitHub ID: ${repo.github_repository_id}`));
|
|
52484
52551
|
}
|
|
52485
52552
|
console.log();
|
|
52486
52553
|
}
|
|
@@ -52535,11 +52602,11 @@ async function repositoriesBranchesCommand(repository) {
|
|
|
52535
52602
|
for (const branch of branches) console.log(branch);
|
|
52536
52603
|
});
|
|
52537
52604
|
}
|
|
52538
|
-
var
|
|
52605
|
+
var import_chalk20, splitList;
|
|
52539
52606
|
var init_repositories2 = __esm({
|
|
52540
52607
|
"src/commands/repositories.ts"() {
|
|
52541
52608
|
"use strict";
|
|
52542
|
-
|
|
52609
|
+
import_chalk20 = __toESM(require("chalk"));
|
|
52543
52610
|
init_api2();
|
|
52544
52611
|
init_command_utils();
|
|
52545
52612
|
init_output();
|
|
@@ -52567,22 +52634,22 @@ async function resolveEnvironmentId(input2) {
|
|
|
52567
52634
|
return resolved.id;
|
|
52568
52635
|
}
|
|
52569
52636
|
function printEnvironment(env, repoSkillCount) {
|
|
52570
|
-
console.log(
|
|
52571
|
-
console.log(
|
|
52637
|
+
console.log(import_chalk21.default.white(` ${env.name}${env.user_id ? import_chalk21.default.gray(" (personal)") : ""}`));
|
|
52638
|
+
console.log(import_chalk21.default.gray(` ID: ${env.id}`));
|
|
52572
52639
|
if (env.description) {
|
|
52573
|
-
console.log(
|
|
52640
|
+
console.log(import_chalk21.default.gray(` Description: ${env.description}`));
|
|
52574
52641
|
}
|
|
52575
52642
|
const repositoryIds = env.repository_ids ?? [];
|
|
52576
52643
|
if (repositoryIds.length > 0) {
|
|
52577
|
-
console.log(
|
|
52644
|
+
console.log(import_chalk21.default.gray(` Repositories: ${repositoryIds.join(", ")}`));
|
|
52578
52645
|
}
|
|
52579
52646
|
if (env.variable_count !== void 0) {
|
|
52580
|
-
console.log(
|
|
52647
|
+
console.log(import_chalk21.default.gray(` Variables: ${env.variable_count}, Files: ${env.file_count ?? 0}, Added skills: ${env.skill_count ?? 0}, MCPs: ${env.mcp_count ?? 0}`));
|
|
52581
52648
|
}
|
|
52582
52649
|
if (repoSkillCount !== void 0) {
|
|
52583
|
-
console.log(
|
|
52650
|
+
console.log(import_chalk21.default.gray(` Repository skills: ${repoSkillCount}`));
|
|
52584
52651
|
}
|
|
52585
|
-
console.log(
|
|
52652
|
+
console.log(import_chalk21.default.gray(` Updated: ${formatDate(env.updated_at)}`));
|
|
52586
52653
|
console.log();
|
|
52587
52654
|
}
|
|
52588
52655
|
async function environmentListCommand() {
|
|
@@ -52590,10 +52657,10 @@ async function environmentListCommand() {
|
|
|
52590
52657
|
const response = await orgAuthenticatedFetch("/v1/environments?scope=all");
|
|
52591
52658
|
output2(response, ({ environments }) => {
|
|
52592
52659
|
if (environments.length === 0) {
|
|
52593
|
-
console.log(
|
|
52660
|
+
console.log(import_chalk21.default.yellow("\nNo environments found.\n"));
|
|
52594
52661
|
return;
|
|
52595
52662
|
}
|
|
52596
|
-
console.log(
|
|
52663
|
+
console.log(import_chalk21.default.green(`
|
|
52597
52664
|
Environments (${environments.length}):
|
|
52598
52665
|
`));
|
|
52599
52666
|
for (const env of environments) printEnvironment(env);
|
|
@@ -52605,13 +52672,13 @@ async function environmentGetCommand(idOrName) {
|
|
|
52605
52672
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}`);
|
|
52606
52673
|
const repoSkills = await orgAuthenticatedFetch(`/v1/environments/${response.environment.id}/repo-skills`);
|
|
52607
52674
|
output2({ ...response, ...repoSkills }, ({ environment: environment2 }) => {
|
|
52608
|
-
console.log(
|
|
52675
|
+
console.log(import_chalk21.default.green(`
|
|
52609
52676
|
Environment: ${environment2.name}
|
|
52610
52677
|
`));
|
|
52611
52678
|
const linkedSkills = repoSkills.repo_skills.filter((skill) => skill.path.startsWith(`.${skill.framework}/skills/`));
|
|
52612
52679
|
printEnvironment(environment2, new Set(linkedSkills.map((skill) => `${skill.repository_id}:${skill.path.split("/")[2]}`)).size);
|
|
52613
52680
|
for (const message2 of [repoSkills.error, ...repoSkills.repo_errors.map((repo) => `${repo.repository_full_name}: ${repo.error}`)]) {
|
|
52614
|
-
if (message2) console.log(
|
|
52681
|
+
if (message2) console.log(import_chalk21.default.yellow(` Could not read repository skills: ${message2}`));
|
|
52615
52682
|
}
|
|
52616
52683
|
});
|
|
52617
52684
|
}
|
|
@@ -52626,7 +52693,7 @@ async function environmentCreateCommand(name, options) {
|
|
|
52626
52693
|
validate: (v) => v.trim() ? true : "Name is required"
|
|
52627
52694
|
});
|
|
52628
52695
|
if (!r.name) {
|
|
52629
|
-
console.log(
|
|
52696
|
+
console.log(import_chalk21.default.yellow("\nCancelled."));
|
|
52630
52697
|
return;
|
|
52631
52698
|
}
|
|
52632
52699
|
envName = r.name;
|
|
@@ -52660,9 +52727,9 @@ async function environmentCreateCommand(name, options) {
|
|
|
52660
52727
|
body
|
|
52661
52728
|
});
|
|
52662
52729
|
output2(response, ({ environment: environment2 }) => {
|
|
52663
|
-
console.log(
|
|
52730
|
+
console.log(import_chalk21.default.green(`
|
|
52664
52731
|
Created environment: ${environment2.name}`));
|
|
52665
|
-
console.log(
|
|
52732
|
+
console.log(import_chalk21.default.gray(` ID: ${environment2.id}
|
|
52666
52733
|
`));
|
|
52667
52734
|
});
|
|
52668
52735
|
}
|
|
@@ -52683,7 +52750,7 @@ async function environmentEditCommand(idOrName, options) {
|
|
|
52683
52750
|
method: "PATCH",
|
|
52684
52751
|
body
|
|
52685
52752
|
});
|
|
52686
|
-
output2(response, ({ environment: environment2 }) => console.log(
|
|
52753
|
+
output2(response, ({ environment: environment2 }) => console.log(import_chalk21.default.green(`
|
|
52687
52754
|
Updated environment: ${environment2.name}
|
|
52688
52755
|
`)));
|
|
52689
52756
|
}
|
|
@@ -52697,10 +52764,10 @@ Deleted environment ${idOrName}.
|
|
|
52697
52764
|
`);
|
|
52698
52765
|
}
|
|
52699
52766
|
function printVariable(v) {
|
|
52700
|
-
console.log(
|
|
52701
|
-
console.log(
|
|
52702
|
-
console.log(
|
|
52703
|
-
console.log(
|
|
52767
|
+
console.log(import_chalk21.default.white(` ${v.key}`));
|
|
52768
|
+
console.log(import_chalk21.default.gray(` ID: ${v.id}`));
|
|
52769
|
+
console.log(import_chalk21.default.gray(` Value: ${v.value}`));
|
|
52770
|
+
console.log(import_chalk21.default.gray(` Updated: ${formatDate(v.updated_at)}`));
|
|
52704
52771
|
console.log();
|
|
52705
52772
|
}
|
|
52706
52773
|
async function envVarsListCommand(envIdOrName, options) {
|
|
@@ -52712,14 +52779,14 @@ async function envVarsListCommand(envIdOrName, options) {
|
|
|
52712
52779
|
const variables = options.reveal ? response.environment_variables : response.environment_variables.map((v) => ({ ...v, value: maskValue(v.value) }));
|
|
52713
52780
|
output2({ environment_variables: variables }, ({ environment_variables }) => {
|
|
52714
52781
|
if (environment_variables.length === 0) {
|
|
52715
|
-
console.log(
|
|
52782
|
+
console.log(import_chalk21.default.yellow("\nNo variables.\n"));
|
|
52716
52783
|
return;
|
|
52717
52784
|
}
|
|
52718
|
-
console.log(
|
|
52785
|
+
console.log(import_chalk21.default.green(`
|
|
52719
52786
|
Variables (${environment_variables.length}):
|
|
52720
52787
|
`));
|
|
52721
52788
|
if (!options.reveal) {
|
|
52722
|
-
console.log(
|
|
52789
|
+
console.log(import_chalk21.default.gray(" Values are masked. Pass --reveal to show full values.\n"));
|
|
52723
52790
|
}
|
|
52724
52791
|
for (const v of environment_variables) printVariable(v);
|
|
52725
52792
|
});
|
|
@@ -52737,7 +52804,7 @@ async function envVarsSetCommand(envIdOrName, key, value) {
|
|
|
52737
52804
|
`/v1/environments/${id}/variables/${match.id}`,
|
|
52738
52805
|
{ method: "PATCH", body: body2 }
|
|
52739
52806
|
);
|
|
52740
|
-
output2({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
52807
|
+
output2({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk21.default.green(`
|
|
52741
52808
|
Updated variable ${environment_variable.key}.
|
|
52742
52809
|
`)));
|
|
52743
52810
|
return;
|
|
@@ -52751,7 +52818,7 @@ Updated variable ${environment_variable.key}.
|
|
|
52751
52818
|
`/v1/environments/${id}/variables`,
|
|
52752
52819
|
{ method: "POST", body }
|
|
52753
52820
|
);
|
|
52754
|
-
output2({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
52821
|
+
output2({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk21.default.green(`
|
|
52755
52822
|
Created variable ${environment_variable.key}.
|
|
52756
52823
|
`)));
|
|
52757
52824
|
}
|
|
@@ -52787,15 +52854,15 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
52787
52854
|
const local = parsePosixEnvFile(readRuntimeEnv());
|
|
52788
52855
|
const available = options.replace ? [] : keys.filter((key) => Object.hasOwn(local, key) && local[key].length > 0);
|
|
52789
52856
|
const wanted = keys.filter((key) => !available.includes(key));
|
|
52790
|
-
const loadHint =
|
|
52857
|
+
const loadHint = import_chalk21.default.gray(`
|
|
52791
52858
|
Values are never printed. Load them into a command with: . ~/.replicas/runtime-env.sh && <command>
|
|
52792
52859
|
`);
|
|
52793
52860
|
if (wanted.length === 0) {
|
|
52794
52861
|
output2({ status: "provided", exported: available, missing: [] }, () => {
|
|
52795
52862
|
console.log(`
|
|
52796
|
-
${
|
|
52863
|
+
${import_chalk21.default.green("Already available:")} ${available.join(", ")}`);
|
|
52797
52864
|
console.log(loadHint);
|
|
52798
|
-
console.log(
|
|
52865
|
+
console.log(import_chalk21.default.gray(" If a value is wrong, run this again with --replace to ask the user for a new one.\n"));
|
|
52799
52866
|
});
|
|
52800
52867
|
return;
|
|
52801
52868
|
}
|
|
@@ -52831,11 +52898,11 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
52831
52898
|
console.log("");
|
|
52832
52899
|
if (exported.length > 0 || available.length > 0) {
|
|
52833
52900
|
const where = request.destination === "workspace" ? "this workspace only" : "saved to the environment";
|
|
52834
|
-
console.log(` ${
|
|
52901
|
+
console.log(` ${import_chalk21.default.green("Provided:")} ${[...available, ...exported].join(", ")} ${import_chalk21.default.gray(`(${where})`)}`);
|
|
52835
52902
|
}
|
|
52836
52903
|
if (request.status === "pending") {
|
|
52837
|
-
console.log(` ${
|
|
52838
|
-
console.log(
|
|
52904
|
+
console.log(` ${import_chalk21.default.yellow("Still waiting for:")} ${missing.join(", ")}`);
|
|
52905
|
+
console.log(import_chalk21.default.gray(options.wait === false ? `
|
|
52839
52906
|
Asked above the chat composer (${created.url}). Keep working, and run this command again when you need the values.
|
|
52840
52907
|
` : created.wait ? `
|
|
52841
52908
|
The form stays open above the chat composer (${created.url}). End your turn and say what the values are for. When the user saves, you get a message; run this command again then.
|
|
@@ -52845,21 +52912,21 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
52845
52912
|
`));
|
|
52846
52913
|
return;
|
|
52847
52914
|
}
|
|
52848
|
-
if (missing.length > 0) console.log(` ${
|
|
52915
|
+
if (missing.length > 0) console.log(` ${import_chalk21.default.gray(request.status === "skipped" ? "Skipped by the user:" : "Not provided:")} ${missing.join(", ")}`);
|
|
52849
52916
|
if (exported.length === 0) {
|
|
52850
|
-
console.log(
|
|
52917
|
+
console.log(import_chalk21.default.gray("\n Continue without them, or ask the user how they want to proceed.\n"));
|
|
52851
52918
|
return;
|
|
52852
52919
|
}
|
|
52853
52920
|
console.log(loadHint);
|
|
52854
|
-
if (options.replace) console.log(
|
|
52921
|
+
if (options.replace) console.log(import_chalk21.default.gray(" Leave out --replace from now on; running it again asks the user again.\n"));
|
|
52855
52922
|
});
|
|
52856
52923
|
}
|
|
52857
52924
|
function printFile(f) {
|
|
52858
|
-
console.log(
|
|
52859
|
-
console.log(
|
|
52860
|
-
console.log(
|
|
52861
|
-
console.log(
|
|
52862
|
-
console.log(
|
|
52925
|
+
console.log(import_chalk21.default.white(` ${f.path}`));
|
|
52926
|
+
console.log(import_chalk21.default.gray(` ID: ${f.id}`));
|
|
52927
|
+
console.log(import_chalk21.default.gray(` Name: ${f.name}`));
|
|
52928
|
+
console.log(import_chalk21.default.gray(` Size: ${f.content.length} bytes`));
|
|
52929
|
+
console.log(import_chalk21.default.gray(` Updated: ${formatDate(f.updated_at)}`));
|
|
52863
52930
|
console.log();
|
|
52864
52931
|
}
|
|
52865
52932
|
async function envFilesListCommand(envIdOrName) {
|
|
@@ -52870,10 +52937,10 @@ async function envFilesListCommand(envIdOrName) {
|
|
|
52870
52937
|
);
|
|
52871
52938
|
output2(response, ({ environment_files }) => {
|
|
52872
52939
|
if (environment_files.length === 0) {
|
|
52873
|
-
console.log(
|
|
52940
|
+
console.log(import_chalk21.default.yellow("\nNo files.\n"));
|
|
52874
52941
|
return;
|
|
52875
52942
|
}
|
|
52876
|
-
console.log(
|
|
52943
|
+
console.log(import_chalk21.default.green(`
|
|
52877
52944
|
Files (${environment_files.length}):
|
|
52878
52945
|
`));
|
|
52879
52946
|
for (const f of environment_files) printFile(f);
|
|
@@ -52905,7 +52972,7 @@ async function envFilesSetCommand(envIdOrName, destinationPath, options) {
|
|
|
52905
52972
|
`/v1/environments/${id}/files/${match.id}`,
|
|
52906
52973
|
{ method: "PATCH", body: body2 }
|
|
52907
52974
|
);
|
|
52908
|
-
output2(response2, ({ environment_file }) => console.log(
|
|
52975
|
+
output2(response2, ({ environment_file }) => console.log(import_chalk21.default.green(`
|
|
52909
52976
|
Updated file ${environment_file.path}.
|
|
52910
52977
|
`)));
|
|
52911
52978
|
return;
|
|
@@ -52920,7 +52987,7 @@ Updated file ${environment_file.path}.
|
|
|
52920
52987
|
`/v1/environments/${id}/files`,
|
|
52921
52988
|
{ method: "POST", body }
|
|
52922
52989
|
);
|
|
52923
|
-
output2(response, ({ environment_file }) => console.log(
|
|
52990
|
+
output2(response, ({ environment_file }) => console.log(import_chalk21.default.green(`
|
|
52924
52991
|
Created file ${environment_file.path}.
|
|
52925
52992
|
`)));
|
|
52926
52993
|
}
|
|
@@ -52950,16 +53017,16 @@ async function envHookGetCommand(envIdOrName, kind) {
|
|
|
52950
53017
|
const hook = kind === "warm" ? (await orgAuthenticatedFetch(`/v1/environments/${id}/warm-hooks`)).warm_hook : (await orgAuthenticatedFetch(`/v1/environments/${id}/start-hooks`)).start_hook;
|
|
52951
53018
|
output2({ hook }, () => {
|
|
52952
53019
|
if (!hook) {
|
|
52953
|
-
console.log(
|
|
53020
|
+
console.log(import_chalk21.default.yellow(`
|
|
52954
53021
|
No ${kind} hook configured.
|
|
52955
53022
|
`));
|
|
52956
53023
|
return;
|
|
52957
53024
|
}
|
|
52958
|
-
console.log(
|
|
53025
|
+
console.log(import_chalk21.default.green(`
|
|
52959
53026
|
${kind === "warm" ? "Warm" : "Start"} hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
52960
53027
|
`));
|
|
52961
|
-
console.log(
|
|
52962
|
-
console.log(
|
|
53028
|
+
console.log(import_chalk21.default.gray(` ID: ${hook.id}`));
|
|
53029
|
+
console.log(import_chalk21.default.gray(` Created: ${formatDate(hook.created_at)}
|
|
52963
53030
|
`));
|
|
52964
53031
|
console.log(hook.content);
|
|
52965
53032
|
console.log();
|
|
@@ -52975,7 +53042,7 @@ async function envHookSaveCommand(envIdOrName, options, kind) {
|
|
|
52975
53042
|
`/v1/environments/${id}/warm-hooks/save`,
|
|
52976
53043
|
{ method: "POST", body: body2 }
|
|
52977
53044
|
);
|
|
52978
|
-
output2(response2, ({ warm_hook }) => console.log(
|
|
53045
|
+
output2(response2, ({ warm_hook }) => console.log(import_chalk21.default.green(warm_hook ? `
|
|
52979
53046
|
Saved warm hook v${warm_hook.version}.
|
|
52980
53047
|
` : "\nCleared warm hook.\n")));
|
|
52981
53048
|
return;
|
|
@@ -52985,7 +53052,7 @@ Saved warm hook v${warm_hook.version}.
|
|
|
52985
53052
|
`/v1/environments/${id}/start-hooks/save`,
|
|
52986
53053
|
{ method: "POST", body }
|
|
52987
53054
|
);
|
|
52988
|
-
output2(response, ({ start_hook }) => console.log(
|
|
53055
|
+
output2(response, ({ start_hook }) => console.log(import_chalk21.default.green(start_hook ? `
|
|
52989
53056
|
Saved start hook v${start_hook.version}.
|
|
52990
53057
|
` : "\nCleared start hook.\n")));
|
|
52991
53058
|
}
|
|
@@ -53003,7 +53070,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
53003
53070
|
body: kind === "warm" ? { content, mode: options.save ? "save_test" : "test_only" } : { content },
|
|
53004
53071
|
onEvent: (event) => {
|
|
53005
53072
|
if (event.type === "progress" && event.message) {
|
|
53006
|
-
console.log(
|
|
53073
|
+
console.log(import_chalk21.default.gray(event.message));
|
|
53007
53074
|
} else if (event.type === "output" && event.output) {
|
|
53008
53075
|
logs += event.output;
|
|
53009
53076
|
if (!isJsonMode()) process.stdout.write(event.output);
|
|
@@ -53020,7 +53087,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
53020
53087
|
const label = kind === "warm" ? "Warm" : "Start";
|
|
53021
53088
|
const passed = !timedOut && exitCode === 0;
|
|
53022
53089
|
output2({ passed, exit_code: exitCode, timed_out: timedOut, saved: passed && !!options.save, output: logs }, () => {
|
|
53023
|
-
if (passed) console.log(
|
|
53090
|
+
if (passed) console.log(import_chalk21.default.green(`
|
|
53024
53091
|
${label} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
|
|
53025
53092
|
`));
|
|
53026
53093
|
});
|
|
@@ -53037,24 +53104,24 @@ async function envHookRepositoryHooksCommand(envIdOrName, kind) {
|
|
|
53037
53104
|
)).repositories.map((repository) => ({ ...repository, hook: repository.start_hook }));
|
|
53038
53105
|
output2({ repositories }, () => {
|
|
53039
53106
|
if (repositories.length === 0) {
|
|
53040
|
-
console.log(
|
|
53107
|
+
console.log(import_chalk21.default.yellow("\nNo repositories bound to this environment.\n"));
|
|
53041
53108
|
return;
|
|
53042
53109
|
}
|
|
53043
|
-
console.log(
|
|
53110
|
+
console.log(import_chalk21.default.green(`
|
|
53044
53111
|
Repository ${kind} hooks (${repositories.length}):
|
|
53045
53112
|
`));
|
|
53046
53113
|
for (const repo of repositories) {
|
|
53047
|
-
console.log(
|
|
53114
|
+
console.log(import_chalk21.default.white(` ${repo.repository_name} @${repo.default_branch}`));
|
|
53048
53115
|
if (repo.error) {
|
|
53049
|
-
console.log(
|
|
53116
|
+
console.log(import_chalk21.default.red(` Error: ${repo.error}`));
|
|
53050
53117
|
} else if (repo.hook) {
|
|
53051
|
-
console.log(
|
|
53052
|
-
console.log(
|
|
53118
|
+
console.log(import_chalk21.default.gray(` Source: ${repo.filename ?? "(unknown)"}`));
|
|
53119
|
+
console.log(import_chalk21.default.gray(` Commands (${repo.hook.commands.length}):`));
|
|
53053
53120
|
for (const cmd of repo.hook.commands) {
|
|
53054
|
-
console.log(
|
|
53121
|
+
console.log(import_chalk21.default.gray(` ${cmd}`));
|
|
53055
53122
|
}
|
|
53056
53123
|
} else {
|
|
53057
|
-
console.log(
|
|
53124
|
+
console.log(import_chalk21.default.gray(` No ${kind}Hook defined.`));
|
|
53058
53125
|
}
|
|
53059
53126
|
console.log();
|
|
53060
53127
|
}
|
|
@@ -53096,7 +53163,7 @@ async function envSkillsAddCommand(env, source, slug, options) {
|
|
|
53096
53163
|
const id = await resolveEnvironmentId(env);
|
|
53097
53164
|
const body = { environment_id: id, source, slug, name: options.name ?? slug };
|
|
53098
53165
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/skills`, { method: "POST", body });
|
|
53099
|
-
output2(response, () => console.log(
|
|
53166
|
+
output2(response, () => console.log(import_chalk21.default.green(`Added skill ${slug} from ${source}`)));
|
|
53100
53167
|
}
|
|
53101
53168
|
async function envSkillsRemoveCommand(env, slugOrId) {
|
|
53102
53169
|
const id = await resolveEnvironmentId(env);
|
|
@@ -53124,7 +53191,7 @@ async function envMcpsAddCommand(env, name, options) {
|
|
|
53124
53191
|
const id = await resolveEnvironmentId(env);
|
|
53125
53192
|
const body = { environment_id: id, name, ...server };
|
|
53126
53193
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/mcps`, { method: "POST", body });
|
|
53127
|
-
output2(response, () => console.log(
|
|
53194
|
+
output2(response, () => console.log(import_chalk21.default.green(`Added MCP server ${name}`)));
|
|
53128
53195
|
}
|
|
53129
53196
|
async function envMcpsRemoveCommand(env, nameOrId) {
|
|
53130
53197
|
const id = await resolveEnvironmentId(env);
|
|
@@ -53140,13 +53207,13 @@ async function envDevicesListCommand(env) {
|
|
|
53140
53207
|
);
|
|
53141
53208
|
output2(response, ({ environment_devices }) => {
|
|
53142
53209
|
if (environment_devices.length === 0) {
|
|
53143
|
-
console.log(
|
|
53210
|
+
console.log(import_chalk21.default.yellow(`
|
|
53144
53211
|
No devices. Add one with: replicas env devices add ${env} <name> --user <user>
|
|
53145
53212
|
`));
|
|
53146
53213
|
return;
|
|
53147
53214
|
}
|
|
53148
53215
|
for (const device of environment_devices) {
|
|
53149
|
-
const status = isDeviceOnline(device.last_seen_at) ?
|
|
53216
|
+
const status = isDeviceOnline(device.last_seen_at) ? import_chalk21.default.green("online") : import_chalk21.default.yellow(device.last_seen_at ? `offline, last seen ${formatCompactRelativeTime(device.last_seen_at)}` : "offline");
|
|
53150
53217
|
console.log(`${device.id} ${device.name} ${device.host === null ? `${device.username}, connects from the device ${status}` : `${device.username}@${device.host}:${device.port}`}`);
|
|
53151
53218
|
}
|
|
53152
53219
|
});
|
|
@@ -53157,10 +53224,10 @@ async function envDevicesAddCommand(env, name, options) {
|
|
|
53157
53224
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`, { method: "POST", body });
|
|
53158
53225
|
const connect2 = options.host === void 0 ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${response.environment_device.id}/connect-token`) : void 0;
|
|
53159
53226
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
53160
|
-
console.log(
|
|
53227
|
+
console.log(import_chalk21.default.green(`Added device ${name}. Allow its key by running this on the device as ${options.user}:`));
|
|
53161
53228
|
console.log(`mkdir -p ~/.ssh && echo '${environment_device.public_key}' >> ~/.ssh/authorized_keys`);
|
|
53162
53229
|
if (connect_token) {
|
|
53163
|
-
console.log(
|
|
53230
|
+
console.log(import_chalk21.default.green("Then keep this running on it, so workspaces can reach it, and paste this token when it asks:"));
|
|
53164
53231
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
53165
53232
|
console.log(connect_token);
|
|
53166
53233
|
}
|
|
@@ -53178,9 +53245,9 @@ async function envDevicesEditCommand(env, nameOrId, options) {
|
|
|
53178
53245
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}`, { method: "PATCH", body });
|
|
53179
53246
|
const connect2 = device.host !== null && response.environment_device.host === null ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`) : void 0;
|
|
53180
53247
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
53181
|
-
console.log(
|
|
53248
|
+
console.log(import_chalk21.default.green(`Updated device ${environment_device.name}. Workspaces started from now on get the change.`));
|
|
53182
53249
|
if (connect_token) {
|
|
53183
|
-
console.log(
|
|
53250
|
+
console.log(import_chalk21.default.green("It now connects from the device. Keep this running on it, and paste this token when it asks:"));
|
|
53184
53251
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
53185
53252
|
console.log(connect_token);
|
|
53186
53253
|
}
|
|
@@ -53201,7 +53268,7 @@ async function envDevicesResetCommand(env, nameOrId) {
|
|
|
53201
53268
|
if (!device) throw new Error(`Device not found: ${nameOrId}`);
|
|
53202
53269
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`, { method: "POST" });
|
|
53203
53270
|
output2(response, ({ token }) => {
|
|
53204
|
-
console.log(
|
|
53271
|
+
console.log(import_chalk21.default.green(`Reset ${device.name}'s connection. Its old token no longer works; run this on it again and paste the new token when it asks:`));
|
|
53205
53272
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
53206
53273
|
console.log(token);
|
|
53207
53274
|
});
|
|
@@ -53211,17 +53278,17 @@ function envWarmPoolCommand(enabled) {
|
|
|
53211
53278
|
const id = await resolveEnvironmentId(env);
|
|
53212
53279
|
const body = { environment_id: id, enabled };
|
|
53213
53280
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/warm-pools`, { method: "PUT", body });
|
|
53214
|
-
output2(response, () => console.log(
|
|
53281
|
+
output2(response, () => console.log(import_chalk21.default.green(`Warm pool ${enabled ? "enabled" : "disabled"}`)));
|
|
53215
53282
|
};
|
|
53216
53283
|
}
|
|
53217
|
-
var import_fs4, import_os3, import_path5,
|
|
53284
|
+
var import_fs4, import_os3, import_path5, import_chalk21, RUNTIME_ENV_FILE;
|
|
53218
53285
|
var init_environment3 = __esm({
|
|
53219
53286
|
"src/commands/environment.ts"() {
|
|
53220
53287
|
"use strict";
|
|
53221
53288
|
import_fs4 = __toESM(require("fs"));
|
|
53222
53289
|
import_os3 = __toESM(require("os"));
|
|
53223
53290
|
import_path5 = __toESM(require("path"));
|
|
53224
|
-
|
|
53291
|
+
import_chalk21 = __toESM(require("chalk"));
|
|
53225
53292
|
init_api2();
|
|
53226
53293
|
init_command_utils();
|
|
53227
53294
|
init_output();
|
|
@@ -53241,8 +53308,8 @@ function parseReplicaAgent(value) {
|
|
|
53241
53308
|
throw new Error(`Invalid coding agent: ${value}. Must be one of: ${CLI_CODING_AGENT_LABEL}`);
|
|
53242
53309
|
}
|
|
53243
53310
|
function formatStatus(status) {
|
|
53244
|
-
if (status === "active") return
|
|
53245
|
-
if (isWorkspaceSuspendedStatus(status)) return
|
|
53311
|
+
if (status === "active") return import_chalk22.default.green(status);
|
|
53312
|
+
if (isWorkspaceSuspendedStatus(status)) return import_chalk22.default.gray(status);
|
|
53246
53313
|
return status;
|
|
53247
53314
|
}
|
|
53248
53315
|
function truncate(text4, maxLength) {
|
|
@@ -53253,93 +53320,93 @@ function formatDisplayMessage(message2) {
|
|
|
53253
53320
|
const time3 = new Date(message2.timestamp).toLocaleTimeString();
|
|
53254
53321
|
switch (message2.type) {
|
|
53255
53322
|
case "user":
|
|
53256
|
-
console.log(
|
|
53323
|
+
console.log(import_chalk22.default.blue(`
|
|
53257
53324
|
[${time3}] USER:`));
|
|
53258
|
-
console.log(
|
|
53325
|
+
console.log(import_chalk22.default.white(` ${truncate(message2.content, 500)}`));
|
|
53259
53326
|
break;
|
|
53260
53327
|
case "agent":
|
|
53261
|
-
console.log(
|
|
53328
|
+
console.log(import_chalk22.default.green(`
|
|
53262
53329
|
[${time3}] ASSISTANT:`));
|
|
53263
|
-
console.log(
|
|
53330
|
+
console.log(import_chalk22.default.white(` ${truncate(message2.content, 500)}`));
|
|
53264
53331
|
break;
|
|
53265
53332
|
case "reasoning":
|
|
53266
|
-
console.log(
|
|
53333
|
+
console.log(import_chalk22.default.gray(`
|
|
53267
53334
|
[${time3}] THINKING:`));
|
|
53268
|
-
console.log(
|
|
53335
|
+
console.log(import_chalk22.default.gray(` ${truncate(message2.content, 300)}`));
|
|
53269
53336
|
break;
|
|
53270
53337
|
case "command":
|
|
53271
|
-
console.log(
|
|
53338
|
+
console.log(import_chalk22.default.magenta(`
|
|
53272
53339
|
[${time3}] COMMAND:`));
|
|
53273
|
-
console.log(
|
|
53340
|
+
console.log(import_chalk22.default.white(` $ ${message2.command}`));
|
|
53274
53341
|
if (message2.output) {
|
|
53275
|
-
console.log(
|
|
53342
|
+
console.log(import_chalk22.default.gray(` ${truncate(message2.output, 200)}`));
|
|
53276
53343
|
}
|
|
53277
53344
|
if (message2.exitCode !== void 0) {
|
|
53278
|
-
const exitColor = message2.exitCode === 0 ?
|
|
53345
|
+
const exitColor = message2.exitCode === 0 ? import_chalk22.default.green : import_chalk22.default.red;
|
|
53279
53346
|
console.log(exitColor(` Exit code: ${message2.exitCode}`));
|
|
53280
53347
|
}
|
|
53281
53348
|
break;
|
|
53282
53349
|
case "file_change":
|
|
53283
|
-
console.log(
|
|
53350
|
+
console.log(import_chalk22.default.yellow(`
|
|
53284
53351
|
[${time3}] FILE CHANGES:`));
|
|
53285
53352
|
for (const change of message2.changes) {
|
|
53286
53353
|
const icon = change.kind === "add" ? "+" : change.kind === "delete" ? "-" : "~";
|
|
53287
|
-
const color = change.kind === "add" ?
|
|
53354
|
+
const color = change.kind === "add" ? import_chalk22.default.green : change.kind === "delete" ? import_chalk22.default.red : import_chalk22.default.yellow;
|
|
53288
53355
|
console.log(color(` ${icon} ${change.path}`));
|
|
53289
53356
|
}
|
|
53290
53357
|
break;
|
|
53291
53358
|
case "patch":
|
|
53292
|
-
console.log(
|
|
53359
|
+
console.log(import_chalk22.default.yellow(`
|
|
53293
53360
|
[${time3}] PATCH:`));
|
|
53294
53361
|
for (const op of message2.operations) {
|
|
53295
53362
|
const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
|
|
53296
|
-
const color = op.action === "add" ?
|
|
53363
|
+
const color = op.action === "add" ? import_chalk22.default.green : op.action === "delete" ? import_chalk22.default.red : import_chalk22.default.yellow;
|
|
53297
53364
|
console.log(color(` ${icon} ${op.path}`));
|
|
53298
53365
|
}
|
|
53299
53366
|
break;
|
|
53300
53367
|
case "tool_call":
|
|
53301
|
-
console.log(
|
|
53368
|
+
console.log(import_chalk22.default.cyan(`
|
|
53302
53369
|
[${time3}] TOOL: ${message2.tool}`));
|
|
53303
53370
|
if (message2.output) {
|
|
53304
|
-
console.log(
|
|
53371
|
+
console.log(import_chalk22.default.gray(` ${truncate(message2.output, 200)}`));
|
|
53305
53372
|
}
|
|
53306
53373
|
if (message2.inputRequest?.status === "pending") {
|
|
53307
53374
|
const { requestId, options, questions } = message2.inputRequest;
|
|
53308
|
-
console.log(
|
|
53309
|
-
for (const option of options ?? []) console.log(
|
|
53375
|
+
console.log(import_chalk22.default.yellow(` Awaiting answer, request ID: ${requestId}`));
|
|
53376
|
+
for (const option of options ?? []) console.log(import_chalk22.default.white(` ${option.id}: ${option.label}`));
|
|
53310
53377
|
for (const question of questions ?? []) {
|
|
53311
|
-
console.log(
|
|
53312
|
-
for (const option of question.options) console.log(
|
|
53378
|
+
console.log(import_chalk22.default.white(` Question ${question.id}: ${question.prompt}${question.multiSelect ? " (multi-select)" : ""}`));
|
|
53379
|
+
for (const option of question.options) console.log(import_chalk22.default.gray(` ${option.id}: ${option.label}`));
|
|
53313
53380
|
}
|
|
53314
53381
|
if (questions?.length) {
|
|
53315
|
-
console.log(
|
|
53382
|
+
console.log(import_chalk22.default.gray(` Selection ID: '{"<question>":{"options":["<option>"]}}', '{"<question>":{"custom":"<text>"}}', or declined`));
|
|
53316
53383
|
}
|
|
53317
53384
|
}
|
|
53318
53385
|
break;
|
|
53319
53386
|
case "web_search":
|
|
53320
|
-
console.log(
|
|
53387
|
+
console.log(import_chalk22.default.cyan(`
|
|
53321
53388
|
[${time3}] WEB SEARCH:`));
|
|
53322
|
-
console.log(
|
|
53389
|
+
console.log(import_chalk22.default.white(` "${message2.query}"`));
|
|
53323
53390
|
break;
|
|
53324
53391
|
case "todo_list":
|
|
53325
|
-
console.log(
|
|
53392
|
+
console.log(import_chalk22.default.blue(`
|
|
53326
53393
|
[${time3}] PLAN:`));
|
|
53327
53394
|
for (const item of message2.items) {
|
|
53328
|
-
const icon = item.completed ?
|
|
53395
|
+
const icon = item.completed ? import_chalk22.default.green("[x]") : import_chalk22.default.gray("[ ]");
|
|
53329
53396
|
console.log(` ${icon} ${item.text}`);
|
|
53330
53397
|
}
|
|
53331
53398
|
break;
|
|
53332
53399
|
case "subagent":
|
|
53333
|
-
console.log(
|
|
53400
|
+
console.log(import_chalk22.default.magenta(`
|
|
53334
53401
|
[${time3}] SUBAGENT: ${message2.description}`));
|
|
53335
53402
|
if (message2.output) {
|
|
53336
|
-
console.log(
|
|
53403
|
+
console.log(import_chalk22.default.gray(` ${truncate(message2.output, 200)}`));
|
|
53337
53404
|
}
|
|
53338
53405
|
break;
|
|
53339
53406
|
case "error":
|
|
53340
|
-
console.log(
|
|
53407
|
+
console.log(import_chalk22.default.red(`
|
|
53341
53408
|
[${time3}] ERROR:`));
|
|
53342
|
-
console.log(
|
|
53409
|
+
console.log(import_chalk22.default.red(` ${message2.message}`));
|
|
53343
53410
|
break;
|
|
53344
53411
|
}
|
|
53345
53412
|
}
|
|
@@ -53354,24 +53421,24 @@ async function replicaListCommand(options) {
|
|
|
53354
53421
|
);
|
|
53355
53422
|
output2(response, (response2) => {
|
|
53356
53423
|
if (response2.replicas.length === 0) {
|
|
53357
|
-
console.log(
|
|
53424
|
+
console.log(import_chalk22.default.yellow("\nNo replicas found.\n"));
|
|
53358
53425
|
return;
|
|
53359
53426
|
}
|
|
53360
|
-
console.log(
|
|
53427
|
+
console.log(import_chalk22.default.green(`
|
|
53361
53428
|
Replicas (Page ${response2.page} of ${response2.total_pages}, Total: ${response2.total}):
|
|
53362
53429
|
`));
|
|
53363
53430
|
for (const replica of response2.replicas) {
|
|
53364
|
-
console.log(
|
|
53365
|
-
console.log(
|
|
53431
|
+
console.log(import_chalk22.default.white(` ${replica.name}`));
|
|
53432
|
+
console.log(import_chalk22.default.gray(` ID: ${replica.id}`));
|
|
53366
53433
|
if (replica.repositories.length > 0) {
|
|
53367
|
-
console.log(
|
|
53434
|
+
console.log(import_chalk22.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
53368
53435
|
}
|
|
53369
|
-
console.log(
|
|
53370
|
-
console.log(
|
|
53436
|
+
console.log(import_chalk22.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
53437
|
+
console.log(import_chalk22.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
53371
53438
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
53372
|
-
console.log(
|
|
53439
|
+
console.log(import_chalk22.default.gray(` Pull Requests:`));
|
|
53373
53440
|
for (const pr2 of replica.pull_requests) {
|
|
53374
|
-
console.log(
|
|
53441
|
+
console.log(import_chalk22.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
53375
53442
|
}
|
|
53376
53443
|
}
|
|
53377
53444
|
console.log();
|
|
@@ -53382,30 +53449,30 @@ async function replicaGetCommand(id) {
|
|
|
53382
53449
|
ensureOrgApiAuthenticated();
|
|
53383
53450
|
const response = await orgAuthenticatedFetch(`/v1/replica/${id}`);
|
|
53384
53451
|
output2(response, ({ replica }) => {
|
|
53385
|
-
console.log(
|
|
53452
|
+
console.log(import_chalk22.default.green(`
|
|
53386
53453
|
Replica: ${replica.name}
|
|
53387
53454
|
`));
|
|
53388
|
-
console.log(
|
|
53455
|
+
console.log(import_chalk22.default.gray(` ID: ${replica.id}`));
|
|
53389
53456
|
if (replica.repositories.length > 0) {
|
|
53390
|
-
console.log(
|
|
53457
|
+
console.log(import_chalk22.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
53391
53458
|
}
|
|
53392
|
-
console.log(
|
|
53393
|
-
console.log(
|
|
53459
|
+
console.log(import_chalk22.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
53460
|
+
console.log(import_chalk22.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
53394
53461
|
if (replica.coding_agent) {
|
|
53395
|
-
console.log(
|
|
53462
|
+
console.log(import_chalk22.default.gray(` Coding Agent: ${replica.coding_agent}`));
|
|
53396
53463
|
}
|
|
53397
53464
|
if (replica.activity) printReplicaActivity(replica.activity);
|
|
53398
53465
|
if (replica.repository_statuses && replica.repository_statuses.length > 0) {
|
|
53399
|
-
console.log(
|
|
53466
|
+
console.log(import_chalk22.default.gray(" Repository Statuses:"));
|
|
53400
53467
|
for (const repositoryStatus of replica.repository_statuses) {
|
|
53401
|
-
const changeText = repositoryStatus.git_diff ? ` (${
|
|
53402
|
-
console.log(
|
|
53468
|
+
const changeText = repositoryStatus.git_diff ? ` (${import_chalk22.default.green(`+${repositoryStatus.git_diff.added}`)} / ${import_chalk22.default.red(`-${repositoryStatus.git_diff.removed}`)})` : "";
|
|
53469
|
+
console.log(import_chalk22.default.gray(` - ${repositoryStatus.repository}: ${repositoryStatus.branch || "unknown"}${changeText}`));
|
|
53403
53470
|
}
|
|
53404
53471
|
}
|
|
53405
53472
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
53406
|
-
console.log(
|
|
53473
|
+
console.log(import_chalk22.default.gray(` Pull Requests:`));
|
|
53407
53474
|
for (const pr2 of replica.pull_requests) {
|
|
53408
|
-
console.log(
|
|
53475
|
+
console.log(import_chalk22.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
53409
53476
|
}
|
|
53410
53477
|
}
|
|
53411
53478
|
console.log();
|
|
@@ -53432,7 +53499,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
53432
53499
|
});
|
|
53433
53500
|
const answer = response2.name;
|
|
53434
53501
|
if (!answer) {
|
|
53435
|
-
console.log(
|
|
53502
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53436
53503
|
return;
|
|
53437
53504
|
}
|
|
53438
53505
|
replicaName = answer;
|
|
@@ -53450,7 +53517,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
53450
53517
|
});
|
|
53451
53518
|
const answer = response2.environment;
|
|
53452
53519
|
if (!answer) {
|
|
53453
|
-
console.log(
|
|
53520
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53454
53521
|
return;
|
|
53455
53522
|
}
|
|
53456
53523
|
selectedEnvironmentId = answer;
|
|
@@ -53464,7 +53531,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
53464
53531
|
});
|
|
53465
53532
|
const answer = response2.message;
|
|
53466
53533
|
if (!answer) {
|
|
53467
|
-
console.log(
|
|
53534
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53468
53535
|
return;
|
|
53469
53536
|
}
|
|
53470
53537
|
message2 = answer;
|
|
@@ -53478,7 +53545,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
53478
53545
|
initial: 0
|
|
53479
53546
|
});
|
|
53480
53547
|
if (!response2.agent) {
|
|
53481
|
-
console.log(
|
|
53548
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53482
53549
|
return;
|
|
53483
53550
|
}
|
|
53484
53551
|
codingAgent = parseReplicaAgent(response2.agent);
|
|
@@ -53490,20 +53557,20 @@ async function replicaCreateCommand(name, options) {
|
|
|
53490
53557
|
coding_agent: codingAgent,
|
|
53491
53558
|
lifecycle_policy: "default"
|
|
53492
53559
|
};
|
|
53493
|
-
console.log(
|
|
53560
|
+
console.log(import_chalk22.default.gray("\nCreating replica..."));
|
|
53494
53561
|
const response = await orgAuthenticatedFetch("/v1/replica", {
|
|
53495
53562
|
method: "POST",
|
|
53496
53563
|
body
|
|
53497
53564
|
});
|
|
53498
53565
|
output2(response, ({ replica }) => {
|
|
53499
|
-
console.log(
|
|
53566
|
+
console.log(import_chalk22.default.green(`
|
|
53500
53567
|
Created replica: ${replica.name}`));
|
|
53501
|
-
console.log(
|
|
53502
|
-
console.log(
|
|
53568
|
+
console.log(import_chalk22.default.gray(` ID: ${replica.id}`));
|
|
53569
|
+
console.log(import_chalk22.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
53503
53570
|
if (replica.repositories.length > 0) {
|
|
53504
|
-
console.log(
|
|
53571
|
+
console.log(import_chalk22.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
53505
53572
|
}
|
|
53506
|
-
console.log(
|
|
53573
|
+
console.log(import_chalk22.default.cyan(` Link: ${getWorkspaceDashboardUrl(replica.id, { webAppUrl: process.env.REPLICAS_WEB_URL || DEFAULT_WEB_APP_URL })}`));
|
|
53507
53574
|
console.log();
|
|
53508
53575
|
});
|
|
53509
53576
|
}
|
|
@@ -53519,7 +53586,7 @@ async function replicaSendCommand(id, options) {
|
|
|
53519
53586
|
});
|
|
53520
53587
|
const answer = response2.message;
|
|
53521
53588
|
if (!answer) {
|
|
53522
|
-
console.log(
|
|
53589
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
53523
53590
|
return;
|
|
53524
53591
|
}
|
|
53525
53592
|
message2 = answer;
|
|
@@ -53544,14 +53611,14 @@ async function replicaSendCommand(id, options) {
|
|
|
53544
53611
|
}
|
|
53545
53612
|
);
|
|
53546
53613
|
output2(response, (response2) => {
|
|
53547
|
-
const statusColor = response2.status === "sent" ?
|
|
53614
|
+
const statusColor = response2.status === "sent" ? import_chalk22.default.green : import_chalk22.default.yellow;
|
|
53548
53615
|
console.log(statusColor(`
|
|
53549
53616
|
Message ${response2.status}`));
|
|
53550
53617
|
if (response2.chat_id) {
|
|
53551
|
-
console.log(
|
|
53618
|
+
console.log(import_chalk22.default.gray(` Chat: ${response2.chat_id}`));
|
|
53552
53619
|
}
|
|
53553
53620
|
if (response2.position !== void 0 && response2.position > 0) {
|
|
53554
|
-
console.log(
|
|
53621
|
+
console.log(import_chalk22.default.gray(` Queue position: ${response2.position}`));
|
|
53555
53622
|
}
|
|
53556
53623
|
console.log();
|
|
53557
53624
|
});
|
|
@@ -53578,40 +53645,40 @@ async function replicaReadCommand(id, options) {
|
|
|
53578
53645
|
`/v1/replica/${id}/history${query ? "?" + query : ""}`
|
|
53579
53646
|
);
|
|
53580
53647
|
output2(response, (response2) => {
|
|
53581
|
-
console.log(
|
|
53648
|
+
console.log(import_chalk22.default.green(`
|
|
53582
53649
|
Conversation History
|
|
53583
53650
|
`));
|
|
53584
53651
|
if (response2.coding_agent) {
|
|
53585
|
-
console.log(
|
|
53652
|
+
console.log(import_chalk22.default.gray(` Agent: ${response2.coding_agent}`));
|
|
53586
53653
|
}
|
|
53587
53654
|
if (response2.thread_id) {
|
|
53588
|
-
console.log(
|
|
53655
|
+
console.log(import_chalk22.default.gray(` Thread ID: ${response2.thread_id}`));
|
|
53589
53656
|
}
|
|
53590
|
-
console.log(
|
|
53657
|
+
console.log(import_chalk22.default.gray(` Total Events: ${response2.total}`));
|
|
53591
53658
|
if (response2.has_more) {
|
|
53592
53659
|
const previousPage = response2.beforeCursor ? `--before '${response2.beforeCursor}'` : `--before-event ${response2.eventsStartIndex}`;
|
|
53593
|
-
console.log(
|
|
53660
|
+
console.log(import_chalk22.default.gray(` Has More: yes (${previousPage} for the previous page)`));
|
|
53594
53661
|
}
|
|
53595
53662
|
console.log();
|
|
53596
53663
|
if (response2.events.length === 0) {
|
|
53597
|
-
console.log(
|
|
53664
|
+
console.log(import_chalk22.default.yellow(" No events found.\n"));
|
|
53598
53665
|
return;
|
|
53599
53666
|
}
|
|
53600
|
-
console.log(
|
|
53667
|
+
console.log(import_chalk22.default.gray("-".repeat(60)));
|
|
53601
53668
|
const agentType = response2.coding_agent || "claude";
|
|
53602
53669
|
const displayMessages = parseDisplayMessages(response2.events, agentType);
|
|
53603
53670
|
for (const message2 of displayMessages) {
|
|
53604
53671
|
formatDisplayMessage(message2);
|
|
53605
53672
|
}
|
|
53606
|
-
console.log(
|
|
53673
|
+
console.log(import_chalk22.default.gray("\n" + "-".repeat(60)));
|
|
53607
53674
|
console.log();
|
|
53608
53675
|
});
|
|
53609
53676
|
}
|
|
53610
|
-
var
|
|
53677
|
+
var import_chalk22, CLI_CODING_AGENT_LABEL;
|
|
53611
53678
|
var init_replica2 = __esm({
|
|
53612
53679
|
"src/commands/replica.ts"() {
|
|
53613
53680
|
"use strict";
|
|
53614
|
-
|
|
53681
|
+
import_chalk22 = __toESM(require("chalk"));
|
|
53615
53682
|
init_api2();
|
|
53616
53683
|
init_environment3();
|
|
53617
53684
|
init_command_utils();
|
|
@@ -53627,7 +53694,7 @@ async function workspaceRenameCommand(id, name) {
|
|
|
53627
53694
|
method: "PATCH",
|
|
53628
53695
|
body: { name }
|
|
53629
53696
|
});
|
|
53630
|
-
output2(response, ({ workspace }) => console.log(
|
|
53697
|
+
output2(response, ({ workspace }) => console.log(import_chalk23.default.green(`Renamed workspace to ${workspace.name}`)));
|
|
53631
53698
|
}
|
|
53632
53699
|
async function workspaceWakeCommand(id, options) {
|
|
53633
53700
|
await orgAuthenticatedFetch(`/v1/replica/${id}/wake${options.restore ? "?restore=true" : ""}`, { method: "POST" });
|
|
@@ -53647,7 +53714,7 @@ async function workspaceWaitCommand(id, options) {
|
|
|
53647
53714
|
if (options.chat) query.set("chat_id", options.chat);
|
|
53648
53715
|
const step = result?.activity.current_step;
|
|
53649
53716
|
result = await orgAuthenticatedFetch(`/v1/replica/${id}/wait?${query}`);
|
|
53650
|
-
if (!result.done && result.activity.current_step && result.activity.current_step !== step) console.error(
|
|
53717
|
+
if (!result.done && result.activity.current_step && result.activity.current_step !== step) console.error(import_chalk23.default.gray(`\u2026 ${result.activity.current_step}`));
|
|
53651
53718
|
} while (!result.done && result.activity.state !== "waiting_for_input" && Date.now() < deadline);
|
|
53652
53719
|
output2(result, ({ done, status, deleted, activity }) => {
|
|
53653
53720
|
console.log(done ? `Done (status: ${deleted ? "deleted" : status})` : activity.state === "waiting_for_input" ? "The agent is waiting for input" : `Still working after timeout (status: ${status})`);
|
|
@@ -53659,7 +53726,7 @@ async function workspaceStatusCommand(id) {
|
|
|
53659
53726
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/status`), (status) => {
|
|
53660
53727
|
const agentsWith = (suffix) => Object.entries(status).filter(([key, value]) => value === true && key.startsWith("is") && key.endsWith(suffix)).map(([key]) => key.slice(2, -suffix.length).toLowerCase());
|
|
53661
53728
|
console.log(`Status: ${status.status}`);
|
|
53662
|
-
if (status.message || status.error) console.log(
|
|
53729
|
+
if (status.message || status.error) console.log(import_chalk23.default.yellow(status.message || status.error));
|
|
53663
53730
|
const working = agentsWith("Processing");
|
|
53664
53731
|
const awaiting = agentsWith("AwaitingInput");
|
|
53665
53732
|
if (working.length > 0) console.log(`Working: ${working.join(", ")}`);
|
|
@@ -53687,8 +53754,8 @@ async function workspaceExecCommand(id, command, options) {
|
|
|
53687
53754
|
output2(result, () => {
|
|
53688
53755
|
process.stdout.write(result.output.endsWith("\n") || !result.output ? result.output : `${result.output}
|
|
53689
53756
|
`);
|
|
53690
|
-
if (result.truncated) console.error(
|
|
53691
|
-
if (result.timed_out) console.error(
|
|
53757
|
+
if (result.truncated) console.error(import_chalk23.default.yellow("Output truncated."));
|
|
53758
|
+
if (result.timed_out) console.error(import_chalk23.default.yellow("Command timed out."));
|
|
53692
53759
|
});
|
|
53693
53760
|
process.exitCode = result.exit_code ?? 1;
|
|
53694
53761
|
}
|
|
@@ -53703,11 +53770,11 @@ async function workspaceHooksCommand(id) {
|
|
|
53703
53770
|
return;
|
|
53704
53771
|
}
|
|
53705
53772
|
for (const entry of entries) {
|
|
53706
|
-
const result = entry.timedOut ?
|
|
53707
|
-
console.log(
|
|
53773
|
+
const result = entry.timedOut ? import_chalk23.default.red("timed out") : entry.exitCode === 0 ? import_chalk23.default.green("exit 0") : import_chalk23.default.red(`exit ${entry.exitCode}`);
|
|
53774
|
+
console.log(import_chalk23.default.bold(`
|
|
53708
53775
|
[${entry.kind}] ${entry.hookName} (${entry.hookType}) ${result} at ${formatDate(entry.executedAt)}`));
|
|
53709
53776
|
console.log(entry.output.trimEnd());
|
|
53710
|
-
if (entry.outputTruncated) console.log(
|
|
53777
|
+
if (entry.outputTruncated) console.log(import_chalk23.default.gray(`\u2026 truncated (${entry.outputTotalChars} chars total)`));
|
|
53711
53778
|
}
|
|
53712
53779
|
});
|
|
53713
53780
|
}
|
|
@@ -53715,7 +53782,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
53715
53782
|
if (!sessionId) {
|
|
53716
53783
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs`), ({ currentSessionId, sessions }) => {
|
|
53717
53784
|
for (const session of sessions) {
|
|
53718
|
-
const current = session.sessionId === currentSessionId ?
|
|
53785
|
+
const current = session.sessionId === currentSessionId ? import_chalk23.default.green(" (current)") : "";
|
|
53719
53786
|
console.log(`${session.sessionId} ${session.sizeBytes} bytes ${formatDate(session.updatedAt)}${current}`);
|
|
53720
53787
|
}
|
|
53721
53788
|
});
|
|
@@ -53728,7 +53795,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
53728
53795
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs/${sessionId}${query ? `?${query}` : ""}`), (log) => {
|
|
53729
53796
|
console.log(log.lines.join("\n"));
|
|
53730
53797
|
if (log.hasMore) {
|
|
53731
|
-
console.error(
|
|
53798
|
+
console.error(import_chalk23.default.gray(`Lines ${log.offset}-${log.offset + log.lines.length} of ${log.totalLines}. Next: --offset ${log.offset + log.lines.length}`));
|
|
53732
53799
|
}
|
|
53733
53800
|
});
|
|
53734
53801
|
}
|
|
@@ -53768,16 +53835,16 @@ async function prViewCommand(id, prUrls) {
|
|
|
53768
53835
|
);
|
|
53769
53836
|
output2(response, ({ pullRequests }) => {
|
|
53770
53837
|
for (const { url: url2, details, error: error62 } of pullRequests) {
|
|
53771
|
-
console.log(
|
|
53838
|
+
console.log(import_chalk23.default.bold(`
|
|
53772
53839
|
${url2}`));
|
|
53773
53840
|
if (!details) {
|
|
53774
|
-
console.log(
|
|
53841
|
+
console.log(import_chalk23.default.red(` ${error62 ?? "Details unavailable"}`));
|
|
53775
53842
|
continue;
|
|
53776
53843
|
}
|
|
53777
53844
|
console.log(` ${details.title}`);
|
|
53778
53845
|
console.log(` State: ${details.state} Mergeability: ${details.mergeability} CI: ${details.ciStatus}`);
|
|
53779
53846
|
console.log(` ${details.headBranch} \u2192 ${details.baseBranch} +${details.additions ?? 0} -${details.deletions ?? 0} in ${details.changedFiles} files`);
|
|
53780
|
-
if (details.mergeBlockers?.length) console.log(
|
|
53847
|
+
if (details.mergeBlockers?.length) console.log(import_chalk23.default.yellow(` Blocked by: ${details.mergeBlockers.join(", ").replaceAll("_", " ")}`));
|
|
53781
53848
|
}
|
|
53782
53849
|
});
|
|
53783
53850
|
}
|
|
@@ -53817,14 +53884,14 @@ async function canvasPutCommand(id, filename, options) {
|
|
|
53817
53884
|
{ method: "PUT", body }
|
|
53818
53885
|
);
|
|
53819
53886
|
if (!result.saved) throw new Error(`${filename} changed while saving; retry`);
|
|
53820
|
-
output2(result, () => console.log(
|
|
53887
|
+
output2(result, () => console.log(import_chalk23.default.green(`Saved ${filename}`)));
|
|
53821
53888
|
}
|
|
53822
|
-
var import_fs5,
|
|
53889
|
+
var import_fs5, import_chalk23, getCanvasFile;
|
|
53823
53890
|
var init_workspace = __esm({
|
|
53824
53891
|
"src/commands/workspace.ts"() {
|
|
53825
53892
|
"use strict";
|
|
53826
53893
|
import_fs5 = __toESM(require("fs"));
|
|
53827
|
-
|
|
53894
|
+
import_chalk23 = __toESM(require("chalk"));
|
|
53828
53895
|
init_src();
|
|
53829
53896
|
init_api2();
|
|
53830
53897
|
init_command_utils();
|
|
@@ -53840,7 +53907,7 @@ function printQueue(queue) {
|
|
|
53840
53907
|
return;
|
|
53841
53908
|
}
|
|
53842
53909
|
queue.forEach((message2, index) => {
|
|
53843
|
-
const steered = message2.steeredAt ?
|
|
53910
|
+
const steered = message2.steeredAt ? import_chalk24.default.cyan(" (steered)") : "";
|
|
53844
53911
|
console.log(`${index} ${message2.id}${steered} ${message2.message.replace(/\s+/g, " ").slice(0, 120)}`);
|
|
53845
53912
|
});
|
|
53846
53913
|
}
|
|
@@ -53850,7 +53917,7 @@ function printGoal({ goal }) {
|
|
|
53850
53917
|
async function chatListCommand(id) {
|
|
53851
53918
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/chats`), ({ chats }) => {
|
|
53852
53919
|
for (const chat2 of chats) {
|
|
53853
|
-
console.log(`${chat2.id} ${chat2.provider} ${chat2.processing ?
|
|
53920
|
+
console.log(`${chat2.id} ${chat2.provider} ${chat2.processing ? import_chalk24.default.green("working") : "idle"} ${chat2.title}`);
|
|
53854
53921
|
}
|
|
53855
53922
|
});
|
|
53856
53923
|
}
|
|
@@ -53873,7 +53940,7 @@ async function chatRestoreCommand(id, chatId) {
|
|
|
53873
53940
|
outputSuccess(`Restored chat ${chatId}`);
|
|
53874
53941
|
}
|
|
53875
53942
|
async function chatInterruptCommand(id, chatId) {
|
|
53876
|
-
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/interrupt"), { method: "POST" }), ({ interrupted }) => console.log(interrupted ?
|
|
53943
|
+
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/interrupt"), { method: "POST" }), ({ interrupted }) => console.log(interrupted ? import_chalk24.default.green("Interrupted.") : "Nothing to interrupt."));
|
|
53877
53944
|
}
|
|
53878
53945
|
async function chatForkCommand(id, chatId, options) {
|
|
53879
53946
|
const provider2 = parseReplicaAgent(options.agent);
|
|
@@ -53903,7 +53970,7 @@ async function chatAnswerCommand(id, chatId, requestId, selectionId) {
|
|
|
53903
53970
|
method: "POST",
|
|
53904
53971
|
body: { requestId, selectionId }
|
|
53905
53972
|
});
|
|
53906
|
-
output2(response, ({ resolved }) => console.log(resolved ?
|
|
53973
|
+
output2(response, ({ resolved }) => console.log(resolved ? import_chalk24.default.green("Answer sent.") : import_chalk24.default.yellow("That question is no longer pending.")));
|
|
53907
53974
|
}
|
|
53908
53975
|
async function chatCommandsCommand(id, chatId) {
|
|
53909
53976
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/slash-commands")), ({ commands }) => {
|
|
@@ -53914,7 +53981,7 @@ async function chatCommandsCommand(id, chatId) {
|
|
|
53914
53981
|
}
|
|
53915
53982
|
async function chatQueueListCommand(id, chatId) {
|
|
53916
53983
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/queue")), ({ processing, queue }) => {
|
|
53917
|
-
console.log(
|
|
53984
|
+
console.log(import_chalk24.default.gray(processing ? "Agent is working." : "Agent is idle."));
|
|
53918
53985
|
printQueue(queue);
|
|
53919
53986
|
});
|
|
53920
53987
|
}
|
|
@@ -53924,11 +53991,11 @@ async function mutateQueue(path11, method, body) {
|
|
|
53924
53991
|
else console.log("Done.");
|
|
53925
53992
|
});
|
|
53926
53993
|
}
|
|
53927
|
-
var
|
|
53994
|
+
var import_chalk24, chatPath2, chatQueueClearCommand, chatQueueRemoveCommand, chatQueueEditCommand, chatQueueMoveCommand, chatQueueActionCommand;
|
|
53928
53995
|
var init_chat = __esm({
|
|
53929
53996
|
"src/commands/chat.ts"() {
|
|
53930
53997
|
"use strict";
|
|
53931
|
-
|
|
53998
|
+
import_chalk24 = __toESM(require("chalk"));
|
|
53932
53999
|
init_api2();
|
|
53933
54000
|
init_output();
|
|
53934
54001
|
init_replica2();
|
|
@@ -53972,13 +54039,13 @@ async function pluginsDisconnectCommand(pluginId, options) {
|
|
|
53972
54039
|
await pluginsPath(options, `/${pluginId}${options.connection ? `/connections/${options.connection}` : ""}`),
|
|
53973
54040
|
{ method: "DELETE" }
|
|
53974
54041
|
);
|
|
53975
|
-
output2(response, ({ success: success2 }) => console.log(success2 ?
|
|
54042
|
+
output2(response, ({ success: success2 }) => console.log(success2 ? import_chalk25.default.green(`Disconnected ${pluginId}`) : `${pluginId} was not connected`));
|
|
53976
54043
|
}
|
|
53977
|
-
var
|
|
54044
|
+
var import_chalk25, pluginsPath;
|
|
53978
54045
|
var init_plugins3 = __esm({
|
|
53979
54046
|
"src/commands/plugins.ts"() {
|
|
53980
54047
|
"use strict";
|
|
53981
|
-
|
|
54048
|
+
import_chalk25 = __toESM(require("chalk"));
|
|
53982
54049
|
init_api2();
|
|
53983
54050
|
init_command_utils();
|
|
53984
54051
|
init_output();
|
|
@@ -53997,20 +54064,20 @@ async function fetchCurrentRun() {
|
|
|
53997
54064
|
}
|
|
53998
54065
|
async function environmentSetupStatusCommand() {
|
|
53999
54066
|
output2(await fetchCurrentRun(), ({ run: run2, environment: environment2, repositories }) => {
|
|
54000
|
-
console.log(
|
|
54067
|
+
console.log(import_chalk26.default.bold(`
|
|
54001
54068
|
Environment setup: ${environment2.name}
|
|
54002
54069
|
`));
|
|
54003
54070
|
console.log(` Run: ${run2.id}`);
|
|
54004
|
-
console.log(` Status: ${run2.status}${run2.error ?
|
|
54071
|
+
console.log(` Status: ${run2.status}${run2.error ? import_chalk26.default.red(` (${run2.error})`) : ""}`);
|
|
54005
54072
|
console.log(` Environment: ${environment2.id}`);
|
|
54006
54073
|
console.log(` Repositories: ${repositories.map((repo) => `${repo.name} (${repo.default_branch})`).join(", ") || "none"}`);
|
|
54007
54074
|
console.log("\n Steps:");
|
|
54008
54075
|
for (const step of ENVIRONMENT_SETUP_STEPS) {
|
|
54009
54076
|
const status = run2.steps[step.key] ?? "pending";
|
|
54010
|
-
const marker = status === "completed" ?
|
|
54011
|
-
console.log(` ${marker} ${step.key.padEnd(11)} ${
|
|
54077
|
+
const marker = status === "completed" ? import_chalk26.default.green("\u2713") : status === "in_progress" ? import_chalk26.default.cyan("\u25B8") : status === "skipped" ? import_chalk26.default.gray("\u2013") : import_chalk26.default.gray("\u25CB");
|
|
54078
|
+
console.log(` ${marker} ${step.key.padEnd(11)} ${import_chalk26.default.gray(step.label)} ${import_chalk26.default.gray(`[${status}]`)}`);
|
|
54012
54079
|
}
|
|
54013
|
-
console.log(run2.proposal ?
|
|
54080
|
+
console.log(run2.proposal ? import_chalk26.default.gray("\n A proposal has been submitted. Run `propose` again to replace it.\n") : import_chalk26.default.gray("\n No proposal yet. Submit one with `replicas environment-setup propose --file <path>`.\n"));
|
|
54014
54081
|
});
|
|
54015
54082
|
}
|
|
54016
54083
|
async function environmentSetupStepCommand(key, status) {
|
|
@@ -54026,7 +54093,7 @@ async function environmentSetupStepCommand(key, status) {
|
|
|
54026
54093
|
method: "POST",
|
|
54027
54094
|
body
|
|
54028
54095
|
});
|
|
54029
|
-
output2(result, () => console.log(
|
|
54096
|
+
output2(result, () => console.log(import_chalk26.default.green(`
|
|
54030
54097
|
\u2713 ${key} \u2192 ${status}
|
|
54031
54098
|
`)));
|
|
54032
54099
|
}
|
|
@@ -54045,22 +54112,22 @@ async function environmentSetupProposeCommand(options) {
|
|
|
54045
54112
|
body: { proposal }
|
|
54046
54113
|
});
|
|
54047
54114
|
output2(result, ({ run: { proposal: submitted } }) => {
|
|
54048
|
-
console.log(
|
|
54115
|
+
console.log(import_chalk26.default.green("\n\u2713 Proposal submitted.\n"));
|
|
54049
54116
|
if (submitted) {
|
|
54050
54117
|
console.log(` Automations: ${submitted.automations.length}`);
|
|
54051
54118
|
console.log(` Variables: ${submitted.variables.length}`);
|
|
54052
54119
|
console.log(` Checks: ${submitted.verification.length}`);
|
|
54053
54120
|
console.log(` Media: ${submitted.media.length}`);
|
|
54054
54121
|
}
|
|
54055
|
-
console.log(
|
|
54122
|
+
console.log(import_chalk26.default.gray("\n The user reviews and saves it from the Environment panel; nothing has been applied yet.\n"));
|
|
54056
54123
|
});
|
|
54057
54124
|
}
|
|
54058
|
-
var import_fs6,
|
|
54125
|
+
var import_fs6, import_chalk26, STEP_KEYS;
|
|
54059
54126
|
var init_environment_setup2 = __esm({
|
|
54060
54127
|
"src/commands/environment-setup.ts"() {
|
|
54061
54128
|
"use strict";
|
|
54062
54129
|
import_fs6 = __toESM(require("fs"));
|
|
54063
|
-
|
|
54130
|
+
import_chalk26 = __toESM(require("chalk"));
|
|
54064
54131
|
init_api2();
|
|
54065
54132
|
init_command_utils();
|
|
54066
54133
|
init_config();
|
|
@@ -54303,41 +54370,41 @@ function resolveSelectableEnvironmentId(envInput, selectableEnvs) {
|
|
|
54303
54370
|
return resolved.id;
|
|
54304
54371
|
}
|
|
54305
54372
|
function printAutomation(automation2) {
|
|
54306
|
-
console.log(
|
|
54307
|
-
console.log(
|
|
54308
|
-
console.log(
|
|
54373
|
+
console.log(import_chalk27.default.white(` ${automation2.name}`));
|
|
54374
|
+
console.log(import_chalk27.default.gray(` ID: ${automation2.id}`));
|
|
54375
|
+
console.log(import_chalk27.default.gray(` Owner: ${automation2.user_id ? "personal" : "organization"}`));
|
|
54309
54376
|
if (automation2.description) {
|
|
54310
|
-
console.log(
|
|
54377
|
+
console.log(import_chalk27.default.gray(` Description: ${automation2.description}`));
|
|
54311
54378
|
}
|
|
54312
|
-
console.log(
|
|
54379
|
+
console.log(import_chalk27.default.gray(` Enabled: ${automation2.enabled ? import_chalk27.default.green("yes") : import_chalk27.default.red("no")}`));
|
|
54313
54380
|
if (automation2.auto_paused_at) {
|
|
54314
|
-
console.log(
|
|
54381
|
+
console.log(import_chalk27.default.yellow(` ${truncate2(formatAutoPause(automation2), 120)}`));
|
|
54315
54382
|
}
|
|
54316
54383
|
if (automation2.triggers.length > 0) {
|
|
54317
|
-
console.log(
|
|
54384
|
+
console.log(import_chalk27.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
54318
54385
|
}
|
|
54319
54386
|
if (automation2.github_check_names.length > 0) {
|
|
54320
|
-
console.log(
|
|
54387
|
+
console.log(import_chalk27.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
54321
54388
|
}
|
|
54322
|
-
console.log(
|
|
54389
|
+
console.log(import_chalk27.default.gray(` Prompt: ${truncate2(automation2.prompt, 80)}`));
|
|
54323
54390
|
if (automation2.cron_next_fire_at) {
|
|
54324
|
-
console.log(
|
|
54391
|
+
console.log(import_chalk27.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
54325
54392
|
}
|
|
54326
|
-
console.log(
|
|
54327
|
-
console.log(
|
|
54328
|
-
if (automation2.background) console.log(
|
|
54393
|
+
console.log(import_chalk27.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
54394
|
+
console.log(import_chalk27.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
54395
|
+
if (automation2.background) console.log(import_chalk27.default.gray(" List: background"));
|
|
54329
54396
|
if (automation2.workspace_lifecycle_policy && automation2.workspace_lifecycle_policy !== "default") {
|
|
54330
|
-
console.log(
|
|
54397
|
+
console.log(import_chalk27.default.gray(` Lifecycle: ${automation2.workspace_lifecycle_policy}`));
|
|
54331
54398
|
}
|
|
54332
54399
|
if (automation2.agent_provider || automation2.model || automation2.thinking_level) {
|
|
54333
|
-
console.log(
|
|
54400
|
+
console.log(import_chalk27.default.gray(` Agent: ${formatAgentSummary(automation2)}`));
|
|
54334
54401
|
}
|
|
54335
54402
|
if (automation2.plan_mode || automation2.goal_mode || automation2.fast_mode) {
|
|
54336
|
-
console.log(
|
|
54403
|
+
console.log(import_chalk27.default.gray(` Modes: ${formatModeSummary(automation2)}`));
|
|
54337
54404
|
}
|
|
54338
|
-
console.log(
|
|
54339
|
-
console.log(
|
|
54340
|
-
console.log(
|
|
54405
|
+
console.log(import_chalk27.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? import_chalk27.default.green("managed") : "read-only"}`));
|
|
54406
|
+
console.log(import_chalk27.default.gray(` Created: ${formatDate(automation2.created_at)}`));
|
|
54407
|
+
console.log(import_chalk27.default.gray(` Updated: ${formatDate(automation2.updated_at)}`));
|
|
54341
54408
|
console.log();
|
|
54342
54409
|
}
|
|
54343
54410
|
async function resolveCredentialsMember(value) {
|
|
@@ -54368,10 +54435,10 @@ async function automationListCommand(options) {
|
|
|
54368
54435
|
);
|
|
54369
54436
|
output2(response, (response2) => {
|
|
54370
54437
|
if (response2.automations.length === 0) {
|
|
54371
|
-
console.log(
|
|
54438
|
+
console.log(import_chalk27.default.yellow("\nNo automations found.\n"));
|
|
54372
54439
|
return;
|
|
54373
54440
|
}
|
|
54374
|
-
console.log(
|
|
54441
|
+
console.log(import_chalk27.default.green(`
|
|
54375
54442
|
Automations (Page ${response2.page} of ${response2.totalPages}, Total: ${response2.total}):
|
|
54376
54443
|
`));
|
|
54377
54444
|
for (const automation2 of response2.automations) {
|
|
@@ -54383,49 +54450,49 @@ async function automationGetCommand(id) {
|
|
|
54383
54450
|
ensureOrgApiAuthenticated();
|
|
54384
54451
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`);
|
|
54385
54452
|
output2(response.automation, (automation2) => {
|
|
54386
|
-
console.log(
|
|
54453
|
+
console.log(import_chalk27.default.green(`
|
|
54387
54454
|
Automation: ${automation2.name}
|
|
54388
54455
|
`));
|
|
54389
|
-
console.log(
|
|
54456
|
+
console.log(import_chalk27.default.gray(` ID: ${automation2.id}`));
|
|
54390
54457
|
if (automation2.description) {
|
|
54391
|
-
console.log(
|
|
54458
|
+
console.log(import_chalk27.default.gray(` Description: ${automation2.description}`));
|
|
54392
54459
|
}
|
|
54393
|
-
console.log(
|
|
54460
|
+
console.log(import_chalk27.default.gray(` Enabled: ${automation2.enabled ? import_chalk27.default.green("yes") : import_chalk27.default.red("no")}`));
|
|
54394
54461
|
if (automation2.auto_paused_at) {
|
|
54395
|
-
console.log(
|
|
54462
|
+
console.log(import_chalk27.default.yellow(` ${formatAutoPause(automation2)}`));
|
|
54396
54463
|
}
|
|
54397
54464
|
if (automation2.triggers.length > 0) {
|
|
54398
|
-
console.log(
|
|
54465
|
+
console.log(import_chalk27.default.gray(` Triggers:`));
|
|
54399
54466
|
for (const trigger of automation2.triggers) {
|
|
54400
|
-
console.log(
|
|
54467
|
+
console.log(import_chalk27.default.gray(` - ${formatTrigger(trigger)}`));
|
|
54401
54468
|
}
|
|
54402
54469
|
}
|
|
54403
54470
|
if (automation2.github_check_names.length > 0) {
|
|
54404
|
-
console.log(
|
|
54471
|
+
console.log(import_chalk27.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
54405
54472
|
}
|
|
54406
|
-
console.log(
|
|
54407
|
-
console.log(
|
|
54473
|
+
console.log(import_chalk27.default.gray(` Prompt: ${automation2.prompt}`));
|
|
54474
|
+
console.log(import_chalk27.default.gray(` Environment: ${automation2.environment_id}`));
|
|
54408
54475
|
if (automation2.cron_next_fire_at) {
|
|
54409
|
-
console.log(
|
|
54476
|
+
console.log(import_chalk27.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
54410
54477
|
}
|
|
54411
|
-
console.log(
|
|
54412
|
-
console.log(
|
|
54413
|
-
console.log(
|
|
54414
|
-
if (automation2.credential_user_id) console.log(
|
|
54415
|
-
console.log(
|
|
54478
|
+
console.log(import_chalk27.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
54479
|
+
console.log(import_chalk27.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
54480
|
+
console.log(import_chalk27.default.gray(` List: ${automation2.background ? "background" : "main"}`));
|
|
54481
|
+
if (automation2.credential_user_id) console.log(import_chalk27.default.gray(` Credentials: member ${automation2.credential_user_id}, then the organization's`));
|
|
54482
|
+
console.log(import_chalk27.default.gray(` Size: ${automation2.workspace_size ?? DEFAULT_WORKSPACE_SIZE}${automation2.target_workspace_id ? " (new workspaces only; runs reuse the pinned workspace)" : ""}`));
|
|
54416
54483
|
if (automation2.workspace_lifecycle_policy) {
|
|
54417
|
-
console.log(
|
|
54484
|
+
console.log(import_chalk27.default.gray(` Lifecycle Policy: ${automation2.workspace_lifecycle_policy}`));
|
|
54418
54485
|
}
|
|
54419
54486
|
if (automation2.workspace_auto_stop_minutes) {
|
|
54420
|
-
console.log(
|
|
54421
|
-
}
|
|
54422
|
-
console.log(
|
|
54423
|
-
console.log(
|
|
54424
|
-
console.log(
|
|
54425
|
-
console.log(
|
|
54426
|
-
console.log(
|
|
54427
|
-
console.log(
|
|
54428
|
-
console.log(
|
|
54487
|
+
console.log(import_chalk27.default.gray(` Auto-stop: ${automation2.workspace_auto_stop_minutes} minutes`));
|
|
54488
|
+
}
|
|
54489
|
+
console.log(import_chalk27.default.gray(` Agent: ${automation2.agent_provider ? getProviderDisplayName(automation2.agent_provider) : "organization default"}`));
|
|
54490
|
+
console.log(import_chalk27.default.gray(` Model: ${automation2.model ? MODEL_LABELS[automation2.model] ?? automation2.model : "agent default"}`));
|
|
54491
|
+
console.log(import_chalk27.default.gray(` Thinking Level: ${automation2.thinking_level ?? "agent default"}`));
|
|
54492
|
+
console.log(import_chalk27.default.gray(` Modes: ${formatModeSummary(automation2)}`));
|
|
54493
|
+
console.log(import_chalk27.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? "managed" : "read-only"}`));
|
|
54494
|
+
console.log(import_chalk27.default.gray(` Created: ${formatDate(automation2.created_at)}`));
|
|
54495
|
+
console.log(import_chalk27.default.gray(` Updated: ${formatDate(automation2.updated_at)}`));
|
|
54429
54496
|
console.log();
|
|
54430
54497
|
});
|
|
54431
54498
|
}
|
|
@@ -54597,7 +54664,7 @@ async function automationCreateCommand(name, options) {
|
|
|
54597
54664
|
});
|
|
54598
54665
|
const answer = response2.name;
|
|
54599
54666
|
if (!answer) {
|
|
54600
|
-
console.log(
|
|
54667
|
+
console.log(import_chalk27.default.yellow("\nCancelled."));
|
|
54601
54668
|
return;
|
|
54602
54669
|
}
|
|
54603
54670
|
automationName = answer;
|
|
@@ -54612,7 +54679,7 @@ async function automationCreateCommand(name, options) {
|
|
|
54612
54679
|
});
|
|
54613
54680
|
const answer = response2.prompt;
|
|
54614
54681
|
if (!answer) {
|
|
54615
|
-
console.log(
|
|
54682
|
+
console.log(import_chalk27.default.yellow("\nCancelled."));
|
|
54616
54683
|
return;
|
|
54617
54684
|
}
|
|
54618
54685
|
automationPrompt = answer;
|
|
@@ -54634,7 +54701,7 @@ async function automationCreateCommand(name, options) {
|
|
|
54634
54701
|
}))
|
|
54635
54702
|
});
|
|
54636
54703
|
if (!envResponse2.env) {
|
|
54637
|
-
console.log(
|
|
54704
|
+
console.log(import_chalk27.default.yellow("\nCancelled."));
|
|
54638
54705
|
return;
|
|
54639
54706
|
}
|
|
54640
54707
|
selectedEnvironmentId = envResponse2.env;
|
|
@@ -54676,25 +54743,25 @@ async function automationCreateCommand(name, options) {
|
|
|
54676
54743
|
...options.fastMode ? { fast_mode: true } : {},
|
|
54677
54744
|
...agentSelection
|
|
54678
54745
|
};
|
|
54679
|
-
console.log(
|
|
54746
|
+
console.log(import_chalk27.default.gray("\nCreating automation..."));
|
|
54680
54747
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
54681
54748
|
method: "POST",
|
|
54682
54749
|
body
|
|
54683
54750
|
});
|
|
54684
54751
|
output2(response.automation, (automation2) => {
|
|
54685
|
-
console.log(
|
|
54752
|
+
console.log(import_chalk27.default.green(`
|
|
54686
54753
|
Created automation: ${automation2.name}`));
|
|
54687
|
-
console.log(
|
|
54688
|
-
console.log(
|
|
54754
|
+
console.log(import_chalk27.default.gray(` ID: ${automation2.id}`));
|
|
54755
|
+
console.log(import_chalk27.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
54689
54756
|
if (automation2.triggers.length > 0) {
|
|
54690
|
-
console.log(
|
|
54757
|
+
console.log(import_chalk27.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
54691
54758
|
}
|
|
54692
54759
|
if (automation2.cron_next_fire_at) {
|
|
54693
|
-
console.log(
|
|
54760
|
+
console.log(import_chalk27.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)} (${automation2.cron_next_fire_at})`));
|
|
54694
54761
|
}
|
|
54695
|
-
console.log(
|
|
54696
|
-
console.log(
|
|
54697
|
-
console.log(
|
|
54762
|
+
console.log(import_chalk27.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
54763
|
+
console.log(import_chalk27.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
54764
|
+
console.log(import_chalk27.default.gray(` List: ${automation2.background ? "background" : "main"}`));
|
|
54698
54765
|
console.log();
|
|
54699
54766
|
});
|
|
54700
54767
|
}
|
|
@@ -54851,21 +54918,21 @@ async function automationEditCommand(id, options) {
|
|
|
54851
54918
|
Object.assign(body, agentSelection);
|
|
54852
54919
|
}
|
|
54853
54920
|
if (Object.keys(body).length === 0) {
|
|
54854
|
-
output2(existing.automation, () => console.log(
|
|
54921
|
+
output2(existing.automation, () => console.log(import_chalk27.default.yellow("\nNo changes made.\n")));
|
|
54855
54922
|
return;
|
|
54856
54923
|
}
|
|
54857
|
-
console.log(
|
|
54924
|
+
console.log(import_chalk27.default.gray("\nUpdating automation..."));
|
|
54858
54925
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`, {
|
|
54859
54926
|
method: "PATCH",
|
|
54860
54927
|
body
|
|
54861
54928
|
});
|
|
54862
54929
|
output2(response.automation, (automation2) => {
|
|
54863
|
-
console.log(
|
|
54930
|
+
console.log(import_chalk27.default.green(`
|
|
54864
54931
|
Updated automation: ${automation2.name}`));
|
|
54865
|
-
console.log(
|
|
54866
|
-
console.log(
|
|
54932
|
+
console.log(import_chalk27.default.gray(` ID: ${automation2.id}`));
|
|
54933
|
+
console.log(import_chalk27.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
54867
54934
|
if (automation2.triggers.length > 0) {
|
|
54868
|
-
console.log(
|
|
54935
|
+
console.log(import_chalk27.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
54869
54936
|
}
|
|
54870
54937
|
console.log();
|
|
54871
54938
|
});
|
|
@@ -54877,7 +54944,7 @@ async function automationRunCommand(id) {
|
|
|
54877
54944
|
if (!hasCronTrigger(automation2.triggers)) {
|
|
54878
54945
|
throw new Error(`Manual run is only allowed for automations with a cron trigger. This automation has triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`);
|
|
54879
54946
|
}
|
|
54880
|
-
console.log(
|
|
54947
|
+
console.log(import_chalk27.default.gray(`
|
|
54881
54948
|
Triggering automation "${automation2.name}"...`));
|
|
54882
54949
|
const response = await orgAuthenticatedFetch(
|
|
54883
54950
|
`/v1/automations/${id}/trigger`,
|
|
@@ -54888,11 +54955,11 @@ Triggering automation "${automation2.name}"...`));
|
|
|
54888
54955
|
);
|
|
54889
54956
|
if (!response.execution_id) throw new Error("Automation trigger returned no execution ID. The automation may not have started.");
|
|
54890
54957
|
output2(response, (response2) => {
|
|
54891
|
-
console.log(
|
|
54958
|
+
console.log(import_chalk27.default.green(`
|
|
54892
54959
|
Automation triggered successfully.`));
|
|
54893
|
-
console.log(
|
|
54960
|
+
console.log(import_chalk27.default.gray(` Execution ID: ${response2.execution_id}`));
|
|
54894
54961
|
if (response2.workspace_id) {
|
|
54895
|
-
console.log(
|
|
54962
|
+
console.log(import_chalk27.default.gray(` Workspace ID: ${response2.workspace_id}`));
|
|
54896
54963
|
}
|
|
54897
54964
|
console.log();
|
|
54898
54965
|
});
|
|
@@ -54926,9 +54993,9 @@ async function automationCheckCommand(checkRunId, options) {
|
|
|
54926
54993
|
`/v1/automations/checks/${id}`,
|
|
54927
54994
|
{ method: "POST", body }
|
|
54928
54995
|
);
|
|
54929
|
-
output2(response, (response2) => console.log(response2.reported ?
|
|
54996
|
+
output2(response, (response2) => console.log(response2.reported ? import_chalk27.default.green(`
|
|
54930
54997
|
Reported ${conclusion} for "${response2.name}".
|
|
54931
|
-
`) :
|
|
54998
|
+
`) : import_chalk27.default.yellow(`
|
|
54932
54999
|
Skipped "${response2.name}" \u2014 a newer run of this automation owns it and will report the verdict.
|
|
54933
55000
|
`)));
|
|
54934
55001
|
}
|
|
@@ -54944,7 +55011,7 @@ async function automationExecutionsCommand(id, options) {
|
|
|
54944
55011
|
for (const execution of response2.executions) {
|
|
54945
55012
|
console.log(`${execution.id} ${execution.status} ${formatDate(execution.triggered_at)} ${execution.workspace_id ?? "-"}${execution.error ? ` ${execution.error}` : ""}`);
|
|
54946
55013
|
}
|
|
54947
|
-
console.log(
|
|
55014
|
+
console.log(import_chalk27.default.gray(`Page ${response2.page} of ${response2.totalPages} (${response2.total} runs)`));
|
|
54948
55015
|
});
|
|
54949
55016
|
}
|
|
54950
55017
|
async function automationRetryCommand(id, executionId) {
|
|
@@ -54952,13 +55019,13 @@ async function automationRetryCommand(id, executionId) {
|
|
|
54952
55019
|
`/v1/automations/${id}/executions/${executionId}/retry`,
|
|
54953
55020
|
{ method: "POST" }
|
|
54954
55021
|
);
|
|
54955
|
-
output2(response, (response2) => console.log(
|
|
55022
|
+
output2(response, (response2) => console.log(import_chalk27.default.green(`Retried as execution ${response2.execution_id}${response2.workspace_id ? ` in workspace ${response2.workspace_id}` : ""}`)));
|
|
54956
55023
|
}
|
|
54957
|
-
var
|
|
55024
|
+
var import_chalk27, DURATION_UNIT_MS;
|
|
54958
55025
|
var init_automation = __esm({
|
|
54959
55026
|
"src/commands/automation.ts"() {
|
|
54960
55027
|
"use strict";
|
|
54961
|
-
|
|
55028
|
+
import_chalk27 = __toESM(require("chalk"));
|
|
54962
55029
|
init_output();
|
|
54963
55030
|
init_api2();
|
|
54964
55031
|
init_config();
|
|
@@ -55077,9 +55144,9 @@ async function previewListCommand(workspaceId) {
|
|
|
55077
55144
|
`/v1/replica/${workspaceId}/previews`
|
|
55078
55145
|
);
|
|
55079
55146
|
output2(result, ({ previews }) => {
|
|
55080
|
-
if (previews.length === 0) console.log(
|
|
55147
|
+
if (previews.length === 0) console.log(import_chalk28.default.dim("No active previews"));
|
|
55081
55148
|
for (const preview2 of previews) {
|
|
55082
|
-
console.log(` ${
|
|
55149
|
+
console.log(` ${import_chalk28.default.cyan(String(preview2.port))} \u2192 ${import_chalk28.default.underline(preview2.publicUrl)}`);
|
|
55083
55150
|
}
|
|
55084
55151
|
});
|
|
55085
55152
|
}
|
|
@@ -55093,7 +55160,7 @@ async function previewAddCommand(workspaceId, options) {
|
|
|
55093
55160
|
body: { port: portNum, authenticated: options.authenticated ?? false }
|
|
55094
55161
|
}
|
|
55095
55162
|
);
|
|
55096
|
-
output2(result, ({ preview: preview2 }) => console.log(
|
|
55163
|
+
output2(result, ({ preview: preview2 }) => console.log(import_chalk28.default.green(`Preview created: ${preview2.publicUrl}`)));
|
|
55097
55164
|
}
|
|
55098
55165
|
async function previewDeleteCommand(port) {
|
|
55099
55166
|
const portNum = parsePreviewPort(port);
|
|
@@ -55108,11 +55175,11 @@ async function previewRemoveCommand(workspaceId, options) {
|
|
|
55108
55175
|
);
|
|
55109
55176
|
outputSuccess(`Preview deleted on port ${portNum}`);
|
|
55110
55177
|
}
|
|
55111
|
-
var
|
|
55178
|
+
var import_chalk28, parsePreviewPort;
|
|
55112
55179
|
var init_preview = __esm({
|
|
55113
55180
|
"src/commands/preview.ts"() {
|
|
55114
55181
|
"use strict";
|
|
55115
|
-
|
|
55182
|
+
import_chalk28 = __toESM(require("chalk"));
|
|
55116
55183
|
init_config();
|
|
55117
55184
|
init_agent_api();
|
|
55118
55185
|
init_api2();
|
|
@@ -55772,10 +55839,10 @@ function parseEnv(values) {
|
|
|
55772
55839
|
return values?.length ? parseKeyValuePairs(values) : void 0;
|
|
55773
55840
|
}
|
|
55774
55841
|
function describe3(sandbox) {
|
|
55775
|
-
console.log(`${
|
|
55776
|
-
console.log(
|
|
55842
|
+
console.log(`${import_chalk29.default.bold(sandbox.id)} ${sandbox.status} ${sandbox.gpu ?? "no GPU"} ${sandbox.image}`);
|
|
55843
|
+
console.log(import_chalk29.default.gray(` expires ${new Date(sandbox.expiresAt).toLocaleString()}`));
|
|
55777
55844
|
for (const tunnel of sandbox.tunnels) console.log(` port ${tunnel.port}: ${tunnel.url}`);
|
|
55778
|
-
if (sandbox.error) console.log(
|
|
55845
|
+
if (sandbox.error) console.log(import_chalk29.default.red(` ${sandbox.error}`));
|
|
55779
55846
|
}
|
|
55780
55847
|
async function resolveSandboxId(options) {
|
|
55781
55848
|
if (options.sandbox) return options.sandbox;
|
|
@@ -55796,7 +55863,7 @@ async function createSandbox(options) {
|
|
|
55796
55863
|
};
|
|
55797
55864
|
let { sandbox } = await agentFetch(BASE, { method: "POST", body: request });
|
|
55798
55865
|
if (options.wait === false) return sandbox;
|
|
55799
|
-
process.stderr.write(
|
|
55866
|
+
process.stderr.write(import_chalk29.default.gray(`Starting ${sandbox.gpu} sandbox ${sandbox.id} (a new image can take a few minutes to pull)...
|
|
55800
55867
|
`));
|
|
55801
55868
|
const deadline = Date.now() + CREATE_WAIT_TIMEOUT_MS;
|
|
55802
55869
|
while (sandbox.status === "creating") {
|
|
@@ -55860,8 +55927,8 @@ async function gpuExecCommand(command, options) {
|
|
|
55860
55927
|
if (options.detach) {
|
|
55861
55928
|
const { jobId } = await response.json();
|
|
55862
55929
|
output2({ jobId, sandboxId }, () => {
|
|
55863
|
-
console.log(`Started job ${
|
|
55864
|
-
console.log(
|
|
55930
|
+
console.log(`Started job ${import_chalk29.default.bold(jobId)} in ${sandboxId}`);
|
|
55931
|
+
console.log(import_chalk29.default.gray(`Follow it with: replicas gpu logs ${jobId} -f`));
|
|
55865
55932
|
});
|
|
55866
55933
|
return;
|
|
55867
55934
|
}
|
|
@@ -55881,13 +55948,13 @@ async function gpuLogsCommand(jobId, options) {
|
|
|
55881
55948
|
return;
|
|
55882
55949
|
}
|
|
55883
55950
|
if (exitCode === null) {
|
|
55884
|
-
process.stderr.write(
|
|
55951
|
+
process.stderr.write(import_chalk29.default.gray(`
|
|
55885
55952
|
Job ${jobId} is still running.
|
|
55886
55953
|
`));
|
|
55887
55954
|
return;
|
|
55888
55955
|
}
|
|
55889
55956
|
if (options.follow) process.exitCode = exitCode;
|
|
55890
|
-
process.stderr.write(
|
|
55957
|
+
process.stderr.write(import_chalk29.default.gray(`
|
|
55891
55958
|
Job ${jobId} exited with code ${exitCode}.
|
|
55892
55959
|
`));
|
|
55893
55960
|
}
|
|
@@ -55995,7 +56062,7 @@ async function gpuRunCommand(command, options) {
|
|
|
55995
56062
|
const { env, ...createOptions } = options;
|
|
55996
56063
|
const sandbox = await createSandbox({ ...createOptions, wait: true });
|
|
55997
56064
|
try {
|
|
55998
|
-
process.stderr.write(
|
|
56065
|
+
process.stderr.write(import_chalk29.default.gray(`Copying ${process.cwd()} to ${COMPUTE_SANDBOX_WORKDIR}...
|
|
55999
56066
|
`));
|
|
56000
56067
|
await push(sandbox.id, ".", COMPUTE_SANDBOX_WORKDIR);
|
|
56001
56068
|
const exitCode = await streamOutput(await exec(sandbox.id, command.join(" "), { env }));
|
|
@@ -56006,16 +56073,16 @@ async function gpuRunCommand(command, options) {
|
|
|
56006
56073
|
if (isJsonMode()) output2({ sandboxId: sandbox.id, exitCode }, () => {
|
|
56007
56074
|
});
|
|
56008
56075
|
} finally {
|
|
56009
|
-
if (options.keep) process.stderr.write(
|
|
56076
|
+
if (options.keep) process.stderr.write(import_chalk29.default.gray(`Kept GPU sandbox ${sandbox.id} running.
|
|
56010
56077
|
`));
|
|
56011
56078
|
else await agentRequest(`${BASE}/${sandbox.id}`, { method: "DELETE" });
|
|
56012
56079
|
}
|
|
56013
56080
|
}
|
|
56014
|
-
var
|
|
56081
|
+
var import_chalk29, import_node_child_process2, import_node_crypto2, import_node_fs2, import_node_os2, import_node_path2, import_node_stream, import_promises, BASE, CREATE_POLL_INTERVAL_MS, CREATE_WAIT_TIMEOUT_MS;
|
|
56015
56082
|
var init_gpu2 = __esm({
|
|
56016
56083
|
"src/commands/gpu.ts"() {
|
|
56017
56084
|
"use strict";
|
|
56018
|
-
|
|
56085
|
+
import_chalk29 = __toESM(require("chalk"));
|
|
56019
56086
|
import_node_child_process2 = require("child_process");
|
|
56020
56087
|
import_node_crypto2 = require("crypto");
|
|
56021
56088
|
import_node_fs2 = require("fs");
|
|
@@ -56047,16 +56114,16 @@ function printSource({ source }) {
|
|
|
56047
56114
|
console.log(`Managed variables: ${source.managed.variables.join(", ") || "(none)"}`);
|
|
56048
56115
|
console.log(`Managed MCPs: ${source.managed.mcps.join(", ") || "(none)"}`);
|
|
56049
56116
|
if (source.required_secrets.length) console.log(`Required secrets: ${source.required_secrets.join(", ")}`);
|
|
56050
|
-
if (source.pending_rebuild) console.log(
|
|
56051
|
-
if (source.last_error) console.log(
|
|
56117
|
+
if (source.pending_rebuild) console.log(import_chalk30.default.yellow("Configuration saved; environment rebuild pending."));
|
|
56118
|
+
if (source.last_error) console.log(import_chalk30.default.red(source.last_error));
|
|
56052
56119
|
}
|
|
56053
56120
|
function printPreview({ preview: preview2 }) {
|
|
56054
56121
|
console.log(preview2.kind === "file" ? `${preview2.filename} @ ${preview2.file_sha}` : `${preview2.repository_name}/${preview2.filename} @ ${preview2.commit_sha}`);
|
|
56055
56122
|
if (preview2.source_url) console.log(preview2.source_url);
|
|
56056
56123
|
if (!preview2.changes.length) console.log("No setting changes. Applying records this configuration.");
|
|
56057
56124
|
for (const change of preview2.changes) console.log(` ${change.operation}: ${change.kind} ${change.key}`);
|
|
56058
|
-
if (preview2.missing_secrets.length) console.log(
|
|
56059
|
-
for (const blocker of preview2.blockers) console.log(
|
|
56125
|
+
if (preview2.missing_secrets.length) console.log(import_chalk30.default.yellow(`Missing required secrets: ${preview2.missing_secrets.join(", ")}`));
|
|
56126
|
+
for (const blocker of preview2.blockers) console.log(import_chalk30.default.red(` Cannot apply: ${blocker}`));
|
|
56060
56127
|
}
|
|
56061
56128
|
async function sourceInput2(options) {
|
|
56062
56129
|
if (options.file && options.repository) throw new Error("Choose either --file or --repository");
|
|
@@ -56127,11 +56194,11 @@ async function environmentConfigDisconnectCommand(environment2, options) {
|
|
|
56127
56194
|
console.log("Configuration source disconnected. Current settings preserved.");
|
|
56128
56195
|
});
|
|
56129
56196
|
}
|
|
56130
|
-
var
|
|
56197
|
+
var import_chalk30, import_promises2, import_node_path3;
|
|
56131
56198
|
var init_environment_config2 = __esm({
|
|
56132
56199
|
"src/commands/environment-config.ts"() {
|
|
56133
56200
|
"use strict";
|
|
56134
|
-
|
|
56201
|
+
import_chalk30 = __toESM(require("chalk"));
|
|
56135
56202
|
import_promises2 = require("fs/promises");
|
|
56136
56203
|
import_node_path3 = require("path");
|
|
56137
56204
|
init_src();
|
|
@@ -56186,12 +56253,12 @@ async function skillsSuggestCommand(file2, options) {
|
|
|
56186
56253
|
async function skillsListCommand() {
|
|
56187
56254
|
output2(await orgAuthenticatedFetch("/v1/learned-skills"), ({ skills: skills2, suggestions }) => {
|
|
56188
56255
|
for (const skill of skills2) console.log(`${skill.id} ${skill.name} ${skill.title}`);
|
|
56189
|
-
if (suggestions.length > 0) console.log(
|
|
56256
|
+
if (suggestions.length > 0) console.log(import_chalk31.default.gray(`${suggestions.length} pending suggestion(s) to review in the dashboard.`));
|
|
56190
56257
|
});
|
|
56191
56258
|
}
|
|
56192
56259
|
async function skillsCreateCommand(file2, options) {
|
|
56193
56260
|
const body = { content: (0, import_node_fs4.readFileSync)(file2, "utf-8"), title: options.title };
|
|
56194
|
-
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body }), ({ id, name }) => console.log(
|
|
56261
|
+
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body }), ({ id, name }) => console.log(import_chalk31.default.green(`Saved learning '${name}' (${id})`)));
|
|
56195
56262
|
}
|
|
56196
56263
|
async function skillsUpdateCommand(id, options) {
|
|
56197
56264
|
const { skills: skills2 } = await orgAuthenticatedFetch("/v1/learned-skills");
|
|
@@ -56201,18 +56268,18 @@ async function skillsUpdateCommand(id, options) {
|
|
|
56201
56268
|
title: options.title ?? existing.title,
|
|
56202
56269
|
content: options.file ? (0, import_node_fs4.readFileSync)(options.file, "utf-8") : existing.content
|
|
56203
56270
|
};
|
|
56204
|
-
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body }), ({ name }) => console.log(
|
|
56271
|
+
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body }), ({ name }) => console.log(import_chalk31.default.green(`Updated learning '${name}'`)));
|
|
56205
56272
|
}
|
|
56206
56273
|
async function skillsDeleteCommand(id) {
|
|
56207
56274
|
await orgAuthenticatedFetch(`/v1/learned-skills/${id}`, { method: "DELETE" });
|
|
56208
56275
|
outputSuccess(`Deleted learning ${id}`);
|
|
56209
56276
|
}
|
|
56210
|
-
var import_node_fs4,
|
|
56277
|
+
var import_node_fs4, import_chalk31;
|
|
56211
56278
|
var init_skills = __esm({
|
|
56212
56279
|
"src/commands/skills.ts"() {
|
|
56213
56280
|
"use strict";
|
|
56214
56281
|
import_node_fs4 = require("fs");
|
|
56215
|
-
|
|
56282
|
+
import_chalk31 = __toESM(require("chalk"));
|
|
56216
56283
|
init_agent_api();
|
|
56217
56284
|
init_api2();
|
|
56218
56285
|
init_monolith_url();
|
|
@@ -56238,10 +56305,10 @@ async function attachThread(request) {
|
|
|
56238
56305
|
body: request
|
|
56239
56306
|
});
|
|
56240
56307
|
output2(response, ({ thread, workspace }) => {
|
|
56241
|
-
console.log(
|
|
56242
|
-
console.log(
|
|
56243
|
-
console.log(
|
|
56244
|
-
console.log(
|
|
56308
|
+
console.log(import_chalk32.default.green("Slack thread attached."));
|
|
56309
|
+
console.log(import_chalk32.default.gray(` Channel: ${thread.channel_id}`));
|
|
56310
|
+
console.log(import_chalk32.default.gray(` Thread: ${thread.thread_ts}`));
|
|
56311
|
+
console.log(import_chalk32.default.gray(` Workspace: ${workspace.name} (${workspace.id})`));
|
|
56245
56312
|
});
|
|
56246
56313
|
}
|
|
56247
56314
|
async function slackThreadAttachCommand(options) {
|
|
@@ -56269,11 +56336,11 @@ async function slackThreadSwitchCommand(workspace, options) {
|
|
|
56269
56336
|
workspace_id: workspaceId
|
|
56270
56337
|
});
|
|
56271
56338
|
}
|
|
56272
|
-
var
|
|
56339
|
+
var import_chalk32;
|
|
56273
56340
|
var init_slack4 = __esm({
|
|
56274
56341
|
"src/commands/slack.ts"() {
|
|
56275
56342
|
"use strict";
|
|
56276
|
-
|
|
56343
|
+
import_chalk32 = __toESM(require("chalk"));
|
|
56277
56344
|
init_api2();
|
|
56278
56345
|
init_config();
|
|
56279
56346
|
init_output();
|
|
@@ -56428,7 +56495,7 @@ async function serviceListCommand() {
|
|
|
56428
56495
|
return;
|
|
56429
56496
|
}
|
|
56430
56497
|
for (const service of services) {
|
|
56431
|
-
const status = service.running ?
|
|
56498
|
+
const status = service.running ? import_chalk33.default.green("running") : import_chalk33.default.red("stopped");
|
|
56432
56499
|
console.log(`${service.name} ${status} pid ${service.pid} started ${service.startedAt}`);
|
|
56433
56500
|
console.log(` command: ${service.command} (cwd: ${service.cwd})`);
|
|
56434
56501
|
console.log(` logs: ${service.logFile}`);
|
|
@@ -56448,11 +56515,11 @@ async function serviceLogsCommand(name, options) {
|
|
|
56448
56515
|
console.log(logs || "(no log output yet)");
|
|
56449
56516
|
});
|
|
56450
56517
|
}
|
|
56451
|
-
var
|
|
56518
|
+
var import_chalk33, import_node_child_process3, import_node_fs5, import_node_os3, import_node_path5, SERVICES_DIR, NAME_PATTERN, LOG_KEEP_BYTES, LOG_TRIM_LOOP;
|
|
56452
56519
|
var init_service = __esm({
|
|
56453
56520
|
"src/commands/service.ts"() {
|
|
56454
56521
|
"use strict";
|
|
56455
|
-
|
|
56522
|
+
import_chalk33 = __toESM(require("chalk"));
|
|
56456
56523
|
import_node_child_process3 = require("child_process");
|
|
56457
56524
|
import_node_fs5 = require("fs");
|
|
56458
56525
|
import_node_os3 = require("os");
|
|
@@ -56509,7 +56576,7 @@ async function deviceConnectCommand() {
|
|
|
56509
56576
|
stream.destroy();
|
|
56510
56577
|
};
|
|
56511
56578
|
sshd.once("error", (error62) => {
|
|
56512
|
-
console.log(
|
|
56579
|
+
console.log(import_chalk34.default.yellow(`A workspace couldn't reach SSH on port ${port} here (${error62.message}). ${REMOTE_LOGIN_HINT}`));
|
|
56513
56580
|
});
|
|
56514
56581
|
sshd.on("error", close).on("close", close);
|
|
56515
56582
|
stream.on("error", close).on("close", close);
|
|
@@ -56553,16 +56620,16 @@ async function deviceConnectCommand() {
|
|
|
56553
56620
|
}
|
|
56554
56621
|
}
|
|
56555
56622
|
const next = problem ?? `\u2713 ${device?.name}: ready for ${waiting.size} ${waiting.size === 1 ? "workspace" : "workspaces"}, forwarding to SSH on port ${port}`;
|
|
56556
|
-
if (next !== summary) console.log(problem ?
|
|
56623
|
+
if (next !== summary) console.log(problem ? import_chalk34.default.yellow(next) : import_chalk34.default.green(next));
|
|
56557
56624
|
summary = next;
|
|
56558
56625
|
await (0, import_promises3.setTimeout)(POLL_INTERVAL_MS);
|
|
56559
56626
|
}
|
|
56560
56627
|
}
|
|
56561
|
-
var
|
|
56628
|
+
var import_chalk34, import_node_child_process4, import_node_net, import_promises3, import_node_util, import_ws, POLL_INTERVAL_MS, HEARTBEAT_MS, MAX_RETRY_DELAY_MS, REMOTE_LOGIN_HINT;
|
|
56562
56629
|
var init_device = __esm({
|
|
56563
56630
|
"src/commands/device.ts"() {
|
|
56564
56631
|
"use strict";
|
|
56565
|
-
|
|
56632
|
+
import_chalk34 = __toESM(require("chalk"));
|
|
56566
56633
|
import_node_child_process4 = require("child_process");
|
|
56567
56634
|
import_node_net = require("net");
|
|
56568
56635
|
import_promises3 = require("timers/promises");
|
|
@@ -56620,8 +56687,8 @@ async function localControlRequestCommand(options) {
|
|
|
56620
56687
|
await orgAuthenticatedFetch("/v1/local-control-request", { method: "DELETE" });
|
|
56621
56688
|
output2({ status: "connected", computers: computers2 }, () => {
|
|
56622
56689
|
console.log(`
|
|
56623
|
-
${
|
|
56624
|
-
console.log(
|
|
56690
|
+
${import_chalk35.default.green("Connected:")} ${computers2.join(", ")}`);
|
|
56691
|
+
console.log(import_chalk35.default.gray(` Run commands there with: ssh ${computers2[0]} '<command>'
|
|
56625
56692
|
`));
|
|
56626
56693
|
});
|
|
56627
56694
|
};
|
|
@@ -56649,10 +56716,10 @@ async function localControlRequestCommand(options) {
|
|
|
56649
56716
|
}
|
|
56650
56717
|
output2({ status: pending ? "pending" : "declined", computers: [], url: created.url }, () => {
|
|
56651
56718
|
if (!pending) {
|
|
56652
|
-
console.log(
|
|
56719
|
+
console.log(import_chalk35.default.yellow("\n The user declined. Continue without their computer, or ask how they want to proceed.\n"));
|
|
56653
56720
|
return;
|
|
56654
56721
|
}
|
|
56655
|
-
console.log(
|
|
56722
|
+
console.log(import_chalk35.default.gray(options.wait === false ? `
|
|
56656
56723
|
Asked above the chat composer (${created.url}). Keep working, and run this command again when you need the computer.
|
|
56657
56724
|
` : created.wait ? `
|
|
56658
56725
|
The request stays open above the chat composer (${created.url}). End your turn and say what you need the computer for. When the user answers, you get a message; run this command again then.
|
|
@@ -56662,7 +56729,7 @@ async function localControlRequestCommand(options) {
|
|
|
56662
56729
|
`));
|
|
56663
56730
|
});
|
|
56664
56731
|
}
|
|
56665
|
-
var import_child_process6, import_fs11, import_os5, import_path10, import_util10,
|
|
56732
|
+
var import_child_process6, import_fs11, import_os5, import_path10, import_util10, import_chalk35, execFileAsync2;
|
|
56666
56733
|
var init_local_control = __esm({
|
|
56667
56734
|
"src/commands/local-control.ts"() {
|
|
56668
56735
|
"use strict";
|
|
@@ -56671,7 +56738,7 @@ var init_local_control = __esm({
|
|
|
56671
56738
|
import_os5 = __toESM(require("os"));
|
|
56672
56739
|
import_path10 = __toESM(require("path"));
|
|
56673
56740
|
import_util10 = require("util");
|
|
56674
|
-
|
|
56741
|
+
import_chalk35 = __toESM(require("chalk"));
|
|
56675
56742
|
init_src();
|
|
56676
56743
|
init_api2();
|
|
56677
56744
|
init_command_utils();
|
|
@@ -56713,7 +56780,7 @@ function registerEnvironmentHookCommands(parent, config3) {
|
|
|
56713
56780
|
}
|
|
56714
56781
|
hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action(run(config3.repositoryHooks));
|
|
56715
56782
|
}
|
|
56716
|
-
var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, media, environment, envConfig, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
|
|
56783
|
+
var import_config20, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, billing, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, media, environment, envConfig, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
|
|
56717
56784
|
var init_src2 = __esm({
|
|
56718
56785
|
"src/index.ts"() {
|
|
56719
56786
|
"use strict";
|
|
@@ -56722,6 +56789,7 @@ var init_src2 = __esm({
|
|
|
56722
56789
|
init_login3();
|
|
56723
56790
|
init_logout();
|
|
56724
56791
|
init_whoami();
|
|
56792
|
+
init_billing2();
|
|
56725
56793
|
init_identity();
|
|
56726
56794
|
init_connect();
|
|
56727
56795
|
init_code();
|
|
@@ -56811,6 +56879,9 @@ var init_src2 = __esm({
|
|
|
56811
56879
|
program.command("whoami").description("Display current authenticated user").action(run(whoamiCommand));
|
|
56812
56880
|
program.command("codex-auth").description("Connect your Codex credentials to Replicas (personal by default)").option("-u, --user", "Store credentials for your personal account (default)").option("-o, --org", "Share credentials with the whole organization (admins only)").option("-y, --yes", "Skip the destination confirmation prompt").action(run(codexAuthCommand));
|
|
56813
56881
|
program.command("claude-auth").description("Connect your Claude Code credentials to Replicas (personal by default)").option("-u, --user", "Store credentials for your personal account (default)").option("-o, --org", "Share credentials with the whole organization (admins only)").option("-y, --yes", "Skip the destination confirmation prompt").action(run(claudeAuthCommand));
|
|
56882
|
+
billing = program.command("billing").description("Show the organization's balance and the limit new workspaces are checked against");
|
|
56883
|
+
billing.command("usage").description("Show usage cost by day and source for the current period (admins only)").option("-b, --bucket <bucket>", "day, week, or month").option("--start <date>", "Start date (ISO 8601)").option("--end <date>", "End date (ISO 8601)").action(run(billingUsageCommand));
|
|
56884
|
+
billing.action(run(billingCommand));
|
|
56814
56885
|
org = program.command("org").description("Manage organizations");
|
|
56815
56886
|
org.command("switch").description("Switch to a different organization").action(run(orgSwitchCommand));
|
|
56816
56887
|
org.command("members").description("List organization members and their user IDs").action(run(orgMembersCommand));
|
|
@@ -57078,7 +57149,8 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
57078
57149
|
"share",
|
|
57079
57150
|
"pr",
|
|
57080
57151
|
"canvas",
|
|
57081
|
-
"plugins"
|
|
57152
|
+
"plugins",
|
|
57153
|
+
"billing"
|
|
57082
57154
|
]);
|
|
57083
57155
|
const kept = program.commands.filter((cmd) => allowed.has(cmd.name()));
|
|
57084
57156
|
const cmds = program.commands;
|
|
@@ -57092,11 +57164,11 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
57092
57164
|
|
|
57093
57165
|
// src/bin.ts
|
|
57094
57166
|
var import_node_child_process5 = require("child_process");
|
|
57095
|
-
var
|
|
57167
|
+
var import_chalk36 = __toESM(require("chalk"));
|
|
57096
57168
|
init_config();
|
|
57097
57169
|
if (process.argv[2] === "computer" && isAgentMode()) {
|
|
57098
57170
|
const result = (0, import_node_child_process5.spawnSync)("replicas-computer", process.argv.slice(3), { stdio: "inherit" });
|
|
57099
|
-
if (result.error) console.error(
|
|
57171
|
+
if (result.error) console.error(import_chalk36.default.red(`
|
|
57100
57172
|
\u2717 replicas-computer is unavailable in this workspace image
|
|
57101
57173
|
`));
|
|
57102
57174
|
process.exitCode = result.error ? 1 : result.status ?? 1;
|