replicas-cli 0.3.655 → 0.3.657
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 +592 -543
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -26063,12 +26063,12 @@ replicas environment-setup step <key> <status>
|
|
|
26063
26063
|
|
|
26064
26064
|
\`status\` prints the environment, repositories, and current steps. Step statuses are \`pending\`, \`in_progress\`, \`completed\`, and \`skipped\`. Step keys, in order: \`understand\`, \`install\`, \`verify\`, \`configure\`, \`propose\`. Mark the first step \`in_progress\` before your first tool call, keep exactly one step \`in_progress\`, and mark a step \`completed\` only after its work actually succeeded. Use \`skipped\` when something genuinely cannot run (for example no browser UI to record) and say so in the proposal.
|
|
26065
26065
|
|
|
26066
|
-
If \`replicas environment-setup status\` reports that there is no active setup run, you are in an ordinary workspace, either because the user asked for this or because the fix you found while debugging belongs in the environment. Follow the same discovery and verification steps, show the exact change in chat, and offer to apply and test it yourself.
|
|
26066
|
+
If \`replicas environment-setup status\` reports that there is no active setup run, you are in an ordinary workspace, either because the user asked for this or because the fix you found while debugging belongs in the environment. Follow the same discovery and verification steps, show the exact change in chat, and offer to apply and test it yourself. A change to an environment affects every workspace built from it, so from a workspace it only goes to the user to approve above the chat composer: the command prints "Not done yet", and you get a message with their answer, so end your turn instead of waiting. Test first, then file it:
|
|
26067
26067
|
|
|
26068
|
-
- Warm hook: \`replicas environment warm-hooks
|
|
26068
|
+
- Warm hook: \`replicas environment warm-hooks test <env> -f <file>\`, then \`replicas environment warm-hooks save <env> -f <file>\` with the same file once it passes.
|
|
26069
26069
|
- Start hook: \`replicas environment start-hooks test <env> -f <file>\`, then \`replicas environment start-hooks save <env> -f <file>\` with the same file once it passes.
|
|
26070
|
-
- Variables and files:
|
|
26071
|
-
- Automations:
|
|
26070
|
+
- Variables and files: \`replicas environment vars set\` or \`files set\`; once approved, confirm with \`vars list\` or \`files list\`.
|
|
26071
|
+
- Automations: \`replicas automation ...\`; one that runs in new workspaces is approved the same way. Read it back with \`replicas automation get <id>\`.
|
|
26072
26072
|
|
|
26073
26073
|
When a test fails, fix the earliest failure and test again instead of saving. If the fix materially changes what the user approved, show the revised change and ask again before saving. Report what you changed and the test result.
|
|
26074
26074
|
|
|
@@ -28471,7 +28471,9 @@ The user gets a form above the chat composer in Replicas, where they can paste a
|
|
|
28471
28471
|
|
|
28472
28472
|
In workspaces started from Slack, Linear, or an automation, nobody may be watching Replicas, so the command returns right away with a link to the form; share it where you are talking with the user. If the values don't arrive in time, the request stays open. Either way you get a message when the user saves; run the same command again then. If a saved value is wrong, for example the service rejects it, add \`--replace\` to ask for a new one.
|
|
28473
28473
|
|
|
28474
|
-
A value that starts with \`replicas_ph_\` is a proxied secret. Use it as the real key: Replicas swaps in the real value on HTTPS requests to the hosts the user bound it to, and it works nowhere else, including inside Docker containers. To proxy a variable or change its hosts, run \`replicas environment vars proxy <env> <key> <host
|
|
28474
|
+
A value that starts with \`replicas_ph_\` is a proxied secret. Use it as the real key: Replicas swaps in the real value on HTTPS requests to the hosts the user bound it to, and it works nowhere else, including inside Docker containers. To proxy a variable or change its hosts, run \`replicas environment vars proxy <env> <key> <host...>\`.
|
|
28475
|
+
|
|
28476
|
+
From a workspace, any change to an environment (variables, files, hooks, MCP servers, skills, settings), an automation that runs in new workspaces, or a new repository only goes to the user to approve above the chat composer. The command prints "Not done yet"; tell the user and end your turn, and you get a message with their answer. You can only reach this workspace and the ships you started, and you can't read the values of other environments.
|
|
28475
28477
|
|
|
28476
28478
|
### Environment files
|
|
28477
28479
|
|
|
@@ -43370,7 +43372,7 @@ var CLI_VERSION;
|
|
|
43370
43372
|
var init_cli_version = __esm({
|
|
43371
43373
|
"../shared/src/cli-version.ts"() {
|
|
43372
43374
|
"use strict";
|
|
43373
|
-
CLI_VERSION = "0.3.
|
|
43375
|
+
CLI_VERSION = "0.3.657";
|
|
43374
43376
|
}
|
|
43375
43377
|
});
|
|
43376
43378
|
|
|
@@ -54513,25 +54515,33 @@ var init_local_control_requests = __esm({
|
|
|
54513
54515
|
});
|
|
54514
54516
|
|
|
54515
54517
|
// ../shared/src/routes/approval-requests.ts
|
|
54516
|
-
var approvalChangeSchema, approvalRequestSchema, respondApprovalRequestSchema;
|
|
54518
|
+
var approvalChangeMethodSchema, approvalChangeSchema, approvalRequestSchema, respondApprovalRequestSchema;
|
|
54517
54519
|
var init_approval_requests = __esm({
|
|
54518
54520
|
"../shared/src/routes/approval-requests.ts"() {
|
|
54519
54521
|
"use strict";
|
|
54520
54522
|
init_zod();
|
|
54523
|
+
approvalChangeMethodSchema = external_exports.enum(["POST", "PUT", "PATCH", "DELETE"]);
|
|
54521
54524
|
approvalChangeSchema = external_exports.object({
|
|
54522
|
-
kind: external_exports.literal("
|
|
54523
|
-
|
|
54524
|
-
|
|
54525
|
-
|
|
54526
|
-
|
|
54527
|
-
|
|
54525
|
+
kind: external_exports.literal("api_request"),
|
|
54526
|
+
method: approvalChangeMethodSchema,
|
|
54527
|
+
path: external_exports.string().startsWith("/v1/"),
|
|
54528
|
+
body: external_exports.unknown().optional(),
|
|
54529
|
+
summary: external_exports.string(),
|
|
54530
|
+
detail: external_exports.string().nullable()
|
|
54528
54531
|
});
|
|
54529
54532
|
approvalRequestSchema = external_exports.object({
|
|
54530
54533
|
/** Changes whenever the request does, so an answer only counts for the changes the person saw. */
|
|
54531
54534
|
id: external_exports.string(),
|
|
54532
54535
|
changes: external_exports.array(approvalChangeSchema)
|
|
54533
54536
|
});
|
|
54534
|
-
respondApprovalRequestSchema = external_exports.object({
|
|
54537
|
+
respondApprovalRequestSchema = external_exports.object({
|
|
54538
|
+
id: external_exports.string(),
|
|
54539
|
+
/** `claim` takes the request off the card before the person's session replays it, so it is applied only once; `approved` or `failed` then reports the result. */
|
|
54540
|
+
action: external_exports.enum(["claim", "approved", "declined", "failed"]),
|
|
54541
|
+
/** For `failed`: how many changes were made before one failed, and why it failed. */
|
|
54542
|
+
applied: external_exports.number().int().min(0).optional(),
|
|
54543
|
+
error: external_exports.string().max(1e3).optional()
|
|
54544
|
+
});
|
|
54535
54545
|
}
|
|
54536
54546
|
});
|
|
54537
54547
|
|
|
@@ -54904,48 +54914,6 @@ var init_monolith_url = __esm({
|
|
|
54904
54914
|
}
|
|
54905
54915
|
});
|
|
54906
54916
|
|
|
54907
|
-
// src/lib/authenticated-api.ts
|
|
54908
|
-
async function throwResponseError(response) {
|
|
54909
|
-
const { error: error62 } = await readApiErrorBody(response);
|
|
54910
|
-
throw new ApiError(error62 || `Request failed with status ${response.status}`, response.status);
|
|
54911
|
-
}
|
|
54912
|
-
async function apiFetch(url2, headers, options) {
|
|
54913
|
-
const requestHeaders = new Headers({ "Content-Type": "application/json", ...headers });
|
|
54914
|
-
new Headers(options?.headers).forEach((value, key2) => requestHeaders.set(key2, value));
|
|
54915
|
-
const response = await fetchWithRedirects(`${MONOLITH_URL}${url2}`, {
|
|
54916
|
-
...options,
|
|
54917
|
-
headers: requestHeaders,
|
|
54918
|
-
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
54919
|
-
});
|
|
54920
|
-
if (!response.ok) {
|
|
54921
|
-
await throwResponseError(response);
|
|
54922
|
-
}
|
|
54923
|
-
return response.json();
|
|
54924
|
-
}
|
|
54925
|
-
async function authenticatedFetch(url2, options) {
|
|
54926
|
-
const token = await getValidToken();
|
|
54927
|
-
if (!token) {
|
|
54928
|
-
throw new Error("No access token available");
|
|
54929
|
-
}
|
|
54930
|
-
return apiFetch(url2, { Authorization: `Bearer ${token}` }, options);
|
|
54931
|
-
}
|
|
54932
|
-
var ApiError;
|
|
54933
|
-
var init_authenticated_api = __esm({
|
|
54934
|
-
"src/lib/authenticated-api.ts"() {
|
|
54935
|
-
"use strict";
|
|
54936
|
-
init_src();
|
|
54937
|
-
init_auth();
|
|
54938
|
-
init_monolith_url();
|
|
54939
|
-
ApiError = class extends Error {
|
|
54940
|
-
constructor(message2, status) {
|
|
54941
|
-
super(message2);
|
|
54942
|
-
this.name = "ApiError";
|
|
54943
|
-
this.status = status;
|
|
54944
|
-
}
|
|
54945
|
-
};
|
|
54946
|
-
}
|
|
54947
|
-
});
|
|
54948
|
-
|
|
54949
54917
|
// src/lib/output.ts
|
|
54950
54918
|
function enableJsonMode() {
|
|
54951
54919
|
jsonMode = true;
|
|
@@ -54987,6 +54955,61 @@ var init_output = __esm({
|
|
|
54987
54955
|
}
|
|
54988
54956
|
});
|
|
54989
54957
|
|
|
54958
|
+
// src/lib/authenticated-api.ts
|
|
54959
|
+
async function throwResponseError(response) {
|
|
54960
|
+
const { error: error62 } = await readApiErrorBody(response);
|
|
54961
|
+
throw new ApiError(error62 || `Request failed with status ${response.status}`, response.status);
|
|
54962
|
+
}
|
|
54963
|
+
async function exitIfApprovalRequired(response) {
|
|
54964
|
+
if (response.status !== 202) return;
|
|
54965
|
+
const body2 = await response.clone().json().catch(() => null);
|
|
54966
|
+
if (!isRecord(body2) || typeof body2.approval_url !== "string" || typeof body2.message !== "string") return;
|
|
54967
|
+
const approval = { approval_url: body2.approval_url, message: body2.message };
|
|
54968
|
+
output2(approval, () => console.log(import_chalk2.default.yellow(`
|
|
54969
|
+
${approval.message}
|
|
54970
|
+
`)));
|
|
54971
|
+
process.exit(0);
|
|
54972
|
+
}
|
|
54973
|
+
async function apiFetch(url2, headers, options) {
|
|
54974
|
+
const requestHeaders = new Headers({ "Content-Type": "application/json", ...headers });
|
|
54975
|
+
new Headers(options?.headers).forEach((value, key2) => requestHeaders.set(key2, value));
|
|
54976
|
+
const response = await fetchWithRedirects(`${MONOLITH_URL}${url2}`, {
|
|
54977
|
+
...options,
|
|
54978
|
+
headers: requestHeaders,
|
|
54979
|
+
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
54980
|
+
});
|
|
54981
|
+
if (!response.ok) {
|
|
54982
|
+
await throwResponseError(response);
|
|
54983
|
+
}
|
|
54984
|
+
await exitIfApprovalRequired(response);
|
|
54985
|
+
return response.json();
|
|
54986
|
+
}
|
|
54987
|
+
async function authenticatedFetch(url2, options) {
|
|
54988
|
+
const token = await getValidToken();
|
|
54989
|
+
if (!token) {
|
|
54990
|
+
throw new Error("No access token available");
|
|
54991
|
+
}
|
|
54992
|
+
return apiFetch(url2, { Authorization: `Bearer ${token}` }, options);
|
|
54993
|
+
}
|
|
54994
|
+
var import_chalk2, ApiError;
|
|
54995
|
+
var init_authenticated_api = __esm({
|
|
54996
|
+
"src/lib/authenticated-api.ts"() {
|
|
54997
|
+
"use strict";
|
|
54998
|
+
import_chalk2 = __toESM(require("chalk"));
|
|
54999
|
+
init_src();
|
|
55000
|
+
init_auth();
|
|
55001
|
+
init_monolith_url();
|
|
55002
|
+
init_output();
|
|
55003
|
+
ApiError = class extends Error {
|
|
55004
|
+
constructor(message2, status) {
|
|
55005
|
+
super(message2);
|
|
55006
|
+
this.name = "ApiError";
|
|
55007
|
+
this.status = status;
|
|
55008
|
+
}
|
|
55009
|
+
};
|
|
55010
|
+
}
|
|
55011
|
+
});
|
|
55012
|
+
|
|
54990
55013
|
// src/lib/organization.ts
|
|
54991
55014
|
async function fetchOrganizations() {
|
|
54992
55015
|
const response = await authenticatedFetch(
|
|
@@ -55132,6 +55155,7 @@ async function orgAuthenticatedSseStream(url2, options) {
|
|
|
55132
55155
|
await throwResponseError(response);
|
|
55133
55156
|
return;
|
|
55134
55157
|
}
|
|
55158
|
+
await exitIfApprovalRequired(response);
|
|
55135
55159
|
await readSseStream(response.body, options.onEvent);
|
|
55136
55160
|
}
|
|
55137
55161
|
var init_api2 = __esm({
|
|
@@ -55149,7 +55173,7 @@ var init_api2 = __esm({
|
|
|
55149
55173
|
|
|
55150
55174
|
// src/lib/oauth-flow-ui.ts
|
|
55151
55175
|
function field(label, value) {
|
|
55152
|
-
console.log(` ${
|
|
55176
|
+
console.log(` ${import_chalk3.default.gray(label.padEnd(LABEL_WIDTH))}${value}`);
|
|
55153
55177
|
}
|
|
55154
55178
|
function appliesTo(target) {
|
|
55155
55179
|
if (!target.isUserScoped) return "Organization Settings";
|
|
@@ -55161,10 +55185,10 @@ function hyperlink(url2) {
|
|
|
55161
55185
|
function renderIdentity(identity) {
|
|
55162
55186
|
field(
|
|
55163
55187
|
"User",
|
|
55164
|
-
|
|
55188
|
+
import_chalk3.default.bold(identity.account ?? "unknown") + (identity.role ? import_chalk3.default.gray(` (${identity.role})`) : "")
|
|
55165
55189
|
);
|
|
55166
55190
|
if (identity.organizationName) {
|
|
55167
|
-
field("Organization",
|
|
55191
|
+
field("Organization", import_chalk3.default.bold(identity.organizationName));
|
|
55168
55192
|
}
|
|
55169
55193
|
}
|
|
55170
55194
|
function renderTargetFields(target) {
|
|
@@ -55173,7 +55197,7 @@ function renderTargetFields(target) {
|
|
|
55173
55197
|
role: target.role,
|
|
55174
55198
|
organizationName: target.organization?.name
|
|
55175
55199
|
});
|
|
55176
|
-
field("Applies to",
|
|
55200
|
+
field("Applies to", import_chalk3.default.yellow.bold(appliesTo(target)));
|
|
55177
55201
|
}
|
|
55178
55202
|
async function resolveAuthFlowTarget(identity) {
|
|
55179
55203
|
if (isAgentMode()) {
|
|
@@ -55207,11 +55231,11 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
55207
55231
|
`));
|
|
55208
55232
|
renderTargetFields(target);
|
|
55209
55233
|
if (!target.isUserScoped) {
|
|
55210
|
-
console.log(
|
|
55234
|
+
console.log(import_chalk3.default.gray("\n Use --user to apply this to your personal account instead."));
|
|
55211
55235
|
}
|
|
55212
55236
|
if (target.sharesWithOrganization) {
|
|
55213
55237
|
console.log(
|
|
55214
|
-
|
|
55238
|
+
import_chalk3.default.gray(
|
|
55215
55239
|
`
|
|
55216
55240
|
${target.organization?.name ?? "Your organization"} has no ${target.credentialLabel} default yet,
|
|
55217
55241
|
so this also becomes the organization default.`
|
|
@@ -55220,7 +55244,7 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
55220
55244
|
}
|
|
55221
55245
|
console.log();
|
|
55222
55246
|
if (assumeYes) {
|
|
55223
|
-
console.log(
|
|
55247
|
+
console.log(import_chalk3.default.gray(" Confirmed by --yes."));
|
|
55224
55248
|
} else {
|
|
55225
55249
|
if (!isInteractive()) {
|
|
55226
55250
|
throw new Error(
|
|
@@ -55234,10 +55258,10 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
55234
55258
|
initial: false
|
|
55235
55259
|
});
|
|
55236
55260
|
if (!confirmed) {
|
|
55237
|
-
console.log(
|
|
55261
|
+
console.log(import_chalk3.default.yellow("\n Cancelled. Nothing was saved."));
|
|
55238
55262
|
if (!target.isUserScoped) {
|
|
55239
55263
|
console.log(
|
|
55240
|
-
|
|
55264
|
+
import_chalk3.default.gray(" To set this for your personal account instead, use the --user flag.\n")
|
|
55241
55265
|
);
|
|
55242
55266
|
}
|
|
55243
55267
|
return false;
|
|
@@ -55246,11 +55270,11 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
55246
55270
|
return true;
|
|
55247
55271
|
}
|
|
55248
55272
|
function renderAuthFlowStep(step2, total, title3) {
|
|
55249
|
-
console.log(
|
|
55273
|
+
console.log(import_chalk3.default.bold(`
|
|
55250
55274
|
${step2}/${total} ${title3}`));
|
|
55251
55275
|
}
|
|
55252
55276
|
function renderAuthFlowDetail(text5) {
|
|
55253
|
-
console.log(
|
|
55277
|
+
console.log(import_chalk3.default.gray(` ${text5}`));
|
|
55254
55278
|
}
|
|
55255
55279
|
function renderAuthFlowSuccess(providerLabel, summary, target) {
|
|
55256
55280
|
console.log(brand.bold(`
|
|
@@ -55260,13 +55284,13 @@ function renderAuthFlowSuccess(providerLabel, summary, target) {
|
|
|
55260
55284
|
if (summary.email) {
|
|
55261
55285
|
field(
|
|
55262
55286
|
`${providerLabel} account`,
|
|
55263
|
-
|
|
55287
|
+
import_chalk3.default.bold(summary.email) + (summary.planType ? import_chalk3.default.gray(` \xB7 ${summary.planType}`) : "")
|
|
55264
55288
|
);
|
|
55265
55289
|
}
|
|
55266
55290
|
if (summary.accountOrdinal && summary.accountCount && summary.accountCount > 1) {
|
|
55267
55291
|
field(
|
|
55268
55292
|
"Account order",
|
|
55269
|
-
`${summary.accountOrdinal} of ${summary.accountCount}` +
|
|
55293
|
+
`${summary.accountOrdinal} of ${summary.accountCount}` + import_chalk3.default.gray(" \xB7 Replicas moves to the next account when one hits its usage limit")
|
|
55270
55294
|
);
|
|
55271
55295
|
}
|
|
55272
55296
|
console.log();
|
|
@@ -55280,13 +55304,13 @@ async function openForApproval(host2, authUrl) {
|
|
|
55280
55304
|
}
|
|
55281
55305
|
renderAuthFlowDetail(opened ? `Opened ${host2}` : `Could not open ${host2} automatically`);
|
|
55282
55306
|
renderAuthFlowDetail(opened ? "If it didn't open, visit:" : "Visit:");
|
|
55283
|
-
console.log(` ${
|
|
55307
|
+
console.log(` ${import_chalk3.default.gray.underline(hyperlink(authUrl))}`);
|
|
55284
55308
|
}
|
|
55285
|
-
var
|
|
55309
|
+
var import_chalk3, import_open, LABEL_WIDTH, brand;
|
|
55286
55310
|
var init_oauth_flow_ui = __esm({
|
|
55287
55311
|
"src/lib/oauth-flow-ui.ts"() {
|
|
55288
55312
|
"use strict";
|
|
55289
|
-
|
|
55313
|
+
import_chalk3 = __toESM(require("chalk"));
|
|
55290
55314
|
import_open = __toESM(require("open"));
|
|
55291
55315
|
init_api2();
|
|
55292
55316
|
init_auth();
|
|
@@ -55294,13 +55318,13 @@ var init_oauth_flow_ui = __esm({
|
|
|
55294
55318
|
init_organization2();
|
|
55295
55319
|
init_output();
|
|
55296
55320
|
LABEL_WIDTH = 16;
|
|
55297
|
-
brand =
|
|
55321
|
+
brand = import_chalk3.default.hex("#3eeba3");
|
|
55298
55322
|
}
|
|
55299
55323
|
});
|
|
55300
55324
|
|
|
55301
55325
|
// src/commands/whoami.ts
|
|
55302
55326
|
function printApiKeyIdentity({ organization, caller, user, is_admin }) {
|
|
55303
|
-
field("Organization",
|
|
55327
|
+
field("Organization", import_chalk4.default.bold(organization.name));
|
|
55304
55328
|
field("Identity", caller === "personal_api_key" ? `personal API key of ${user?.email ?? user?.display_name}` : "organization API key");
|
|
55305
55329
|
field("Admin", is_admin ? "yes" : "no");
|
|
55306
55330
|
}
|
|
@@ -55310,9 +55334,9 @@ async function whoamiCommand() {
|
|
|
55310
55334
|
if (!agent) throw new Error("Agent mode config is incomplete.");
|
|
55311
55335
|
output2({ workspace_id: agent.workspace_id, organization_id: agent.organization_id ?? null }, () => {
|
|
55312
55336
|
console.log(brand.bold("\n Workspace identity\n"));
|
|
55313
|
-
field("Workspace",
|
|
55337
|
+
field("Workspace", import_chalk4.default.bold(agent.workspace_id));
|
|
55314
55338
|
if (agent.organization_id) {
|
|
55315
|
-
field("Organization",
|
|
55339
|
+
field("Organization", import_chalk4.default.bold(agent.organization_id));
|
|
55316
55340
|
}
|
|
55317
55341
|
console.log();
|
|
55318
55342
|
});
|
|
@@ -55343,11 +55367,11 @@ async function whoamiCommand() {
|
|
|
55343
55367
|
console.log();
|
|
55344
55368
|
});
|
|
55345
55369
|
}
|
|
55346
|
-
var
|
|
55370
|
+
var import_chalk4;
|
|
55347
55371
|
var init_whoami = __esm({
|
|
55348
55372
|
"src/commands/whoami.ts"() {
|
|
55349
55373
|
"use strict";
|
|
55350
|
-
|
|
55374
|
+
import_chalk4 = __toESM(require("chalk"));
|
|
55351
55375
|
init_api2();
|
|
55352
55376
|
init_oauth_flow_ui();
|
|
55353
55377
|
init_auth();
|
|
@@ -55512,14 +55536,14 @@ async function loginCommand() {
|
|
|
55512
55536
|
organizationName: active?.organization?.name
|
|
55513
55537
|
});
|
|
55514
55538
|
if (!active) {
|
|
55515
|
-
field("Organization",
|
|
55516
|
-
console.log(
|
|
55539
|
+
field("Organization", import_chalk5.default.yellow("could not be fetched"));
|
|
55540
|
+
console.log(import_chalk5.default.gray('\n Set one with "replicas org switch".'));
|
|
55517
55541
|
} else if (!active.organization) {
|
|
55518
|
-
field("Organization",
|
|
55519
|
-
console.log(
|
|
55542
|
+
field("Organization", import_chalk5.default.yellow("none selected"));
|
|
55543
|
+
console.log(import_chalk5.default.gray('\n Choose one with "replicas org switch".'));
|
|
55520
55544
|
} else if (active.total > 1) {
|
|
55521
55545
|
console.log(
|
|
55522
|
-
|
|
55546
|
+
import_chalk5.default.gray(`
|
|
55523
55547
|
${active.total} organizations available. "replicas org switch" to change.`)
|
|
55524
55548
|
);
|
|
55525
55549
|
}
|
|
@@ -55558,12 +55582,12 @@ async function loginCommand() {
|
|
|
55558
55582
|
const port2 = address.port;
|
|
55559
55583
|
const loginUrl = `${WEB_APP_URL}/cli-login?port=${port2}&state=${state}`;
|
|
55560
55584
|
console.log(brand("\nOpening browser for authentication..."));
|
|
55561
|
-
console.log(
|
|
55585
|
+
console.log(import_chalk5.default.gray(`If the browser doesn't open automatically, visit:
|
|
55562
55586
|
${loginUrl}
|
|
55563
55587
|
`));
|
|
55564
55588
|
(0, import_open2.default)(loginUrl).catch(() => {
|
|
55565
|
-
console.log(
|
|
55566
|
-
console.log(
|
|
55589
|
+
console.log(import_chalk5.default.yellow("Failed to open browser automatically."));
|
|
55590
|
+
console.log(import_chalk5.default.gray(`Please open this URL manually:
|
|
55567
55591
|
${loginUrl}
|
|
55568
55592
|
`));
|
|
55569
55593
|
});
|
|
@@ -55575,7 +55599,7 @@ ${loginUrl}
|
|
|
55575
55599
|
}, 5 * 60 * 1e3);
|
|
55576
55600
|
});
|
|
55577
55601
|
}
|
|
55578
|
-
var import_http, import_url3, import_open2,
|
|
55602
|
+
var import_http, import_url3, import_open2, import_chalk5, WEB_APP_URL;
|
|
55579
55603
|
var init_login3 = __esm({
|
|
55580
55604
|
"src/commands/login.ts"() {
|
|
55581
55605
|
"use strict";
|
|
@@ -55583,7 +55607,7 @@ var init_login3 = __esm({
|
|
|
55583
55607
|
import_http = __toESM(require("http"));
|
|
55584
55608
|
import_url3 = require("url");
|
|
55585
55609
|
import_open2 = __toESM(require("open"));
|
|
55586
|
-
|
|
55610
|
+
import_chalk5 = __toESM(require("chalk"));
|
|
55587
55611
|
init_config();
|
|
55588
55612
|
init_oauth_flow_ui();
|
|
55589
55613
|
init_auth();
|
|
@@ -55598,17 +55622,17 @@ var init_login3 = __esm({
|
|
|
55598
55622
|
// src/commands/logout.ts
|
|
55599
55623
|
function logoutCommand() {
|
|
55600
55624
|
if (!isAuthenticated() && !getApiKey()) {
|
|
55601
|
-
output2({ success: true }, () => console.log(
|
|
55625
|
+
output2({ success: true }, () => console.log(import_chalk6.default.yellow("You are not logged in.")));
|
|
55602
55626
|
return;
|
|
55603
55627
|
}
|
|
55604
55628
|
clearAuthentication();
|
|
55605
55629
|
outputSuccess("\u2713 Successfully logged out!");
|
|
55606
55630
|
}
|
|
55607
|
-
var
|
|
55631
|
+
var import_chalk6;
|
|
55608
55632
|
var init_logout = __esm({
|
|
55609
55633
|
"src/commands/logout.ts"() {
|
|
55610
55634
|
"use strict";
|
|
55611
|
-
|
|
55635
|
+
import_chalk6 = __toESM(require("chalk"));
|
|
55612
55636
|
init_config();
|
|
55613
55637
|
init_output();
|
|
55614
55638
|
}
|
|
@@ -55633,8 +55657,8 @@ function truncate(text5, maxLength) {
|
|
|
55633
55657
|
return text5.substring(0, maxLength) + "...";
|
|
55634
55658
|
}
|
|
55635
55659
|
function printReplicaActivity(activity) {
|
|
55636
|
-
console.log(
|
|
55637
|
-
if (activity.last_agent_message) console.log(
|
|
55660
|
+
console.log(import_chalk7.default.gray(` Agent: ${activity.state.replaceAll("_", " ")}${activity.current_step ? ` \xB7 ${activity.current_step}` : ""}`));
|
|
55661
|
+
if (activity.last_agent_message) console.log(import_chalk7.default.gray(` Last message: ${activity.last_agent_message}`));
|
|
55638
55662
|
}
|
|
55639
55663
|
function ensureOrgApiAuthenticated() {
|
|
55640
55664
|
if (!canCallOrgApi()) {
|
|
@@ -55654,7 +55678,7 @@ function parseKeyValuePairs(pairs) {
|
|
|
55654
55678
|
async function confirmAction(message2) {
|
|
55655
55679
|
if (!isInteractive()) throw new Error(`${message2} Pass -f to confirm without a terminal.`);
|
|
55656
55680
|
const { confirm } = await (0, import_prompts10.default)({ type: "confirm", name: "confirm", message: message2, initial: false });
|
|
55657
|
-
if (!confirm) console.log(
|
|
55681
|
+
if (!confirm) console.log(import_chalk7.default.yellow("\nCancelled."));
|
|
55658
55682
|
return Boolean(confirm);
|
|
55659
55683
|
}
|
|
55660
55684
|
function parseRequestTimeout(value) {
|
|
@@ -55665,7 +55689,7 @@ function parseRequestTimeout(value) {
|
|
|
55665
55689
|
}
|
|
55666
55690
|
async function waitForUser(params) {
|
|
55667
55691
|
const { timeoutMs } = params;
|
|
55668
|
-
if (!isJsonMode()) console.log(
|
|
55692
|
+
if (!isJsonMode()) console.log(import_chalk7.default.gray(`
|
|
55669
55693
|
${params.asked} Waiting up to ${timeoutMs >= 6e4 ? `${Math.round(timeoutMs / 6e4)} minute(s)` : `${timeoutMs / 1e3} seconds`}\u2026`));
|
|
55670
55694
|
let value = params.initial;
|
|
55671
55695
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -55695,11 +55719,11 @@ function formatMediaEmbed(name, media2, publicUrl) {
|
|
|
55695
55719
|
if (publicUrl) return `${media2.kind === MEDIA_KIND.IMAGE ? "!" : ""}[${markdownLabel(name)}](${publicUrl})`;
|
|
55696
55720
|
return `Replicas chat embed: `;
|
|
55697
55721
|
}
|
|
55698
|
-
var
|
|
55722
|
+
var import_chalk7, import_fs2, import_path2, import_prompts10, markdownLabel;
|
|
55699
55723
|
var init_command_utils = __esm({
|
|
55700
55724
|
"src/lib/command-utils.ts"() {
|
|
55701
55725
|
"use strict";
|
|
55702
|
-
|
|
55726
|
+
import_chalk7 = __toESM(require("chalk"));
|
|
55703
55727
|
import_fs2 = __toESM(require("fs"));
|
|
55704
55728
|
import_path2 = __toESM(require("path"));
|
|
55705
55729
|
init_src();
|
|
@@ -55718,12 +55742,12 @@ async function billingCommand() {
|
|
|
55718
55742
|
field("Plan", plan);
|
|
55719
55743
|
field("Period", `${formatDate(period_start)} \u2013 ${formatDate(period_end)}`);
|
|
55720
55744
|
if (credit) {
|
|
55721
|
-
field("Balance", `${
|
|
55745
|
+
field("Balance", `${import_chalk8.default.bold(formatCents(credit.remaining_cents))} left, ${formatCents(credit.used_cents)} used of ${formatCents(credit.total_cents)}`);
|
|
55722
55746
|
if (credit.one_time_cents) field("Credit", `${formatCents(credit.plan_cents)} plan + ${formatCents(credit.one_time_cents)} one-time`);
|
|
55723
55747
|
if (credit.overage_cents) field("Overage", formatCents(credit.overage_cents));
|
|
55724
55748
|
}
|
|
55725
55749
|
field("Limit", limit ? `${formatCents(limit.remaining_cents)} left before workspaces stop (${limit.kind === "credit" ? "credit" : "usage limit"} ${formatCents(limit.limit_cents)})` : "none");
|
|
55726
|
-
if (blocked) field("Blocked",
|
|
55750
|
+
if (blocked) field("Blocked", import_chalk8.default.red(blocked.message));
|
|
55727
55751
|
console.log();
|
|
55728
55752
|
});
|
|
55729
55753
|
}
|
|
@@ -55732,15 +55756,15 @@ async function billingUsageCommand(options) {
|
|
|
55732
55756
|
const usage = await orgAuthenticatedFetch(`/v1/organization/billing/usage${query.size ? `?${query}` : ""}`);
|
|
55733
55757
|
output2(usage, ({ points, sources }) => {
|
|
55734
55758
|
for (const point of points) console.log(`${point.bucket} ${formatCents(point.cents)}`);
|
|
55735
|
-
console.log(
|
|
55759
|
+
console.log(import_chalk8.default.gray(`
|
|
55736
55760
|
${sources.map((source) => `${source.source} ${formatCents(source.cents)}`).join(", ") || "No usage"}`));
|
|
55737
55761
|
});
|
|
55738
55762
|
}
|
|
55739
|
-
var
|
|
55763
|
+
var import_chalk8;
|
|
55740
55764
|
var init_billing2 = __esm({
|
|
55741
55765
|
"src/commands/billing.ts"() {
|
|
55742
55766
|
"use strict";
|
|
55743
|
-
|
|
55767
|
+
import_chalk8 = __toESM(require("chalk"));
|
|
55744
55768
|
init_currency();
|
|
55745
55769
|
init_api2();
|
|
55746
55770
|
init_command_utils();
|
|
@@ -55797,12 +55821,12 @@ async function identityTokenCommand(options) {
|
|
|
55797
55821
|
}
|
|
55798
55822
|
async function identityExecCommand(command, options) {
|
|
55799
55823
|
if (command.length === 0) {
|
|
55800
|
-
console.error(
|
|
55824
|
+
console.error(import_chalk9.default.red("Provide a command to run: replicas identity exec -- <command>"));
|
|
55801
55825
|
process.exit(1);
|
|
55802
55826
|
}
|
|
55803
55827
|
const tokenResult = await fetchToken(options.audience);
|
|
55804
55828
|
if (!tokenResult.ok) {
|
|
55805
|
-
console.error(
|
|
55829
|
+
console.error(import_chalk9.default.red(tokenResult.error.message));
|
|
55806
55830
|
process.exitCode = 1;
|
|
55807
55831
|
return;
|
|
55808
55832
|
}
|
|
@@ -55826,7 +55850,7 @@ async function identityAwsCredentialsCommand(options) {
|
|
|
55826
55850
|
}
|
|
55827
55851
|
const result = await fetchToken(options.audience, options.sourceIdentity);
|
|
55828
55852
|
if (!result.ok) {
|
|
55829
|
-
console.error(
|
|
55853
|
+
console.error(import_chalk9.default.red(result.error.message));
|
|
55830
55854
|
process.exitCode = 1;
|
|
55831
55855
|
return;
|
|
55832
55856
|
}
|
|
@@ -55873,7 +55897,7 @@ async function identityAwsCredentialsCommand(options) {
|
|
|
55873
55897
|
(0, import_node_fs.rmSync)(directory, { recursive: true, force: true });
|
|
55874
55898
|
}
|
|
55875
55899
|
}
|
|
55876
|
-
var import_node_crypto, import_node_fs, import_node_child_process, import_node_os, import_node_path,
|
|
55900
|
+
var import_node_crypto, import_node_fs, import_node_child_process, import_node_os, import_node_path, import_chalk9;
|
|
55877
55901
|
var init_identity = __esm({
|
|
55878
55902
|
"src/commands/identity.ts"() {
|
|
55879
55903
|
"use strict";
|
|
@@ -55882,7 +55906,7 @@ var init_identity = __esm({
|
|
|
55882
55906
|
import_node_child_process = require("child_process");
|
|
55883
55907
|
import_node_os = require("os");
|
|
55884
55908
|
import_node_path = require("path");
|
|
55885
|
-
|
|
55909
|
+
import_chalk9 = __toESM(require("chalk"));
|
|
55886
55910
|
init_output();
|
|
55887
55911
|
init_src();
|
|
55888
55912
|
}
|
|
@@ -55994,7 +56018,7 @@ async function resolveWorkspaceRecord(workspaceName) {
|
|
|
55994
56018
|
const exactWorkspace = await fetchWorkspaceById(workspaceName);
|
|
55995
56019
|
if (exactWorkspace) return exactWorkspace;
|
|
55996
56020
|
}
|
|
55997
|
-
console.log(
|
|
56021
|
+
console.log(import_chalk10.default.blue(workspaceName ? `
|
|
55998
56022
|
Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
|
|
55999
56023
|
const params = new URLSearchParams({ limit: "100" });
|
|
56000
56024
|
if (workspaceName) params.set("name", workspaceName);
|
|
@@ -56013,7 +56037,7 @@ Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
|
|
|
56013
56037
|
selectedWorkspace = workspaces[0];
|
|
56014
56038
|
} else {
|
|
56015
56039
|
if (workspaceName) {
|
|
56016
|
-
console.log(
|
|
56040
|
+
console.log(import_chalk10.default.yellow(`
|
|
56017
56041
|
Found ${workspaces.length} workspaces matching "${workspaceName}":`));
|
|
56018
56042
|
}
|
|
56019
56043
|
const selectResponse = await ask({
|
|
@@ -56035,9 +56059,9 @@ Found ${workspaces.length} workspaces matching "${workspaceName}":`));
|
|
|
56035
56059
|
}
|
|
56036
56060
|
selectedWorkspace = selected;
|
|
56037
56061
|
}
|
|
56038
|
-
console.log(
|
|
56062
|
+
console.log(import_chalk10.default.green(`
|
|
56039
56063
|
\u2713 Selected workspace: ${selectedWorkspace.name}`));
|
|
56040
|
-
console.log(
|
|
56064
|
+
console.log(import_chalk10.default.gray(` Status: ${selectedWorkspace.status || "unknown"}`));
|
|
56041
56065
|
return selectedWorkspace;
|
|
56042
56066
|
}
|
|
56043
56067
|
async function prepareWorkspaceConnection(workspaceName) {
|
|
@@ -56047,12 +56071,12 @@ async function prepareWorkspaceConnection(workspaceName) {
|
|
|
56047
56071
|
`Workspace is currently ${selectedWorkspace.status}. Wake it at ${DEFAULT_WEB_APP_URL}`
|
|
56048
56072
|
);
|
|
56049
56073
|
}
|
|
56050
|
-
console.log(
|
|
56074
|
+
console.log(import_chalk10.default.blue("\nRequesting SSH access token..."));
|
|
56051
56075
|
const tokenResponse = await orgAuthenticatedFetch(
|
|
56052
56076
|
`/v1/workspaces/${selectedWorkspace.id}/ssh-token`,
|
|
56053
56077
|
{ method: "POST" }
|
|
56054
56078
|
);
|
|
56055
|
-
console.log(
|
|
56079
|
+
console.log(import_chalk10.default.green("\u2713 SSH token received"));
|
|
56056
56080
|
let repoName = null;
|
|
56057
56081
|
if (isInsideGitRepo()) {
|
|
56058
56082
|
try {
|
|
@@ -56068,11 +56092,11 @@ async function prepareWorkspaceConnection(workspaceName) {
|
|
|
56068
56092
|
repoName
|
|
56069
56093
|
};
|
|
56070
56094
|
}
|
|
56071
|
-
var
|
|
56095
|
+
var import_chalk10;
|
|
56072
56096
|
var init_workspace_connection = __esm({
|
|
56073
56097
|
"src/lib/workspace-connection.ts"() {
|
|
56074
56098
|
"use strict";
|
|
56075
|
-
|
|
56099
|
+
import_chalk10 = __toESM(require("chalk"));
|
|
56076
56100
|
init_src();
|
|
56077
56101
|
init_config();
|
|
56078
56102
|
init_api2();
|
|
@@ -56086,17 +56110,17 @@ async function connectCommand(workspaceName) {
|
|
|
56086
56110
|
ensureOrgApiAuthenticated();
|
|
56087
56111
|
ensureSSHTransport();
|
|
56088
56112
|
const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
|
|
56089
|
-
console.log(
|
|
56113
|
+
console.log(import_chalk11.default.blue(`
|
|
56090
56114
|
Connecting to ${workspace.name}...`));
|
|
56091
|
-
console.log(
|
|
56115
|
+
console.log(import_chalk11.default.gray("\nPress Ctrl+D to disconnect.\n"));
|
|
56092
56116
|
await connectSSH(sshToken, sshHost, sshProxyCommand);
|
|
56093
|
-
console.log(
|
|
56117
|
+
console.log(import_chalk11.default.green("\n\u2713 Disconnected from workspace.\n"));
|
|
56094
56118
|
}
|
|
56095
|
-
var
|
|
56119
|
+
var import_chalk11;
|
|
56096
56120
|
var init_connect = __esm({
|
|
56097
56121
|
"src/commands/connect.ts"() {
|
|
56098
56122
|
"use strict";
|
|
56099
|
-
|
|
56123
|
+
import_chalk11 = __toESM(require("chalk"));
|
|
56100
56124
|
init_command_utils();
|
|
56101
56125
|
init_ssh();
|
|
56102
56126
|
init_workspace_connection();
|
|
@@ -56205,22 +56229,22 @@ async function codeCommand(workspaceName) {
|
|
|
56205
56229
|
}
|
|
56206
56230
|
const { workspace, sshToken, sshHost, sshProxyCommand, repoName } = await prepareWorkspaceConnection(workspaceName);
|
|
56207
56231
|
const hostAlias = getWorkspaceHostAlias(workspace.name);
|
|
56208
|
-
console.log(
|
|
56232
|
+
console.log(import_chalk12.default.blue("\nConfiguring SSH connection..."));
|
|
56209
56233
|
addOrUpdateSSHConfigEntry({
|
|
56210
56234
|
host: hostAlias,
|
|
56211
56235
|
hostname: sshHost,
|
|
56212
56236
|
user: sshToken,
|
|
56213
56237
|
proxyCommand: sshProxyCommand
|
|
56214
56238
|
});
|
|
56215
|
-
console.log(
|
|
56239
|
+
console.log(import_chalk12.default.green(`\u2713 SSH config entry created: ${hostAlias}`));
|
|
56216
56240
|
const paths = SANDBOX_PATHS;
|
|
56217
56241
|
const remotePath = repoName ? `${paths.WORKSPACES_DIR}/${repoName}` : paths.HOME_DIR;
|
|
56218
56242
|
const ideCommand = getIdeCommand();
|
|
56219
56243
|
const fullCommand = `${ideCommand} --remote ssh-remote+${hostAlias} ${remotePath}`;
|
|
56220
|
-
console.log(
|
|
56244
|
+
console.log(import_chalk12.default.blue(`
|
|
56221
56245
|
Opening ${ideCommand} for workspace ${workspace.name}...`));
|
|
56222
|
-
console.log(
|
|
56223
|
-
console.log(
|
|
56246
|
+
console.log(import_chalk12.default.gray(`Command: ${fullCommand}`));
|
|
56247
|
+
console.log(import_chalk12.default.yellow(`
|
|
56224
56248
|
Note: SSH tokens expire after 3 hours. Run this command again to refresh.`));
|
|
56225
56249
|
const ide = (0, import_child_process3.spawn)(ideCommand, [
|
|
56226
56250
|
"--remote",
|
|
@@ -56231,26 +56255,26 @@ Note: SSH tokens expire after 3 hours. Run this command again to refresh.`));
|
|
|
56231
56255
|
detached: false
|
|
56232
56256
|
});
|
|
56233
56257
|
ide.on("error", (error62) => {
|
|
56234
|
-
console.error(
|
|
56258
|
+
console.error(import_chalk12.default.red(`
|
|
56235
56259
|
Failed to launch ${ideCommand}: ${error62.message}`));
|
|
56236
|
-
console.log(
|
|
56260
|
+
console.log(import_chalk12.default.yellow(`
|
|
56237
56261
|
Make sure ${ideCommand} is installed and available in your PATH.`));
|
|
56238
|
-
console.log(
|
|
56262
|
+
console.log(import_chalk12.default.gray(`You can configure a different IDE with: replicas config set ide <command>`));
|
|
56239
56263
|
process.exit(1);
|
|
56240
56264
|
});
|
|
56241
56265
|
ide.on("close", (code) => {
|
|
56242
56266
|
if (code === 0) {
|
|
56243
|
-
console.log(
|
|
56267
|
+
console.log(import_chalk12.default.green(`
|
|
56244
56268
|
\u2713 ${ideCommand} closed successfully.
|
|
56245
56269
|
`));
|
|
56246
56270
|
}
|
|
56247
56271
|
});
|
|
56248
56272
|
}
|
|
56249
|
-
var
|
|
56273
|
+
var import_chalk12, import_child_process3;
|
|
56250
56274
|
var init_code = __esm({
|
|
56251
56275
|
"src/commands/code.ts"() {
|
|
56252
56276
|
"use strict";
|
|
56253
|
-
|
|
56277
|
+
import_chalk12 = __toESM(require("chalk"));
|
|
56254
56278
|
import_child_process3 = require("child_process");
|
|
56255
56279
|
init_src();
|
|
56256
56280
|
init_config();
|
|
@@ -56267,16 +56291,16 @@ async function tunnelCommand(workspaceName, options) {
|
|
|
56267
56291
|
const remotePort = parsePort(options.port);
|
|
56268
56292
|
const localPort = options.localPort ? parsePort(options.localPort) : remotePort;
|
|
56269
56293
|
const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
|
|
56270
|
-
console.log(
|
|
56294
|
+
console.log(import_chalk13.default.green(`
|
|
56271
56295
|
\u2713 Forwarding localhost:${localPort} to ${workspace.name}:${remotePort}`));
|
|
56272
|
-
console.log(
|
|
56296
|
+
console.log(import_chalk13.default.gray(" Press Ctrl+C to stop.\n"));
|
|
56273
56297
|
await connectSSH(sshToken, sshHost, sshProxyCommand, { localPort, remotePort });
|
|
56274
56298
|
}
|
|
56275
|
-
var
|
|
56299
|
+
var import_chalk13;
|
|
56276
56300
|
var init_tunnel = __esm({
|
|
56277
56301
|
"src/commands/tunnel.ts"() {
|
|
56278
56302
|
"use strict";
|
|
56279
|
-
|
|
56303
|
+
import_chalk13 = __toESM(require("chalk"));
|
|
56280
56304
|
init_command_utils();
|
|
56281
56305
|
init_port();
|
|
56282
56306
|
init_ssh();
|
|
@@ -56290,8 +56314,8 @@ async function orgCommand() {
|
|
|
56290
56314
|
const { organization } = await orgAuthenticatedFetch("/v1/whoami");
|
|
56291
56315
|
output2({ organization }, () => {
|
|
56292
56316
|
console.log(brand.bold("\n Active organization\n"));
|
|
56293
|
-
field("Organization",
|
|
56294
|
-
console.log(
|
|
56317
|
+
field("Organization", import_chalk14.default.bold(organization.name));
|
|
56318
|
+
console.log(import_chalk14.default.gray("\n Fixed by your API key. Use a key from another organization to switch.\n"));
|
|
56295
56319
|
});
|
|
56296
56320
|
return;
|
|
56297
56321
|
}
|
|
@@ -56300,8 +56324,8 @@ async function orgCommand() {
|
|
|
56300
56324
|
const organizations = await fetchOrganizations();
|
|
56301
56325
|
if (!currentOrgId) {
|
|
56302
56326
|
output2({ organization: null }, () => {
|
|
56303
|
-
console.log(
|
|
56304
|
-
console.log(
|
|
56327
|
+
console.log(import_chalk14.default.yellow("\n No organization selected."));
|
|
56328
|
+
console.log(import_chalk14.default.gray(' Run "replicas org switch" to select one.\n'));
|
|
56305
56329
|
});
|
|
56306
56330
|
return;
|
|
56307
56331
|
}
|
|
@@ -56309,8 +56333,8 @@ async function orgCommand() {
|
|
|
56309
56333
|
if (!currentOrg) {
|
|
56310
56334
|
clearOrganizationId();
|
|
56311
56335
|
output2({ organization: null }, () => {
|
|
56312
|
-
console.log(
|
|
56313
|
-
console.log(
|
|
56336
|
+
console.log(import_chalk14.default.yellow("\n The selected organization is no longer available to you."));
|
|
56337
|
+
console.log(import_chalk14.default.gray(' Run "replicas org switch" to select another.\n'));
|
|
56314
56338
|
});
|
|
56315
56339
|
return;
|
|
56316
56340
|
}
|
|
@@ -56323,7 +56347,7 @@ async function orgCommand() {
|
|
|
56323
56347
|
renderIdentity({ account, role, organizationName: currentOrg.name });
|
|
56324
56348
|
if (organizations.length > 1) {
|
|
56325
56349
|
console.log(
|
|
56326
|
-
|
|
56350
|
+
import_chalk14.default.gray(`
|
|
56327
56351
|
${organizations.length} organizations available. "replicas org switch" to change.`)
|
|
56328
56352
|
);
|
|
56329
56353
|
}
|
|
@@ -56346,7 +56370,7 @@ async function orgSwitchCommand() {
|
|
|
56346
56370
|
if (organizations.length > 1) {
|
|
56347
56371
|
const chosen = await promptForOrganization(organizations, currentOrgId);
|
|
56348
56372
|
if (!chosen) {
|
|
56349
|
-
console.log(
|
|
56373
|
+
console.log(import_chalk14.default.yellow("\n Cancelled. The active organization is unchanged.\n"));
|
|
56350
56374
|
return;
|
|
56351
56375
|
}
|
|
56352
56376
|
selectedId = chosen.id;
|
|
@@ -56371,11 +56395,11 @@ async function orgMembersCommand() {
|
|
|
56371
56395
|
}
|
|
56372
56396
|
});
|
|
56373
56397
|
}
|
|
56374
|
-
var
|
|
56398
|
+
var import_chalk14, NOT_LOGGED_IN;
|
|
56375
56399
|
var init_org = __esm({
|
|
56376
56400
|
"src/commands/org.ts"() {
|
|
56377
56401
|
"use strict";
|
|
56378
|
-
|
|
56402
|
+
import_chalk14 = __toESM(require("chalk"));
|
|
56379
56403
|
init_api2();
|
|
56380
56404
|
init_command_utils();
|
|
56381
56405
|
init_oauth_flow_ui();
|
|
@@ -56394,7 +56418,7 @@ function assertKnownKey(key2) {
|
|
|
56394
56418
|
async function configGetCommand(key2) {
|
|
56395
56419
|
ensureOrgApiAuthenticated();
|
|
56396
56420
|
assertKnownKey(key2);
|
|
56397
|
-
output2({ ide: getIdeCommand() }, ({ ide }) => console.log(
|
|
56421
|
+
output2({ ide: getIdeCommand() }, ({ ide }) => console.log(import_chalk15.default.green(`
|
|
56398
56422
|
IDE command: ${ide}
|
|
56399
56423
|
`)));
|
|
56400
56424
|
}
|
|
@@ -56402,7 +56426,7 @@ async function configSetCommand(key2, value) {
|
|
|
56402
56426
|
ensureOrgApiAuthenticated();
|
|
56403
56427
|
assertKnownKey(key2);
|
|
56404
56428
|
setIdeCommand(value);
|
|
56405
|
-
output2({ ide: value }, () => console.log(
|
|
56429
|
+
output2({ ide: value }, () => console.log(import_chalk15.default.green(`
|
|
56406
56430
|
\u2713 IDE command set to: ${value}
|
|
56407
56431
|
`)));
|
|
56408
56432
|
}
|
|
@@ -56411,17 +56435,17 @@ async function configListCommand() {
|
|
|
56411
56435
|
const config3 = readConfig();
|
|
56412
56436
|
if (!config3) throw new Error("No config found. Please login first.");
|
|
56413
56437
|
output2({ organization_id: config3.organization_id ?? null, ide: config3.ide_command ?? null }, () => {
|
|
56414
|
-
console.log(
|
|
56415
|
-
console.log(
|
|
56416
|
-
console.log(
|
|
56438
|
+
console.log(import_chalk15.default.green("\nCurrent configuration:"));
|
|
56439
|
+
console.log(import_chalk15.default.gray(` Organization ID: ${config3.organization_id || (config3.api_key ? "(set by API key)" : "(not set)")}`));
|
|
56440
|
+
console.log(import_chalk15.default.gray(` IDE command: ${config3.ide_command || "code (default)"}`));
|
|
56417
56441
|
console.log();
|
|
56418
56442
|
});
|
|
56419
56443
|
}
|
|
56420
|
-
var
|
|
56444
|
+
var import_chalk15;
|
|
56421
56445
|
var init_config2 = __esm({
|
|
56422
56446
|
"src/commands/config.ts"() {
|
|
56423
56447
|
"use strict";
|
|
56424
|
-
|
|
56448
|
+
import_chalk15 = __toESM(require("chalk"));
|
|
56425
56449
|
init_config();
|
|
56426
56450
|
init_command_utils();
|
|
56427
56451
|
init_output();
|
|
@@ -56607,11 +56631,11 @@ async function withAuthRecovery(operation, afterReauthentication) {
|
|
|
56607
56631
|
throw error62;
|
|
56608
56632
|
}
|
|
56609
56633
|
const message2 = error62 instanceof NotAuthenticatedError ? "You're not signed in to Replicas. Signing in..." : "Your Replicas session expired. Re-authenticating...";
|
|
56610
|
-
console.log(
|
|
56634
|
+
console.log(import_chalk16.default.yellow(`
|
|
56611
56635
|
${message2}`));
|
|
56612
56636
|
await loginCommand();
|
|
56613
56637
|
await afterReauthentication?.();
|
|
56614
|
-
console.log(
|
|
56638
|
+
console.log(import_chalk16.default.gray(" Retrying..."));
|
|
56615
56639
|
return { result: await operation(), reauthenticated: true };
|
|
56616
56640
|
}
|
|
56617
56641
|
}
|
|
@@ -56687,12 +56711,12 @@ async function runCredentialAuthFlow(options, flow) {
|
|
|
56687
56711
|
return completionUrl.toString();
|
|
56688
56712
|
});
|
|
56689
56713
|
}
|
|
56690
|
-
var
|
|
56714
|
+
var import_chalk16, UPLOAD_STEPS;
|
|
56691
56715
|
var init_credential_upload = __esm({
|
|
56692
56716
|
"src/lib/credential-upload.ts"() {
|
|
56693
56717
|
"use strict";
|
|
56694
56718
|
init_urls();
|
|
56695
|
-
|
|
56719
|
+
import_chalk16 = __toESM(require("chalk"));
|
|
56696
56720
|
init_api2();
|
|
56697
56721
|
init_auth();
|
|
56698
56722
|
init_oauth_flow_ui();
|
|
@@ -56760,7 +56784,7 @@ async function promptForAuthorizationCode() {
|
|
|
56760
56784
|
const rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
56761
56785
|
return new Promise((resolve4) => {
|
|
56762
56786
|
rl.on("close", () => resolve4(""));
|
|
56763
|
-
rl.question(
|
|
56787
|
+
rl.question(import_chalk17.default.gray(" Paste code here: "), (answer) => {
|
|
56764
56788
|
resolve4(answer.trim());
|
|
56765
56789
|
rl.close();
|
|
56766
56790
|
});
|
|
@@ -56836,12 +56860,12 @@ async function runClaudeOAuthFlow(totalSteps) {
|
|
|
56836
56860
|
}
|
|
56837
56861
|
return exchangeCodeForTokens2(code, returnedState, state, pkce.codeVerifier);
|
|
56838
56862
|
}
|
|
56839
|
-
var import_readline,
|
|
56863
|
+
var import_readline, import_chalk17, DEFAULT_CLIENT_ID, CLAUDE_CLIENT_ID, AUTHORIZATION_ENDPOINT2, TOKEN_ENDPOINT2, REDIRECT_URI, SCOPES;
|
|
56840
56864
|
var init_claude_oauth = __esm({
|
|
56841
56865
|
"src/lib/claude-oauth.ts"() {
|
|
56842
56866
|
"use strict";
|
|
56843
56867
|
import_readline = __toESM(require("readline"));
|
|
56844
|
-
|
|
56868
|
+
import_chalk17 = __toESM(require("chalk"));
|
|
56845
56869
|
init_oauth_flow_ui();
|
|
56846
56870
|
init_output();
|
|
56847
56871
|
init_pkce();
|
|
@@ -57077,27 +57101,27 @@ function initCommand(options) {
|
|
|
57077
57101
|
}
|
|
57078
57102
|
const higherPriority = REPLICAS_CONFIG_FILENAMES.slice(0, REPLICAS_CONFIG_FILENAMES.indexOf(targetFilename)).filter((filename) => import_fs4.default.existsSync(import_path5.default.join(process.cwd(), filename)));
|
|
57079
57103
|
output2({ path: configPath, shadowed_by: higherPriority }, () => {
|
|
57080
|
-
console.log(
|
|
57104
|
+
console.log(import_chalk18.default.green(`\u2713 Created ${targetFilename}`));
|
|
57081
57105
|
for (const filename of higherPriority) {
|
|
57082
57106
|
console.log("");
|
|
57083
|
-
console.log(
|
|
57084
|
-
console.log(
|
|
57107
|
+
console.log(import_chalk18.default.yellow(`Warning: ${filename} already exists and takes priority over ${targetFilename}.`));
|
|
57108
|
+
console.log(import_chalk18.default.gray(`Remove or rename ${filename} for ${targetFilename} to take effect.`));
|
|
57085
57109
|
}
|
|
57086
57110
|
console.log("");
|
|
57087
|
-
console.log(
|
|
57088
|
-
console.log(
|
|
57089
|
-
console.log(
|
|
57111
|
+
console.log(import_chalk18.default.gray("Configuration options:"));
|
|
57112
|
+
console.log(import_chalk18.default.gray(" systemPrompt - Custom instructions for AI coding assistants"));
|
|
57113
|
+
console.log(import_chalk18.default.gray(" startHook - Commands to run on workspace startup"));
|
|
57090
57114
|
if (!isYaml) {
|
|
57091
57115
|
console.log("");
|
|
57092
|
-
console.log(
|
|
57116
|
+
console.log(import_chalk18.default.gray("Tip: Use --yaml for YAML format with multiline system prompt support."));
|
|
57093
57117
|
}
|
|
57094
57118
|
});
|
|
57095
57119
|
}
|
|
57096
|
-
var
|
|
57120
|
+
var import_chalk18, import_fs4, import_path5;
|
|
57097
57121
|
var init_init = __esm({
|
|
57098
57122
|
"src/commands/init.ts"() {
|
|
57099
57123
|
"use strict";
|
|
57100
|
-
|
|
57124
|
+
import_chalk18 = __toESM(require("chalk"));
|
|
57101
57125
|
import_fs4 = __toESM(require("fs"));
|
|
57102
57126
|
import_path5 = __toESM(require("path"));
|
|
57103
57127
|
init_src();
|
|
@@ -57141,10 +57165,10 @@ async function readSecret(service, name) {
|
|
|
57141
57165
|
async function credentialsListCommand(agent) {
|
|
57142
57166
|
const response = await orgAuthenticatedFetch(`/v1/agents/${agent}/credentials`);
|
|
57143
57167
|
output2(response, ({ credentials: credentials2, selected }) => {
|
|
57144
|
-
if (credentials2.length === 0) console.log(
|
|
57168
|
+
if (credentials2.length === 0) console.log(import_chalk19.default.yellow(`No credentials connected for ${agent}.`));
|
|
57145
57169
|
for (const { method, scope } of credentials2) {
|
|
57146
57170
|
const isSelected = selected?.method === method && selected.scope === scope;
|
|
57147
|
-
console.log(`${method} ${scope}${isSelected ?
|
|
57171
|
+
console.log(`${method} ${scope}${isSelected ? import_chalk19.default.green(" (used by new workspaces)") : ""}`);
|
|
57148
57172
|
}
|
|
57149
57173
|
});
|
|
57150
57174
|
}
|
|
@@ -57152,12 +57176,12 @@ async function credentialsGetCommand(service, options) {
|
|
|
57152
57176
|
const status = await orgAuthenticatedFetch(credentialsPath(service, options));
|
|
57153
57177
|
output2(status, ({ hasCredentials, ...fields }) => {
|
|
57154
57178
|
if (!hasCredentials) {
|
|
57155
|
-
console.log(
|
|
57179
|
+
console.log(import_chalk19.default.yellow(`No ${scopeLabel(options)} ${service} credentials.`));
|
|
57156
57180
|
return;
|
|
57157
57181
|
}
|
|
57158
57182
|
const width = Math.max(...Object.keys(fields).map((key2) => key2.length)) + 2;
|
|
57159
57183
|
for (const [key2, value] of Object.entries(fields)) {
|
|
57160
|
-
console.log(`${
|
|
57184
|
+
console.log(`${import_chalk19.default.gray(key2.padEnd(width))}${typeof value === "string" ? value : JSON.stringify(value)}`);
|
|
57161
57185
|
}
|
|
57162
57186
|
});
|
|
57163
57187
|
}
|
|
@@ -57171,35 +57195,35 @@ async function credentialsSetCommand(service, options) {
|
|
|
57171
57195
|
[secretField]: await readSecret(service, secretField === "api_key" ? "API key" : "AWS secret access key")
|
|
57172
57196
|
};
|
|
57173
57197
|
const response = await orgAuthenticatedFetch(path14, { method: "POST", body: body2 });
|
|
57174
|
-
output2(response, () => console.log(
|
|
57198
|
+
output2(response, () => console.log(import_chalk19.default.green(`Saved ${scopeLabel(options)} ${service} credentials.`)));
|
|
57175
57199
|
}
|
|
57176
57200
|
async function credentialsRemoveCommand(service, options) {
|
|
57177
57201
|
const response = await orgAuthenticatedFetch(credentialsPath(service, options), { method: "DELETE" });
|
|
57178
|
-
output2(response, ({ success: success2 }) => console.log(success2 ?
|
|
57202
|
+
output2(response, ({ success: success2 }) => console.log(success2 ? import_chalk19.default.green(`Removed ${scopeLabel(options)} ${service} credentials.`) : `No ${scopeLabel(options)} ${service} credentials to remove.`));
|
|
57179
57203
|
}
|
|
57180
57204
|
async function credentialsUsageCommand({ org: org2, user }) {
|
|
57181
57205
|
const scope = org2 ? "org" : user ? "user" : null;
|
|
57182
57206
|
const response = await orgAuthenticatedFetch(`/v1/agents/subscription-usage${scope ? `?scope=${scope}` : ""}`);
|
|
57183
57207
|
output2(response, ({ accounts }) => {
|
|
57184
|
-
if (accounts.length === 0) console.log(
|
|
57208
|
+
if (accounts.length === 0) console.log(import_chalk19.default.yellow("No Claude or Codex subscriptions connected."));
|
|
57185
57209
|
for (const account of accounts) {
|
|
57186
|
-
const limits = account.reconnectRequired ?
|
|
57210
|
+
const limits = account.reconnectRequired ? import_chalk19.default.yellow(`Reconnect required: run ${getSubscriptionAuthCommand(account.provider, account.scope)} with the same account`) : !account.windows ? import_chalk19.default.gray("Usage unavailable, try again in a few minutes") : account.windows.length === 0 ? "No usage limits" : account.windows.map((window) => [
|
|
57187
57211
|
window.kind === "session" ? "5-hour" : "weekly",
|
|
57188
57212
|
window.model,
|
|
57189
57213
|
`${Math.round(window.usedPercent)}%`,
|
|
57190
|
-
window.resetsAt &&
|
|
57214
|
+
window.resetsAt && import_chalk19.default.gray(`(resets ${formatDate(window.resetsAt)})`)
|
|
57191
57215
|
].filter(Boolean).join(" ")).join(", ");
|
|
57192
57216
|
const label = [account.email ?? account.credentialId, account.planType].filter(Boolean).join(" ");
|
|
57193
57217
|
console.log(`${account.provider} ${scopeLabel({ org: account.scope === "org" })} ${label} ${limits}`);
|
|
57194
|
-
if (account.exhaustedUntil) console.log(
|
|
57218
|
+
if (account.exhaustedUntil) console.log(import_chalk19.default.gray(` Workspaces skip this account until ${formatDate(account.exhaustedUntil)}`));
|
|
57195
57219
|
}
|
|
57196
57220
|
});
|
|
57197
57221
|
}
|
|
57198
|
-
var
|
|
57222
|
+
var import_chalk19, OPTIONAL_SECRET_SERVICES, scopeLabel;
|
|
57199
57223
|
var init_credentials2 = __esm({
|
|
57200
57224
|
"src/commands/credentials.ts"() {
|
|
57201
57225
|
"use strict";
|
|
57202
|
-
|
|
57226
|
+
import_chalk19 = __toESM(require("chalk"));
|
|
57203
57227
|
init_src();
|
|
57204
57228
|
init_subscription_usage();
|
|
57205
57229
|
init_api2();
|
|
@@ -57230,7 +57254,7 @@ function startUpdateCheck(currentVersion) {
|
|
|
57230
57254
|
}
|
|
57231
57255
|
const latestVersion = payload.version;
|
|
57232
57256
|
if (compareVersions(latestVersion, currentVersion) > 0) {
|
|
57233
|
-
notice =
|
|
57257
|
+
notice = import_chalk20.default.dim(
|
|
57234
57258
|
`
|
|
57235
57259
|
Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm install -g replicas-cli@latest
|
|
57236
57260
|
`
|
|
@@ -57240,11 +57264,11 @@ Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm in
|
|
|
57240
57264
|
}
|
|
57241
57265
|
})();
|
|
57242
57266
|
}
|
|
57243
|
-
var
|
|
57267
|
+
var import_chalk20, VERSION_CHECK_TIMEOUT;
|
|
57244
57268
|
var init_version_check = __esm({
|
|
57245
57269
|
"src/lib/version-check.ts"() {
|
|
57246
57270
|
"use strict";
|
|
57247
|
-
|
|
57271
|
+
import_chalk20 = __toESM(require("chalk"));
|
|
57248
57272
|
init_src();
|
|
57249
57273
|
init_monolith_url();
|
|
57250
57274
|
init_output();
|
|
@@ -57300,23 +57324,23 @@ async function repositoriesListCommand() {
|
|
|
57300
57324
|
ensureOrgApiAuthenticated();
|
|
57301
57325
|
output2(await orgAuthenticatedFetch("/v1/repositories"), ({ repositories }) => {
|
|
57302
57326
|
if (repositories.length === 0) {
|
|
57303
|
-
console.log(
|
|
57327
|
+
console.log(import_chalk21.default.yellow("\nNo repositories found.\n"));
|
|
57304
57328
|
return;
|
|
57305
57329
|
}
|
|
57306
|
-
console.log(
|
|
57330
|
+
console.log(import_chalk21.default.green(`
|
|
57307
57331
|
Repositories (${repositories.length}):
|
|
57308
57332
|
`));
|
|
57309
57333
|
for (const repo of repositories) {
|
|
57310
|
-
console.log(
|
|
57311
|
-
console.log(
|
|
57312
|
-
console.log(
|
|
57313
|
-
console.log(
|
|
57314
|
-
console.log(
|
|
57334
|
+
console.log(import_chalk21.default.white(` ${repo.name}`));
|
|
57335
|
+
console.log(import_chalk21.default.gray(` ID: ${repo.id}`));
|
|
57336
|
+
console.log(import_chalk21.default.gray(` URL: ${repo.url}`));
|
|
57337
|
+
console.log(import_chalk21.default.gray(` Default Branch: ${repo.default_branch}`));
|
|
57338
|
+
console.log(import_chalk21.default.gray(` Created: ${formatDate(repo.created_at)}`));
|
|
57315
57339
|
if (repo.github_repository_id) {
|
|
57316
|
-
console.log(
|
|
57340
|
+
console.log(import_chalk21.default.gray(` GitHub ID: ${repo.github_repository_id}`));
|
|
57317
57341
|
}
|
|
57318
57342
|
if (repo.gitlab_project_id) {
|
|
57319
|
-
console.log(
|
|
57343
|
+
console.log(import_chalk21.default.gray(` GitLab Project ID: ${repo.gitlab_project_id}`));
|
|
57320
57344
|
}
|
|
57321
57345
|
console.log();
|
|
57322
57346
|
}
|
|
@@ -57388,6 +57412,35 @@ async function repositoriesAddCommand(fullName, options) {
|
|
|
57388
57412
|
await orgAuthenticatedFetch("/v1/repositories", { method: "POST", body: body2 });
|
|
57389
57413
|
outputSuccess(`Added ${matched.label}`);
|
|
57390
57414
|
}
|
|
57415
|
+
async function repositoriesImportGroupCommand(group, options) {
|
|
57416
|
+
const body2 = {
|
|
57417
|
+
group,
|
|
57418
|
+
include_subgroups: options.subgroups !== false
|
|
57419
|
+
};
|
|
57420
|
+
const result = await orgAuthenticatedFetch("/v1/gitlab/groups/import", {
|
|
57421
|
+
method: "POST",
|
|
57422
|
+
body: body2
|
|
57423
|
+
});
|
|
57424
|
+
output2(result, (res) => {
|
|
57425
|
+
const parts = [
|
|
57426
|
+
`Added ${res.added.length}`,
|
|
57427
|
+
res.already_connected > 0 ? `${res.already_connected} already connected` : null,
|
|
57428
|
+
res.failed.length > 0 ? `${res.failed.length} failed` : null
|
|
57429
|
+
].filter(Boolean);
|
|
57430
|
+
console.log(import_chalk21.default.green(`
|
|
57431
|
+
Imported GitLab group ${res.group}: ${parts.join(", ")} (${res.total} total).
|
|
57432
|
+
`));
|
|
57433
|
+
if (res.has_more) {
|
|
57434
|
+
console.log(import_chalk21.default.yellow("Warning: GitLab returned more projects than the page limit. Import specific subgroups to connect the rest.\n"));
|
|
57435
|
+
}
|
|
57436
|
+
if (res.failed.length > 0) {
|
|
57437
|
+
for (const failure2 of res.failed) {
|
|
57438
|
+
console.log(import_chalk21.default.red(` \u2717 ${failure2.path}: ${failure2.error}`));
|
|
57439
|
+
}
|
|
57440
|
+
console.log();
|
|
57441
|
+
}
|
|
57442
|
+
});
|
|
57443
|
+
}
|
|
57391
57444
|
async function repositoriesUpdateCommand(repository, options) {
|
|
57392
57445
|
const [id] = await resolveRepositoryIds([repository]);
|
|
57393
57446
|
const body2 = { default_branch: options.defaultBranch };
|
|
@@ -57405,11 +57458,11 @@ async function repositoriesBranchesCommand(repository) {
|
|
|
57405
57458
|
for (const branch of branches) console.log(branch);
|
|
57406
57459
|
});
|
|
57407
57460
|
}
|
|
57408
|
-
var
|
|
57461
|
+
var import_chalk21, splitList;
|
|
57409
57462
|
var init_repositories2 = __esm({
|
|
57410
57463
|
"src/commands/repositories.ts"() {
|
|
57411
57464
|
"use strict";
|
|
57412
|
-
|
|
57465
|
+
import_chalk21 = __toESM(require("chalk"));
|
|
57413
57466
|
init_api2();
|
|
57414
57467
|
init_command_utils();
|
|
57415
57468
|
init_output();
|
|
@@ -57438,23 +57491,23 @@ async function resolveEnvironmentId(input2) {
|
|
|
57438
57491
|
return resolved.id;
|
|
57439
57492
|
}
|
|
57440
57493
|
function printEnvironment(env, repoSkillCount) {
|
|
57441
|
-
console.log(
|
|
57442
|
-
console.log(
|
|
57494
|
+
console.log(import_chalk22.default.white(` ${env.name}${env.user_id ? import_chalk22.default.gray(" (personal)") : ""}`));
|
|
57495
|
+
console.log(import_chalk22.default.gray(` ID: ${env.id}`));
|
|
57443
57496
|
if (env.description) {
|
|
57444
|
-
console.log(
|
|
57497
|
+
console.log(import_chalk22.default.gray(` Description: ${env.description}`));
|
|
57445
57498
|
}
|
|
57446
57499
|
const repositoryIds = env.repository_ids ?? [];
|
|
57447
57500
|
if (repositoryIds.length > 0) {
|
|
57448
|
-
console.log(
|
|
57501
|
+
console.log(import_chalk22.default.gray(` Repositories: ${repositoryIds.join(", ")}`));
|
|
57449
57502
|
}
|
|
57450
|
-
console.log(
|
|
57503
|
+
console.log(import_chalk22.default.gray(` Setup source: ${env.setup_source_mode}`));
|
|
57451
57504
|
if (env.variable_count !== void 0) {
|
|
57452
|
-
console.log(
|
|
57505
|
+
console.log(import_chalk22.default.gray(` Variables: ${env.variable_count}, Files: ${env.file_count ?? 0}, Added skills: ${env.skill_count ?? 0}, MCPs: ${env.mcp_count ?? 0}`));
|
|
57453
57506
|
}
|
|
57454
57507
|
if (repoSkillCount !== void 0) {
|
|
57455
|
-
console.log(
|
|
57508
|
+
console.log(import_chalk22.default.gray(` Repository skills: ${repoSkillCount}`));
|
|
57456
57509
|
}
|
|
57457
|
-
console.log(
|
|
57510
|
+
console.log(import_chalk22.default.gray(` Updated: ${formatDate(env.updated_at)}`));
|
|
57458
57511
|
console.log();
|
|
57459
57512
|
}
|
|
57460
57513
|
async function environmentListCommand() {
|
|
@@ -57462,10 +57515,10 @@ async function environmentListCommand() {
|
|
|
57462
57515
|
const response = await orgAuthenticatedFetch("/v1/environments?scope=all");
|
|
57463
57516
|
output2(response, ({ environments }) => {
|
|
57464
57517
|
if (environments.length === 0) {
|
|
57465
|
-
console.log(
|
|
57518
|
+
console.log(import_chalk22.default.yellow("\nNo environments found.\n"));
|
|
57466
57519
|
return;
|
|
57467
57520
|
}
|
|
57468
|
-
console.log(
|
|
57521
|
+
console.log(import_chalk22.default.green(`
|
|
57469
57522
|
Environments (${environments.length}):
|
|
57470
57523
|
`));
|
|
57471
57524
|
for (const env of environments) printEnvironment(env);
|
|
@@ -57477,13 +57530,13 @@ async function environmentGetCommand(idOrName) {
|
|
|
57477
57530
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}`);
|
|
57478
57531
|
const repoSkills = await orgAuthenticatedFetch(`/v1/environments/${response.environment.id}/repo-skills`);
|
|
57479
57532
|
output2({ ...response, ...repoSkills }, ({ environment: environment2 }) => {
|
|
57480
|
-
console.log(
|
|
57533
|
+
console.log(import_chalk22.default.green(`
|
|
57481
57534
|
Environment: ${environment2.name}
|
|
57482
57535
|
`));
|
|
57483
57536
|
const linkedSkills = repoSkills.repo_skills.filter((skill) => skill.path.startsWith(`.${skill.framework}/skills/`));
|
|
57484
57537
|
printEnvironment(environment2, new Set(linkedSkills.map((skill) => `${skill.repository_id}:${skill.path.split("/")[2]}`)).size);
|
|
57485
57538
|
for (const message2 of [repoSkills.error, ...repoSkills.repo_errors.map((repo) => `${repo.repository_full_name}: ${repo.error}`)]) {
|
|
57486
|
-
if (message2) console.log(
|
|
57539
|
+
if (message2) console.log(import_chalk22.default.yellow(` Could not read repository skills: ${message2}`));
|
|
57487
57540
|
}
|
|
57488
57541
|
});
|
|
57489
57542
|
}
|
|
@@ -57498,7 +57551,7 @@ async function environmentCreateCommand(name, options) {
|
|
|
57498
57551
|
validate: (v2) => v2.trim() ? true : "Name is required"
|
|
57499
57552
|
});
|
|
57500
57553
|
if (!r.name) {
|
|
57501
|
-
console.log(
|
|
57554
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
57502
57555
|
return;
|
|
57503
57556
|
}
|
|
57504
57557
|
envName = r.name;
|
|
@@ -57532,9 +57585,9 @@ async function environmentCreateCommand(name, options) {
|
|
|
57532
57585
|
body: body2
|
|
57533
57586
|
});
|
|
57534
57587
|
output2(response, ({ environment: environment2 }) => {
|
|
57535
|
-
console.log(
|
|
57588
|
+
console.log(import_chalk22.default.green(`
|
|
57536
57589
|
Created environment: ${environment2.name}`));
|
|
57537
|
-
console.log(
|
|
57590
|
+
console.log(import_chalk22.default.gray(` ID: ${environment2.id}
|
|
57538
57591
|
`));
|
|
57539
57592
|
});
|
|
57540
57593
|
}
|
|
@@ -57559,7 +57612,7 @@ async function environmentEditCommand(idOrName, options) {
|
|
|
57559
57612
|
method: "PATCH",
|
|
57560
57613
|
body: body2
|
|
57561
57614
|
});
|
|
57562
|
-
output2(response, ({ environment: environment2 }) => console.log(
|
|
57615
|
+
output2(response, ({ environment: environment2 }) => console.log(import_chalk22.default.green(`
|
|
57563
57616
|
Updated environment: ${environment2.name}
|
|
57564
57617
|
`)));
|
|
57565
57618
|
}
|
|
@@ -57573,11 +57626,11 @@ Deleted environment ${idOrName}.
|
|
|
57573
57626
|
`);
|
|
57574
57627
|
}
|
|
57575
57628
|
function printVariable(v2) {
|
|
57576
|
-
console.log(
|
|
57577
|
-
console.log(
|
|
57578
|
-
console.log(
|
|
57579
|
-
if (v2.proxy_hosts.length > 0) console.log(
|
|
57580
|
-
console.log(
|
|
57629
|
+
console.log(import_chalk22.default.white(` ${v2.key}`));
|
|
57630
|
+
console.log(import_chalk22.default.gray(` ID: ${v2.id}`));
|
|
57631
|
+
console.log(import_chalk22.default.gray(` Value: ${v2.value}`));
|
|
57632
|
+
if (v2.proxy_hosts.length > 0) console.log(import_chalk22.default.gray(` Proxied to: ${v2.proxy_hosts.join(", ")}`));
|
|
57633
|
+
console.log(import_chalk22.default.gray(` Updated: ${formatDate(v2.updated_at)}`));
|
|
57581
57634
|
console.log();
|
|
57582
57635
|
}
|
|
57583
57636
|
async function envVarsListCommand(envIdOrName, options) {
|
|
@@ -57589,14 +57642,14 @@ async function envVarsListCommand(envIdOrName, options) {
|
|
|
57589
57642
|
const variables = options.reveal ? response.environment_variables : response.environment_variables.map((v2) => ({ ...v2, value: maskValue(v2.value) }));
|
|
57590
57643
|
output2({ environment_variables: variables }, ({ environment_variables }) => {
|
|
57591
57644
|
if (environment_variables.length === 0) {
|
|
57592
|
-
console.log(
|
|
57645
|
+
console.log(import_chalk22.default.yellow("\nNo variables.\n"));
|
|
57593
57646
|
return;
|
|
57594
57647
|
}
|
|
57595
|
-
console.log(
|
|
57648
|
+
console.log(import_chalk22.default.green(`
|
|
57596
57649
|
Variables (${environment_variables.length}):
|
|
57597
57650
|
`));
|
|
57598
57651
|
if (!options.reveal) {
|
|
57599
|
-
console.log(
|
|
57652
|
+
console.log(import_chalk22.default.gray(" Values are masked. Pass --reveal to show full values.\n"));
|
|
57600
57653
|
}
|
|
57601
57654
|
for (const v2 of environment_variables) printVariable(v2);
|
|
57602
57655
|
});
|
|
@@ -57611,13 +57664,8 @@ async function envVarsProxyCommand(envIdOrName, key2, hosts) {
|
|
|
57611
57664
|
const match = await findVariableByKey(id, key2);
|
|
57612
57665
|
if (!match) throw new Error(`No variable named ${key2} in this environment`);
|
|
57613
57666
|
const body2 = { proxy_hosts: hosts };
|
|
57614
|
-
const response = await orgAuthenticatedFetch(
|
|
57615
|
-
|
|
57616
|
-
{ method: "PATCH", body: body2 }
|
|
57617
|
-
);
|
|
57618
|
-
output2(response, (result) => console.log("message" in result ? import_chalk21.default.yellow(`
|
|
57619
|
-
${result.message}
|
|
57620
|
-
`) : import_chalk21.default.green(`
|
|
57667
|
+
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/variables/${match.id}`, { method: "PATCH", body: body2 });
|
|
57668
|
+
output2(response, (result) => console.log(import_chalk22.default.green(`
|
|
57621
57669
|
${key2} is ${result.environment_variable.proxy_hosts.length > 0 ? `sent only to ${result.environment_variable.proxy_hosts.join(", ")}` : "no longer proxied"}.
|
|
57622
57670
|
`)));
|
|
57623
57671
|
}
|
|
@@ -57631,7 +57679,7 @@ async function envVarsSetCommand(envIdOrName, key2, value, options) {
|
|
|
57631
57679
|
`/v1/environments/${id}/variables/${match.id}`,
|
|
57632
57680
|
{ method: "PATCH", body: body3 }
|
|
57633
57681
|
);
|
|
57634
|
-
output2({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
57682
|
+
output2({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk22.default.green(`
|
|
57635
57683
|
Updated variable ${environment_variable.key}.
|
|
57636
57684
|
`)));
|
|
57637
57685
|
return;
|
|
@@ -57646,7 +57694,7 @@ Updated variable ${environment_variable.key}.
|
|
|
57646
57694
|
`/v1/environments/${id}/variables`,
|
|
57647
57695
|
{ method: "POST", body: body2 }
|
|
57648
57696
|
);
|
|
57649
|
-
output2({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
57697
|
+
output2({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk22.default.green(`
|
|
57650
57698
|
Created variable ${environment_variable.key}.
|
|
57651
57699
|
`)));
|
|
57652
57700
|
}
|
|
@@ -57681,15 +57729,15 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57681
57729
|
const local = parsePosixEnvFile(readRuntimeEnv());
|
|
57682
57730
|
const available = options.replace ? [] : keys.filter((key2) => Object.hasOwn(local, key2) && local[key2].length > 0);
|
|
57683
57731
|
const wanted = keys.filter((key2) => !available.includes(key2));
|
|
57684
|
-
const loadHint =
|
|
57732
|
+
const loadHint = import_chalk22.default.gray(`
|
|
57685
57733
|
Values are never printed. Load them into a command with: . ~/.replicas/runtime-env.sh && <command>
|
|
57686
57734
|
`);
|
|
57687
57735
|
if (wanted.length === 0) {
|
|
57688
57736
|
output2({ status: "provided", exported: available, missing: [] }, () => {
|
|
57689
57737
|
console.log(`
|
|
57690
|
-
${
|
|
57738
|
+
${import_chalk22.default.green("Already available:")} ${available.join(", ")}`);
|
|
57691
57739
|
console.log(loadHint);
|
|
57692
|
-
console.log(
|
|
57740
|
+
console.log(import_chalk22.default.gray(" If a value is wrong, run this again with --replace to ask the user for a new one.\n"));
|
|
57693
57741
|
});
|
|
57694
57742
|
return;
|
|
57695
57743
|
}
|
|
@@ -57725,11 +57773,11 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57725
57773
|
console.log("");
|
|
57726
57774
|
if (exported.length > 0 || available.length > 0) {
|
|
57727
57775
|
const where = request2.destination === "workspace" ? "this workspace only" : "saved to the environment";
|
|
57728
|
-
console.log(` ${
|
|
57776
|
+
console.log(` ${import_chalk22.default.green("Provided:")} ${[...available, ...exported].join(", ")} ${import_chalk22.default.gray(`(${where})`)}`);
|
|
57729
57777
|
}
|
|
57730
57778
|
if (request2.status === "pending") {
|
|
57731
|
-
console.log(` ${
|
|
57732
|
-
console.log(
|
|
57779
|
+
console.log(` ${import_chalk22.default.yellow("Still waiting for:")} ${missing.join(", ")}`);
|
|
57780
|
+
console.log(import_chalk22.default.gray(options.wait === false ? `
|
|
57733
57781
|
Asked above the chat composer (${created2.url}). Keep working, and run this command again when you need the values.
|
|
57734
57782
|
` : created2.wait ? `
|
|
57735
57783
|
The form stays open above the chat composer (${created2.url}). End your turn and say what the values are for. When the user saves, you get a message; run this command again then.
|
|
@@ -57739,21 +57787,21 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57739
57787
|
`));
|
|
57740
57788
|
return;
|
|
57741
57789
|
}
|
|
57742
|
-
if (missing.length > 0) console.log(` ${
|
|
57790
|
+
if (missing.length > 0) console.log(` ${import_chalk22.default.gray(request2.status === "skipped" ? "Skipped by the user:" : "Not provided:")} ${missing.join(", ")}`);
|
|
57743
57791
|
if (exported.length === 0) {
|
|
57744
|
-
console.log(
|
|
57792
|
+
console.log(import_chalk22.default.gray("\n Continue without them, or ask the user how they want to proceed.\n"));
|
|
57745
57793
|
return;
|
|
57746
57794
|
}
|
|
57747
57795
|
console.log(loadHint);
|
|
57748
|
-
if (options.replace) console.log(
|
|
57796
|
+
if (options.replace) console.log(import_chalk22.default.gray(" Leave out --replace from now on; running it again asks the user again.\n"));
|
|
57749
57797
|
});
|
|
57750
57798
|
}
|
|
57751
57799
|
function printFile(f) {
|
|
57752
|
-
console.log(
|
|
57753
|
-
console.log(
|
|
57754
|
-
console.log(
|
|
57755
|
-
console.log(
|
|
57756
|
-
console.log(
|
|
57800
|
+
console.log(import_chalk22.default.white(` ${f.path}`));
|
|
57801
|
+
console.log(import_chalk22.default.gray(` ID: ${f.id}`));
|
|
57802
|
+
console.log(import_chalk22.default.gray(` Name: ${f.name}`));
|
|
57803
|
+
console.log(import_chalk22.default.gray(` Size: ${f.content.length} bytes`));
|
|
57804
|
+
console.log(import_chalk22.default.gray(` Updated: ${formatDate(f.updated_at)}`));
|
|
57757
57805
|
console.log();
|
|
57758
57806
|
}
|
|
57759
57807
|
async function envFilesListCommand(envIdOrName) {
|
|
@@ -57764,10 +57812,10 @@ async function envFilesListCommand(envIdOrName) {
|
|
|
57764
57812
|
);
|
|
57765
57813
|
output2(response, ({ environment_files }) => {
|
|
57766
57814
|
if (environment_files.length === 0) {
|
|
57767
|
-
console.log(
|
|
57815
|
+
console.log(import_chalk22.default.yellow("\nNo files.\n"));
|
|
57768
57816
|
return;
|
|
57769
57817
|
}
|
|
57770
|
-
console.log(
|
|
57818
|
+
console.log(import_chalk22.default.green(`
|
|
57771
57819
|
Files (${environment_files.length}):
|
|
57772
57820
|
`));
|
|
57773
57821
|
for (const f of environment_files) printFile(f);
|
|
@@ -57799,7 +57847,7 @@ async function envFilesSetCommand(envIdOrName, destinationPath, options) {
|
|
|
57799
57847
|
`/v1/environments/${id}/files/${match.id}`,
|
|
57800
57848
|
{ method: "PATCH", body: body3 }
|
|
57801
57849
|
);
|
|
57802
|
-
output2(response2, ({ environment_file }) => console.log(
|
|
57850
|
+
output2(response2, ({ environment_file }) => console.log(import_chalk22.default.green(`
|
|
57803
57851
|
Updated file ${environment_file.path}.
|
|
57804
57852
|
`)));
|
|
57805
57853
|
return;
|
|
@@ -57814,7 +57862,7 @@ Updated file ${environment_file.path}.
|
|
|
57814
57862
|
`/v1/environments/${id}/files`,
|
|
57815
57863
|
{ method: "POST", body: body2 }
|
|
57816
57864
|
);
|
|
57817
|
-
output2(response, ({ environment_file }) => console.log(
|
|
57865
|
+
output2(response, ({ environment_file }) => console.log(import_chalk22.default.green(`
|
|
57818
57866
|
Created file ${environment_file.path}.
|
|
57819
57867
|
`)));
|
|
57820
57868
|
}
|
|
@@ -57844,16 +57892,16 @@ async function envHookGetCommand(envIdOrName, kind) {
|
|
|
57844
57892
|
const hook = kind === "warm" ? (await orgAuthenticatedFetch(`/v1/environments/${id}/warm-hooks`)).warm_hook : (await orgAuthenticatedFetch(`/v1/environments/${id}/start-hooks`)).start_hook;
|
|
57845
57893
|
output2({ hook }, () => {
|
|
57846
57894
|
if (!hook) {
|
|
57847
|
-
console.log(
|
|
57895
|
+
console.log(import_chalk22.default.yellow(`
|
|
57848
57896
|
No ${kind} hook configured.
|
|
57849
57897
|
`));
|
|
57850
57898
|
return;
|
|
57851
57899
|
}
|
|
57852
|
-
console.log(
|
|
57900
|
+
console.log(import_chalk22.default.green(`
|
|
57853
57901
|
${kind === "warm" ? "Warm" : "Start"} hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
57854
57902
|
`));
|
|
57855
|
-
console.log(
|
|
57856
|
-
console.log(
|
|
57903
|
+
console.log(import_chalk22.default.gray(` ID: ${hook.id}`));
|
|
57904
|
+
console.log(import_chalk22.default.gray(` Created: ${formatDate(hook.created_at)}
|
|
57857
57905
|
`));
|
|
57858
57906
|
console.log(hook.content);
|
|
57859
57907
|
console.log();
|
|
@@ -57869,7 +57917,7 @@ async function envHookSaveCommand(envIdOrName, options, kind) {
|
|
|
57869
57917
|
`/v1/environments/${id}/warm-hooks/save`,
|
|
57870
57918
|
{ method: "POST", body: body3 }
|
|
57871
57919
|
);
|
|
57872
|
-
output2(response2, ({ warm_hook }) => console.log(
|
|
57920
|
+
output2(response2, ({ warm_hook }) => console.log(import_chalk22.default.green(warm_hook ? `
|
|
57873
57921
|
Saved warm hook v${warm_hook.version}.
|
|
57874
57922
|
` : "\nCleared warm hook.\n")));
|
|
57875
57923
|
return;
|
|
@@ -57879,7 +57927,7 @@ Saved warm hook v${warm_hook.version}.
|
|
|
57879
57927
|
`/v1/environments/${id}/start-hooks/save`,
|
|
57880
57928
|
{ method: "POST", body: body2 }
|
|
57881
57929
|
);
|
|
57882
|
-
output2(response, ({ start_hook }) => console.log(
|
|
57930
|
+
output2(response, ({ start_hook }) => console.log(import_chalk22.default.green(start_hook ? `
|
|
57883
57931
|
Saved start hook v${start_hook.version}.
|
|
57884
57932
|
` : "\nCleared start hook.\n")));
|
|
57885
57933
|
}
|
|
@@ -57897,7 +57945,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
57897
57945
|
body: kind === "warm" ? { content, mode: options.save ? "save_test" : "test_only" } : { content },
|
|
57898
57946
|
onEvent: (event) => {
|
|
57899
57947
|
if (event.type === "progress" && event.message) {
|
|
57900
|
-
console.log(
|
|
57948
|
+
console.log(import_chalk22.default.gray(event.message));
|
|
57901
57949
|
} else if (event.type === "output" && event.output) {
|
|
57902
57950
|
logs += event.output;
|
|
57903
57951
|
if (!isJsonMode()) process.stdout.write(event.output);
|
|
@@ -57914,7 +57962,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
57914
57962
|
const label = kind === "warm" ? "Warm" : "Start";
|
|
57915
57963
|
const passed = !timedOut && exitCode === 0;
|
|
57916
57964
|
output2({ passed, exit_code: exitCode, timed_out: timedOut, saved: passed && !!options.save, output: logs }, () => {
|
|
57917
|
-
if (passed) console.log(
|
|
57965
|
+
if (passed) console.log(import_chalk22.default.green(`
|
|
57918
57966
|
${label} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
|
|
57919
57967
|
`));
|
|
57920
57968
|
});
|
|
@@ -57931,24 +57979,24 @@ async function envHookRepositoryHooksCommand(envIdOrName, kind) {
|
|
|
57931
57979
|
)).repositories.map((repository) => ({ ...repository, hook: repository.start_hook }));
|
|
57932
57980
|
output2({ repositories }, () => {
|
|
57933
57981
|
if (repositories.length === 0) {
|
|
57934
|
-
console.log(
|
|
57982
|
+
console.log(import_chalk22.default.yellow("\nNo repositories bound to this environment.\n"));
|
|
57935
57983
|
return;
|
|
57936
57984
|
}
|
|
57937
|
-
console.log(
|
|
57985
|
+
console.log(import_chalk22.default.green(`
|
|
57938
57986
|
Repository ${kind} hooks (${repositories.length}):
|
|
57939
57987
|
`));
|
|
57940
57988
|
for (const repo of repositories) {
|
|
57941
|
-
console.log(
|
|
57989
|
+
console.log(import_chalk22.default.white(` ${repo.repository_name} @${repo.default_branch}`));
|
|
57942
57990
|
if (repo.error) {
|
|
57943
|
-
console.log(
|
|
57991
|
+
console.log(import_chalk22.default.red(` Error: ${repo.error}`));
|
|
57944
57992
|
} else if (repo.hook) {
|
|
57945
|
-
console.log(
|
|
57946
|
-
console.log(
|
|
57993
|
+
console.log(import_chalk22.default.gray(` Source: ${repo.filename ?? "(unknown)"}`));
|
|
57994
|
+
console.log(import_chalk22.default.gray(` Commands (${repo.hook.commands.length}):`));
|
|
57947
57995
|
for (const cmd of repo.hook.commands) {
|
|
57948
|
-
console.log(
|
|
57996
|
+
console.log(import_chalk22.default.gray(` ${cmd}`));
|
|
57949
57997
|
}
|
|
57950
57998
|
} else {
|
|
57951
|
-
console.log(
|
|
57999
|
+
console.log(import_chalk22.default.gray(` No ${kind}Hook defined.`));
|
|
57952
58000
|
}
|
|
57953
58001
|
console.log();
|
|
57954
58002
|
}
|
|
@@ -57990,7 +58038,7 @@ async function envSkillsAddCommand(env, source, slug2, options) {
|
|
|
57990
58038
|
const id = await resolveEnvironmentId(env);
|
|
57991
58039
|
const body2 = { environment_id: id, source, slug: slug2, name: options.name ?? slug2 };
|
|
57992
58040
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/skills`, { method: "POST", body: body2 });
|
|
57993
|
-
output2(response, () => console.log(
|
|
58041
|
+
output2(response, () => console.log(import_chalk22.default.green(`Added skill ${slug2} from ${source}`)));
|
|
57994
58042
|
}
|
|
57995
58043
|
async function envSkillsRemoveCommand(env, slugOrId) {
|
|
57996
58044
|
const id = await resolveEnvironmentId(env);
|
|
@@ -58018,7 +58066,7 @@ async function envMcpsAddCommand(env, name, options) {
|
|
|
58018
58066
|
const id = await resolveEnvironmentId(env);
|
|
58019
58067
|
const body2 = { environment_id: id, name, ...server };
|
|
58020
58068
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/mcps`, { method: "POST", body: body2 });
|
|
58021
|
-
output2(response, () => console.log(
|
|
58069
|
+
output2(response, () => console.log(import_chalk22.default.green(`Added MCP server ${name}`)));
|
|
58022
58070
|
}
|
|
58023
58071
|
async function envMcpsRemoveCommand(env, nameOrId) {
|
|
58024
58072
|
const id = await resolveEnvironmentId(env);
|
|
@@ -58034,13 +58082,13 @@ async function envDevicesListCommand(env) {
|
|
|
58034
58082
|
);
|
|
58035
58083
|
output2(response, ({ environment_devices }) => {
|
|
58036
58084
|
if (environment_devices.length === 0) {
|
|
58037
|
-
console.log(
|
|
58085
|
+
console.log(import_chalk22.default.yellow(`
|
|
58038
58086
|
No devices. Add one with: replicas env devices add ${env} <name> --user <user>
|
|
58039
58087
|
`));
|
|
58040
58088
|
return;
|
|
58041
58089
|
}
|
|
58042
58090
|
for (const device of environment_devices) {
|
|
58043
|
-
const status = isDeviceOnline(device.last_seen_at) ?
|
|
58091
|
+
const status = isDeviceOnline(device.last_seen_at) ? import_chalk22.default.green("online") : import_chalk22.default.yellow(device.last_seen_at ? `offline, last seen ${formatCompactRelativeTime(device.last_seen_at)}` : "offline");
|
|
58044
58092
|
console.log(`${device.id} ${device.name} ${device.host === null ? `${device.username}, connects from the device ${status}` : `${device.username}@${device.host}:${device.port}`}`);
|
|
58045
58093
|
}
|
|
58046
58094
|
});
|
|
@@ -58051,10 +58099,10 @@ async function envDevicesAddCommand(env, name, options) {
|
|
|
58051
58099
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`, { method: "POST", body: body2 });
|
|
58052
58100
|
const connect2 = options.host === void 0 ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${response.environment_device.id}/connect-token`) : void 0;
|
|
58053
58101
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
58054
|
-
console.log(
|
|
58102
|
+
console.log(import_chalk22.default.green(`Added device ${name}. Allow its key by running this on the device as ${options.user}:`));
|
|
58055
58103
|
console.log(`mkdir -p ~/.ssh && echo '${environment_device.public_key}' >> ~/.ssh/authorized_keys`);
|
|
58056
58104
|
if (connect_token) {
|
|
58057
|
-
console.log(
|
|
58105
|
+
console.log(import_chalk22.default.green("Then keep this running on it, so workspaces can reach it, and paste this token when it asks:"));
|
|
58058
58106
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
58059
58107
|
console.log(connect_token);
|
|
58060
58108
|
}
|
|
@@ -58072,9 +58120,9 @@ async function envDevicesEditCommand(env, nameOrId, options) {
|
|
|
58072
58120
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}`, { method: "PATCH", body: body2 });
|
|
58073
58121
|
const connect2 = device.host !== null && response.environment_device.host === null ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`) : void 0;
|
|
58074
58122
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
58075
|
-
console.log(
|
|
58123
|
+
console.log(import_chalk22.default.green(`Updated device ${environment_device.name}. Workspaces started from now on get the change.`));
|
|
58076
58124
|
if (connect_token) {
|
|
58077
|
-
console.log(
|
|
58125
|
+
console.log(import_chalk22.default.green("It now connects from the device. Keep this running on it, and paste this token when it asks:"));
|
|
58078
58126
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
58079
58127
|
console.log(connect_token);
|
|
58080
58128
|
}
|
|
@@ -58095,7 +58143,7 @@ async function envDevicesResetCommand(env, nameOrId) {
|
|
|
58095
58143
|
if (!device) throw new Error(`Device not found: ${nameOrId}`);
|
|
58096
58144
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`, { method: "POST" });
|
|
58097
58145
|
output2(response, ({ token }) => {
|
|
58098
|
-
console.log(
|
|
58146
|
+
console.log(import_chalk22.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:`));
|
|
58099
58147
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
58100
58148
|
console.log(token);
|
|
58101
58149
|
});
|
|
@@ -58105,17 +58153,17 @@ function envWarmPoolCommand(enabled) {
|
|
|
58105
58153
|
const id = await resolveEnvironmentId(env);
|
|
58106
58154
|
const body2 = { environment_id: id, enabled };
|
|
58107
58155
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/warm-pools`, { method: "PUT", body: body2 });
|
|
58108
|
-
output2(response, () => console.log(
|
|
58156
|
+
output2(response, () => console.log(import_chalk22.default.green(`Warm pool ${enabled ? "enabled" : "disabled"}`)));
|
|
58109
58157
|
};
|
|
58110
58158
|
}
|
|
58111
|
-
var import_fs5, import_os3, import_path6,
|
|
58159
|
+
var import_fs5, import_os3, import_path6, import_chalk22, RUNTIME_ENV_FILE;
|
|
58112
58160
|
var init_environment3 = __esm({
|
|
58113
58161
|
"src/commands/environment.ts"() {
|
|
58114
58162
|
"use strict";
|
|
58115
58163
|
import_fs5 = __toESM(require("fs"));
|
|
58116
58164
|
import_os3 = __toESM(require("os"));
|
|
58117
58165
|
import_path6 = __toESM(require("path"));
|
|
58118
|
-
|
|
58166
|
+
import_chalk22 = __toESM(require("chalk"));
|
|
58119
58167
|
init_api2();
|
|
58120
58168
|
init_command_utils();
|
|
58121
58169
|
init_output();
|
|
@@ -58135,101 +58183,101 @@ function parseReplicaAgent(value) {
|
|
|
58135
58183
|
throw new Error(`Invalid coding agent: ${value}. Must be one of: ${CLI_CODING_AGENT_LABEL}`);
|
|
58136
58184
|
}
|
|
58137
58185
|
function formatStatus(status) {
|
|
58138
|
-
if (status === "active") return
|
|
58139
|
-
if (isWorkspaceSuspendedStatus(status)) return
|
|
58186
|
+
if (status === "active") return import_chalk23.default.green(status);
|
|
58187
|
+
if (isWorkspaceSuspendedStatus(status)) return import_chalk23.default.gray(status);
|
|
58140
58188
|
return status;
|
|
58141
58189
|
}
|
|
58142
58190
|
function formatDisplayMessage(message2) {
|
|
58143
58191
|
const time3 = new Date(message2.timestamp).toLocaleTimeString();
|
|
58144
58192
|
switch (message2.type) {
|
|
58145
58193
|
case "user":
|
|
58146
|
-
console.log(
|
|
58194
|
+
console.log(import_chalk23.default.blue(`
|
|
58147
58195
|
[${time3}] USER:`));
|
|
58148
|
-
console.log(
|
|
58196
|
+
console.log(import_chalk23.default.white(` ${truncate(userMessageText(message2), 500)}`));
|
|
58149
58197
|
break;
|
|
58150
58198
|
case "agent":
|
|
58151
|
-
console.log(
|
|
58199
|
+
console.log(import_chalk23.default.green(`
|
|
58152
58200
|
[${time3}] ASSISTANT:`));
|
|
58153
|
-
console.log(
|
|
58201
|
+
console.log(import_chalk23.default.white(` ${truncate(message2.content, 500)}`));
|
|
58154
58202
|
break;
|
|
58155
58203
|
case "reasoning":
|
|
58156
|
-
console.log(
|
|
58204
|
+
console.log(import_chalk23.default.gray(`
|
|
58157
58205
|
[${time3}] THINKING:`));
|
|
58158
|
-
console.log(
|
|
58206
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.content, 300)}`));
|
|
58159
58207
|
break;
|
|
58160
58208
|
case "command":
|
|
58161
|
-
console.log(
|
|
58209
|
+
console.log(import_chalk23.default.magenta(`
|
|
58162
58210
|
[${time3}] COMMAND:`));
|
|
58163
|
-
console.log(
|
|
58211
|
+
console.log(import_chalk23.default.white(` $ ${message2.command}`));
|
|
58164
58212
|
if (message2.output) {
|
|
58165
|
-
console.log(
|
|
58213
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.output, 200)}`));
|
|
58166
58214
|
}
|
|
58167
58215
|
if (message2.exitCode !== void 0) {
|
|
58168
|
-
const exitColor = message2.exitCode === 0 ?
|
|
58216
|
+
const exitColor = message2.exitCode === 0 ? import_chalk23.default.green : import_chalk23.default.red;
|
|
58169
58217
|
console.log(exitColor(` Exit code: ${message2.exitCode}`));
|
|
58170
58218
|
}
|
|
58171
58219
|
break;
|
|
58172
58220
|
case "file_change":
|
|
58173
|
-
console.log(
|
|
58221
|
+
console.log(import_chalk23.default.yellow(`
|
|
58174
58222
|
[${time3}] FILE CHANGES:`));
|
|
58175
58223
|
for (const change2 of message2.changes) {
|
|
58176
58224
|
const icon = change2.kind === "add" ? "+" : change2.kind === "delete" ? "-" : "~";
|
|
58177
|
-
const color = change2.kind === "add" ?
|
|
58225
|
+
const color = change2.kind === "add" ? import_chalk23.default.green : change2.kind === "delete" ? import_chalk23.default.red : import_chalk23.default.yellow;
|
|
58178
58226
|
console.log(color(` ${icon} ${change2.path}`));
|
|
58179
58227
|
}
|
|
58180
58228
|
break;
|
|
58181
58229
|
case "patch":
|
|
58182
|
-
console.log(
|
|
58230
|
+
console.log(import_chalk23.default.yellow(`
|
|
58183
58231
|
[${time3}] PATCH:`));
|
|
58184
58232
|
for (const op of message2.operations) {
|
|
58185
58233
|
const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
|
|
58186
|
-
const color = op.action === "add" ?
|
|
58234
|
+
const color = op.action === "add" ? import_chalk23.default.green : op.action === "delete" ? import_chalk23.default.red : import_chalk23.default.yellow;
|
|
58187
58235
|
console.log(color(` ${icon} ${op.path}`));
|
|
58188
58236
|
}
|
|
58189
58237
|
break;
|
|
58190
58238
|
case "tool_call":
|
|
58191
|
-
console.log(
|
|
58239
|
+
console.log(import_chalk23.default.cyan(`
|
|
58192
58240
|
[${time3}] TOOL: ${message2.tool}`));
|
|
58193
58241
|
if (message2.output) {
|
|
58194
|
-
console.log(
|
|
58242
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.output, 200)}`));
|
|
58195
58243
|
}
|
|
58196
58244
|
if (message2.inputRequest?.status === "pending") {
|
|
58197
58245
|
const { requestId, options, questions } = message2.inputRequest;
|
|
58198
|
-
console.log(
|
|
58199
|
-
for (const option of options ?? []) console.log(
|
|
58246
|
+
console.log(import_chalk23.default.yellow(` Awaiting answer, request ID: ${requestId}`));
|
|
58247
|
+
for (const option of options ?? []) console.log(import_chalk23.default.white(` ${option.id}: ${option.label}`));
|
|
58200
58248
|
for (const question of questions ?? []) {
|
|
58201
|
-
console.log(
|
|
58202
|
-
for (const option of question.options) console.log(
|
|
58249
|
+
console.log(import_chalk23.default.white(` Question ${question.id}: ${question.prompt}${question.multiSelect ? " (multi-select)" : ""}`));
|
|
58250
|
+
for (const option of question.options) console.log(import_chalk23.default.gray(` ${option.id}: ${option.label}`));
|
|
58203
58251
|
}
|
|
58204
58252
|
if (questions?.length) {
|
|
58205
|
-
console.log(
|
|
58253
|
+
console.log(import_chalk23.default.gray(` Selection ID: '{"<question>":{"options":["<option>"]}}', '{"<question>":{"custom":"<text>"}}', or declined`));
|
|
58206
58254
|
}
|
|
58207
58255
|
}
|
|
58208
58256
|
break;
|
|
58209
58257
|
case "web_search":
|
|
58210
|
-
console.log(
|
|
58258
|
+
console.log(import_chalk23.default.cyan(`
|
|
58211
58259
|
[${time3}] WEB SEARCH:`));
|
|
58212
|
-
console.log(
|
|
58260
|
+
console.log(import_chalk23.default.white(` "${message2.query}"`));
|
|
58213
58261
|
break;
|
|
58214
58262
|
case "todo_list":
|
|
58215
|
-
console.log(
|
|
58263
|
+
console.log(import_chalk23.default.blue(`
|
|
58216
58264
|
[${time3}] PLAN:`));
|
|
58217
58265
|
for (const item of message2.items) {
|
|
58218
|
-
const icon = item.completed ?
|
|
58266
|
+
const icon = item.completed ? import_chalk23.default.green("[x]") : import_chalk23.default.gray("[ ]");
|
|
58219
58267
|
console.log(` ${icon} ${item.text}`);
|
|
58220
58268
|
}
|
|
58221
58269
|
break;
|
|
58222
58270
|
case "subagent":
|
|
58223
|
-
console.log(
|
|
58271
|
+
console.log(import_chalk23.default.magenta(`
|
|
58224
58272
|
[${time3}] SUBAGENT: ${message2.description}`));
|
|
58225
58273
|
if (message2.output) {
|
|
58226
|
-
console.log(
|
|
58274
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.output, 200)}`));
|
|
58227
58275
|
}
|
|
58228
58276
|
break;
|
|
58229
58277
|
case "error":
|
|
58230
|
-
console.log(
|
|
58278
|
+
console.log(import_chalk23.default.red(`
|
|
58231
58279
|
[${time3}] ERROR:`));
|
|
58232
|
-
console.log(
|
|
58280
|
+
console.log(import_chalk23.default.red(` ${message2.message}`));
|
|
58233
58281
|
break;
|
|
58234
58282
|
}
|
|
58235
58283
|
}
|
|
@@ -58245,24 +58293,24 @@ async function replicaListCommand(options) {
|
|
|
58245
58293
|
);
|
|
58246
58294
|
output2(response, (response2) => {
|
|
58247
58295
|
if (response2.replicas.length === 0) {
|
|
58248
|
-
console.log(
|
|
58296
|
+
console.log(import_chalk23.default.yellow("\nNo replicas found.\n"));
|
|
58249
58297
|
return;
|
|
58250
58298
|
}
|
|
58251
|
-
console.log(
|
|
58299
|
+
console.log(import_chalk23.default.green(`
|
|
58252
58300
|
Replicas (Page ${response2.page} of ${response2.total_pages}, Total: ${response2.total}):
|
|
58253
58301
|
`));
|
|
58254
58302
|
for (const replica of response2.replicas) {
|
|
58255
|
-
console.log(
|
|
58256
|
-
console.log(
|
|
58303
|
+
console.log(import_chalk23.default.white(` ${replica.name}`) + (replica.kind === "standard" ? "" : import_chalk23.default.magenta(` [${replica.kind}]`)));
|
|
58304
|
+
console.log(import_chalk23.default.gray(` ID: ${replica.id}`));
|
|
58257
58305
|
if (replica.repositories.length > 0) {
|
|
58258
|
-
console.log(
|
|
58306
|
+
console.log(import_chalk23.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
58259
58307
|
}
|
|
58260
|
-
console.log(
|
|
58261
|
-
console.log(
|
|
58308
|
+
console.log(import_chalk23.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
58309
|
+
console.log(import_chalk23.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
58262
58310
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
58263
|
-
console.log(
|
|
58311
|
+
console.log(import_chalk23.default.gray(` Pull Requests:`));
|
|
58264
58312
|
for (const pr2 of replica.pull_requests) {
|
|
58265
|
-
console.log(
|
|
58313
|
+
console.log(import_chalk23.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
58266
58314
|
}
|
|
58267
58315
|
}
|
|
58268
58316
|
console.log();
|
|
@@ -58273,31 +58321,31 @@ async function replicaGetCommand(id) {
|
|
|
58273
58321
|
ensureOrgApiAuthenticated();
|
|
58274
58322
|
const response = await orgAuthenticatedFetch(`/v1/replica/${id}`);
|
|
58275
58323
|
output2(response, ({ replica }) => {
|
|
58276
|
-
console.log(
|
|
58324
|
+
console.log(import_chalk23.default.green(`
|
|
58277
58325
|
Replica: ${replica.name}
|
|
58278
58326
|
`));
|
|
58279
|
-
console.log(
|
|
58280
|
-
console.log(
|
|
58327
|
+
console.log(import_chalk23.default.gray(` ID: ${replica.id}`));
|
|
58328
|
+
console.log(import_chalk23.default.gray(` Kind: ${replica.kind}`));
|
|
58281
58329
|
if (replica.repositories.length > 0) {
|
|
58282
|
-
console.log(
|
|
58330
|
+
console.log(import_chalk23.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
58283
58331
|
}
|
|
58284
|
-
console.log(
|
|
58285
|
-
console.log(
|
|
58332
|
+
console.log(import_chalk23.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
58333
|
+
console.log(import_chalk23.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
58286
58334
|
if (replica.coding_agent) {
|
|
58287
|
-
console.log(
|
|
58335
|
+
console.log(import_chalk23.default.gray(` Coding Agent: ${replica.coding_agent}`));
|
|
58288
58336
|
}
|
|
58289
58337
|
if (replica.activity) printReplicaActivity(replica.activity);
|
|
58290
58338
|
if (replica.repository_statuses && replica.repository_statuses.length > 0) {
|
|
58291
|
-
console.log(
|
|
58339
|
+
console.log(import_chalk23.default.gray(" Repository Statuses:"));
|
|
58292
58340
|
for (const repositoryStatus of replica.repository_statuses) {
|
|
58293
|
-
const changeText = repositoryStatus.git_diff ? ` (${
|
|
58294
|
-
console.log(
|
|
58341
|
+
const changeText = repositoryStatus.git_diff ? ` (${import_chalk23.default.green(`+${repositoryStatus.git_diff.added}`)} / ${import_chalk23.default.red(`-${repositoryStatus.git_diff.removed}`)})` : "";
|
|
58342
|
+
console.log(import_chalk23.default.gray(` - ${repositoryStatus.repository}: ${repositoryStatus.branch || "unknown"}${changeText}`));
|
|
58295
58343
|
}
|
|
58296
58344
|
}
|
|
58297
58345
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
58298
|
-
console.log(
|
|
58346
|
+
console.log(import_chalk23.default.gray(` Pull Requests:`));
|
|
58299
58347
|
for (const pr2 of replica.pull_requests) {
|
|
58300
|
-
console.log(
|
|
58348
|
+
console.log(import_chalk23.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
58301
58349
|
}
|
|
58302
58350
|
}
|
|
58303
58351
|
console.log();
|
|
@@ -58324,7 +58372,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58324
58372
|
});
|
|
58325
58373
|
const answer = response2.name;
|
|
58326
58374
|
if (!answer) {
|
|
58327
|
-
console.log(
|
|
58375
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58328
58376
|
return;
|
|
58329
58377
|
}
|
|
58330
58378
|
replicaName = answer;
|
|
@@ -58342,7 +58390,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58342
58390
|
});
|
|
58343
58391
|
const answer = response2.environment;
|
|
58344
58392
|
if (!answer) {
|
|
58345
|
-
console.log(
|
|
58393
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58346
58394
|
return;
|
|
58347
58395
|
}
|
|
58348
58396
|
selectedEnvironmentId = answer;
|
|
@@ -58356,7 +58404,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58356
58404
|
});
|
|
58357
58405
|
const answer = response2.message;
|
|
58358
58406
|
if (!answer) {
|
|
58359
|
-
console.log(
|
|
58407
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58360
58408
|
return;
|
|
58361
58409
|
}
|
|
58362
58410
|
message2 = answer;
|
|
@@ -58370,7 +58418,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58370
58418
|
initial: 0
|
|
58371
58419
|
});
|
|
58372
58420
|
if (!response2.agent) {
|
|
58373
|
-
console.log(
|
|
58421
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58374
58422
|
return;
|
|
58375
58423
|
}
|
|
58376
58424
|
codingAgent = parseReplicaAgent(response2.agent);
|
|
@@ -58382,20 +58430,20 @@ async function replicaCreateCommand(name, options) {
|
|
|
58382
58430
|
coding_agent: codingAgent,
|
|
58383
58431
|
lifecycle_policy: "default"
|
|
58384
58432
|
};
|
|
58385
|
-
console.log(
|
|
58433
|
+
console.log(import_chalk23.default.gray("\nCreating replica..."));
|
|
58386
58434
|
const response = await orgAuthenticatedFetch("/v1/replica", {
|
|
58387
58435
|
method: "POST",
|
|
58388
58436
|
body: body2
|
|
58389
58437
|
});
|
|
58390
58438
|
output2(response, ({ replica }) => {
|
|
58391
|
-
console.log(
|
|
58439
|
+
console.log(import_chalk23.default.green(`
|
|
58392
58440
|
Created replica: ${replica.name}`));
|
|
58393
|
-
console.log(
|
|
58394
|
-
console.log(
|
|
58441
|
+
console.log(import_chalk23.default.gray(` ID: ${replica.id}`));
|
|
58442
|
+
console.log(import_chalk23.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
58395
58443
|
if (replica.repositories.length > 0) {
|
|
58396
|
-
console.log(
|
|
58444
|
+
console.log(import_chalk23.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
58397
58445
|
}
|
|
58398
|
-
console.log(
|
|
58446
|
+
console.log(import_chalk23.default.cyan(` Link: ${getWorkspaceDashboardUrl(replica.id, { webAppUrl: process.env.REPLICAS_WEB_URL || DEFAULT_WEB_APP_URL })}`));
|
|
58399
58447
|
console.log();
|
|
58400
58448
|
});
|
|
58401
58449
|
}
|
|
@@ -58411,7 +58459,7 @@ async function replicaSendCommand(id, options) {
|
|
|
58411
58459
|
});
|
|
58412
58460
|
const answer = response2.message;
|
|
58413
58461
|
if (!answer) {
|
|
58414
|
-
console.log(
|
|
58462
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58415
58463
|
return;
|
|
58416
58464
|
}
|
|
58417
58465
|
message2 = answer;
|
|
@@ -58436,14 +58484,14 @@ async function replicaSendCommand(id, options) {
|
|
|
58436
58484
|
}
|
|
58437
58485
|
);
|
|
58438
58486
|
output2(response, (response2) => {
|
|
58439
|
-
const statusColor = response2.status === "sent" ?
|
|
58487
|
+
const statusColor = response2.status === "sent" ? import_chalk23.default.green : import_chalk23.default.yellow;
|
|
58440
58488
|
console.log(statusColor(`
|
|
58441
58489
|
Message ${response2.status}`));
|
|
58442
58490
|
if (response2.chat_id) {
|
|
58443
|
-
console.log(
|
|
58491
|
+
console.log(import_chalk23.default.gray(` Chat: ${response2.chat_id}`));
|
|
58444
58492
|
}
|
|
58445
58493
|
if (response2.position !== void 0 && response2.position > 0) {
|
|
58446
|
-
console.log(
|
|
58494
|
+
console.log(import_chalk23.default.gray(` Queue position: ${response2.position}`));
|
|
58447
58495
|
}
|
|
58448
58496
|
console.log();
|
|
58449
58497
|
});
|
|
@@ -58470,40 +58518,40 @@ async function replicaReadCommand(id, options) {
|
|
|
58470
58518
|
`/v1/replica/${id}/history${query ? "?" + query : ""}`
|
|
58471
58519
|
);
|
|
58472
58520
|
output2(response, (response2) => {
|
|
58473
|
-
console.log(
|
|
58521
|
+
console.log(import_chalk23.default.green(`
|
|
58474
58522
|
Conversation History
|
|
58475
58523
|
`));
|
|
58476
58524
|
if (response2.coding_agent) {
|
|
58477
|
-
console.log(
|
|
58525
|
+
console.log(import_chalk23.default.gray(` Agent: ${response2.coding_agent}`));
|
|
58478
58526
|
}
|
|
58479
58527
|
if (response2.thread_id) {
|
|
58480
|
-
console.log(
|
|
58528
|
+
console.log(import_chalk23.default.gray(` Thread ID: ${response2.thread_id}`));
|
|
58481
58529
|
}
|
|
58482
|
-
console.log(
|
|
58530
|
+
console.log(import_chalk23.default.gray(` Total Events: ${response2.total}`));
|
|
58483
58531
|
if (response2.has_more) {
|
|
58484
58532
|
const previousPage = response2.beforeCursor ? `--before '${response2.beforeCursor}'` : `--before-event ${response2.eventsStartIndex}`;
|
|
58485
|
-
console.log(
|
|
58533
|
+
console.log(import_chalk23.default.gray(` Has More: yes (${previousPage} for the previous page)`));
|
|
58486
58534
|
}
|
|
58487
58535
|
console.log();
|
|
58488
58536
|
if (response2.events.length === 0) {
|
|
58489
|
-
console.log(
|
|
58537
|
+
console.log(import_chalk23.default.yellow(" No events found.\n"));
|
|
58490
58538
|
return;
|
|
58491
58539
|
}
|
|
58492
|
-
console.log(
|
|
58540
|
+
console.log(import_chalk23.default.gray("-".repeat(60)));
|
|
58493
58541
|
const agentType = response2.coding_agent || "claude";
|
|
58494
58542
|
const displayMessages = parseDisplayMessages(response2.events, agentType);
|
|
58495
58543
|
for (const message2 of displayMessages) {
|
|
58496
58544
|
formatDisplayMessage(message2);
|
|
58497
58545
|
}
|
|
58498
|
-
console.log(
|
|
58546
|
+
console.log(import_chalk23.default.gray("\n" + "-".repeat(60)));
|
|
58499
58547
|
console.log();
|
|
58500
58548
|
});
|
|
58501
58549
|
}
|
|
58502
|
-
var
|
|
58550
|
+
var import_chalk23, CLI_CODING_AGENT_LABEL;
|
|
58503
58551
|
var init_replica2 = __esm({
|
|
58504
58552
|
"src/commands/replica.ts"() {
|
|
58505
58553
|
"use strict";
|
|
58506
|
-
|
|
58554
|
+
import_chalk23 = __toESM(require("chalk"));
|
|
58507
58555
|
init_api2();
|
|
58508
58556
|
init_environment3();
|
|
58509
58557
|
init_command_utils();
|
|
@@ -58519,7 +58567,7 @@ async function workspaceRenameCommand(id, name) {
|
|
|
58519
58567
|
method: "PATCH",
|
|
58520
58568
|
body: { name }
|
|
58521
58569
|
});
|
|
58522
|
-
output2(response, ({ workspace }) => console.log(
|
|
58570
|
+
output2(response, ({ workspace }) => console.log(import_chalk24.default.green(`Renamed workspace to ${workspace.name}`)));
|
|
58523
58571
|
}
|
|
58524
58572
|
async function workspaceWakeCommand(id, options) {
|
|
58525
58573
|
await orgAuthenticatedFetch(`/v1/replica/${id}/wake${options.restore ? "?restore=true" : ""}`, { method: "POST" });
|
|
@@ -58529,7 +58577,7 @@ async function workspaceRefreshEnvironmentCommand(id) {
|
|
|
58529
58577
|
const result = await orgAuthenticatedFetch(`/v1/replica/${id}/environment/refresh`, { method: "POST" });
|
|
58530
58578
|
output2(result, ({ status, changes }) => {
|
|
58531
58579
|
console.log(status === "waking" ? `Waking workspace ${id} with its latest environment.` : `Workspace ${id} is up to date with its environment.`);
|
|
58532
|
-
for (const { kind, name, change: change2 } of changes) console.log(
|
|
58580
|
+
for (const { kind, name, change: change2 } of changes) console.log(import_chalk24.default.gray(` ${change2} ${WORKSPACE_ENVIRONMENT_CHANGE_LABELS[kind]} ${name}`));
|
|
58533
58581
|
});
|
|
58534
58582
|
}
|
|
58535
58583
|
function workspaceLifecycleCommand(action) {
|
|
@@ -58546,7 +58594,7 @@ async function workspaceWaitCommand(id, options) {
|
|
|
58546
58594
|
if (options.chat) query.set("chat_id", options.chat);
|
|
58547
58595
|
const step2 = result?.activity.current_step;
|
|
58548
58596
|
result = await orgAuthenticatedFetch(`/v1/replica/${id}/wait?${query}`);
|
|
58549
|
-
if (!result.done && result.activity.current_step && result.activity.current_step !== step2) console.error(
|
|
58597
|
+
if (!result.done && result.activity.current_step && result.activity.current_step !== step2) console.error(import_chalk24.default.gray(`\u2026 ${result.activity.current_step}`));
|
|
58550
58598
|
} while (!result.done && result.activity.state !== "waiting_for_input" && Date.now() < deadline);
|
|
58551
58599
|
output2(result, ({ done, status, deleted, activity }) => {
|
|
58552
58600
|
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})`);
|
|
@@ -58558,7 +58606,7 @@ async function workspaceStatusCommand(id) {
|
|
|
58558
58606
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/status`), (status) => {
|
|
58559
58607
|
const agentsWith = (suffix) => Object.entries(status).filter(([key2, value]) => value === true && key2.startsWith("is") && key2.endsWith(suffix)).map(([key2]) => key2.slice(2, -suffix.length).toLowerCase());
|
|
58560
58608
|
console.log(`Status: ${status.status}`);
|
|
58561
|
-
if (status.message || status.error) console.log(
|
|
58609
|
+
if (status.message || status.error) console.log(import_chalk24.default.yellow(status.message || status.error));
|
|
58562
58610
|
const working = agentsWith("Processing");
|
|
58563
58611
|
const awaiting = agentsWith("AwaitingInput");
|
|
58564
58612
|
if (working.length > 0) console.log(`Working: ${working.join(", ")}`);
|
|
@@ -58586,8 +58634,8 @@ async function workspaceExecCommand(id, command, options) {
|
|
|
58586
58634
|
output2(result, () => {
|
|
58587
58635
|
process.stdout.write(result.output.endsWith("\n") || !result.output ? result.output : `${result.output}
|
|
58588
58636
|
`);
|
|
58589
|
-
if (result.truncated) console.error(
|
|
58590
|
-
if (result.timed_out) console.error(
|
|
58637
|
+
if (result.truncated) console.error(import_chalk24.default.yellow("Output truncated."));
|
|
58638
|
+
if (result.timed_out) console.error(import_chalk24.default.yellow("Command timed out."));
|
|
58591
58639
|
});
|
|
58592
58640
|
process.exitCode = result.exit_code ?? 1;
|
|
58593
58641
|
}
|
|
@@ -58602,11 +58650,11 @@ async function workspaceHooksCommand(id) {
|
|
|
58602
58650
|
return;
|
|
58603
58651
|
}
|
|
58604
58652
|
for (const entry of entries) {
|
|
58605
|
-
const result = entry.timedOut ?
|
|
58606
|
-
console.log(
|
|
58653
|
+
const result = entry.timedOut ? import_chalk24.default.red("timed out") : entry.exitCode === 0 ? import_chalk24.default.green("exit 0") : import_chalk24.default.red(`exit ${entry.exitCode}`);
|
|
58654
|
+
console.log(import_chalk24.default.bold(`
|
|
58607
58655
|
[${entry.kind}] ${entry.hookName} (${entry.hookType}) ${result} at ${formatDate(entry.executedAt)}`));
|
|
58608
58656
|
console.log(entry.output.trimEnd());
|
|
58609
|
-
if (entry.outputTruncated) console.log(
|
|
58657
|
+
if (entry.outputTruncated) console.log(import_chalk24.default.gray(`\u2026 truncated (${entry.outputTotalChars} chars total)`));
|
|
58610
58658
|
}
|
|
58611
58659
|
});
|
|
58612
58660
|
}
|
|
@@ -58614,7 +58662,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
58614
58662
|
if (!sessionId) {
|
|
58615
58663
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs`), ({ currentSessionId, sessions }) => {
|
|
58616
58664
|
for (const session of sessions) {
|
|
58617
|
-
const current = session.sessionId === currentSessionId ?
|
|
58665
|
+
const current = session.sessionId === currentSessionId ? import_chalk24.default.green(" (current)") : "";
|
|
58618
58666
|
console.log(`${session.sessionId} ${session.sizeBytes} bytes ${formatDate(session.updatedAt)}${current}`);
|
|
58619
58667
|
}
|
|
58620
58668
|
});
|
|
@@ -58627,7 +58675,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
58627
58675
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs/${sessionId}${query ? `?${query}` : ""}`), (log) => {
|
|
58628
58676
|
console.log(log.lines.join("\n"));
|
|
58629
58677
|
if (log.hasMore) {
|
|
58630
|
-
console.error(
|
|
58678
|
+
console.error(import_chalk24.default.gray(`Lines ${log.offset}-${log.offset + log.lines.length} of ${log.totalLines}. Next: --offset ${log.offset + log.lines.length}`));
|
|
58631
58679
|
}
|
|
58632
58680
|
});
|
|
58633
58681
|
}
|
|
@@ -58667,16 +58715,16 @@ async function prViewCommand(id, prUrls) {
|
|
|
58667
58715
|
);
|
|
58668
58716
|
output2(response, ({ pullRequests }) => {
|
|
58669
58717
|
for (const { url: url2, details, error: error62 } of pullRequests) {
|
|
58670
|
-
console.log(
|
|
58718
|
+
console.log(import_chalk24.default.bold(`
|
|
58671
58719
|
${url2}`));
|
|
58672
58720
|
if (!details) {
|
|
58673
|
-
console.log(
|
|
58721
|
+
console.log(import_chalk24.default.red(` ${error62 ?? "Details unavailable"}`));
|
|
58674
58722
|
continue;
|
|
58675
58723
|
}
|
|
58676
58724
|
console.log(` ${details.title}`);
|
|
58677
58725
|
console.log(` State: ${details.state} Mergeability: ${details.mergeability} CI: ${details.ciStatus}`);
|
|
58678
58726
|
console.log(` ${details.headBranch} \u2192 ${details.baseBranch} +${details.additions ?? 0} -${details.deletions ?? 0} in ${details.changedFiles} files`);
|
|
58679
|
-
if (details.mergeBlockers?.length) console.log(
|
|
58727
|
+
if (details.mergeBlockers?.length) console.log(import_chalk24.default.yellow(` Blocked by: ${details.mergeBlockers.join(", ").replaceAll("_", " ")}`));
|
|
58680
58728
|
}
|
|
58681
58729
|
});
|
|
58682
58730
|
}
|
|
@@ -58716,14 +58764,14 @@ async function canvasPutCommand(id, filename, options) {
|
|
|
58716
58764
|
{ method: "PUT", body: body2 }
|
|
58717
58765
|
);
|
|
58718
58766
|
if (!result.saved) throw new Error(`${filename} changed while saving; retry`);
|
|
58719
|
-
output2(result, () => console.log(
|
|
58767
|
+
output2(result, () => console.log(import_chalk24.default.green(`Saved ${filename}`)));
|
|
58720
58768
|
}
|
|
58721
|
-
var import_fs6,
|
|
58769
|
+
var import_fs6, import_chalk24, getCanvasFile;
|
|
58722
58770
|
var init_workspace = __esm({
|
|
58723
58771
|
"src/commands/workspace.ts"() {
|
|
58724
58772
|
"use strict";
|
|
58725
58773
|
import_fs6 = __toESM(require("fs"));
|
|
58726
|
-
|
|
58774
|
+
import_chalk24 = __toESM(require("chalk"));
|
|
58727
58775
|
init_src();
|
|
58728
58776
|
init_api2();
|
|
58729
58777
|
init_command_utils();
|
|
@@ -58739,7 +58787,7 @@ function printQueue(queue) {
|
|
|
58739
58787
|
return;
|
|
58740
58788
|
}
|
|
58741
58789
|
queue.forEach((message2, index) => {
|
|
58742
|
-
const steered = message2.steeredAt ?
|
|
58790
|
+
const steered = message2.steeredAt ? import_chalk25.default.cyan(" (steered)") : "";
|
|
58743
58791
|
console.log(`${index} ${message2.id}${steered} ${message2.message.replace(/\s+/g, " ").slice(0, 120)}`);
|
|
58744
58792
|
});
|
|
58745
58793
|
}
|
|
@@ -58749,7 +58797,7 @@ function printGoal({ goal }) {
|
|
|
58749
58797
|
async function chatListCommand(id) {
|
|
58750
58798
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/chats`), ({ chats }) => {
|
|
58751
58799
|
for (const chat2 of chats) {
|
|
58752
|
-
console.log(`${chat2.id} ${chat2.provider} ${chat2.processing ?
|
|
58800
|
+
console.log(`${chat2.id} ${chat2.provider} ${chat2.processing ? import_chalk25.default.green("working") : "idle"} ${chat2.title}`);
|
|
58753
58801
|
}
|
|
58754
58802
|
});
|
|
58755
58803
|
}
|
|
@@ -58772,7 +58820,7 @@ async function chatRestoreCommand(id, chatId) {
|
|
|
58772
58820
|
outputSuccess(`Restored chat ${chatId}`);
|
|
58773
58821
|
}
|
|
58774
58822
|
async function chatInterruptCommand(id, chatId) {
|
|
58775
|
-
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/interrupt"), { method: "POST" }), ({ interrupted }) => console.log(interrupted ?
|
|
58823
|
+
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/interrupt"), { method: "POST" }), ({ interrupted }) => console.log(interrupted ? import_chalk25.default.green("Interrupted.") : "Nothing to interrupt."));
|
|
58776
58824
|
}
|
|
58777
58825
|
async function chatForkCommand(id, chatId, options) {
|
|
58778
58826
|
const provider2 = parseReplicaAgent(options.agent);
|
|
@@ -58803,7 +58851,7 @@ async function chatAnswerCommand(id, chatId, requestId, selectionId) {
|
|
|
58803
58851
|
method: "POST",
|
|
58804
58852
|
body: { requestId, selectionId }
|
|
58805
58853
|
});
|
|
58806
|
-
output2(response, ({ resolved }) => console.log(resolved ?
|
|
58854
|
+
output2(response, ({ resolved }) => console.log(resolved ? import_chalk25.default.green("Answer sent.") : import_chalk25.default.yellow("That question is no longer pending.")));
|
|
58807
58855
|
}
|
|
58808
58856
|
async function chatCommandsCommand(id, chatId) {
|
|
58809
58857
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/slash-commands")), ({ commands }) => {
|
|
@@ -58814,7 +58862,7 @@ async function chatCommandsCommand(id, chatId) {
|
|
|
58814
58862
|
}
|
|
58815
58863
|
async function chatQueueListCommand(id, chatId) {
|
|
58816
58864
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/queue")), ({ processing, queue }) => {
|
|
58817
|
-
console.log(
|
|
58865
|
+
console.log(import_chalk25.default.gray(processing ? "Agent is working." : "Agent is idle."));
|
|
58818
58866
|
printQueue(queue);
|
|
58819
58867
|
});
|
|
58820
58868
|
}
|
|
@@ -58824,11 +58872,11 @@ async function mutateQueue(path14, method, body2) {
|
|
|
58824
58872
|
else console.log("Done.");
|
|
58825
58873
|
});
|
|
58826
58874
|
}
|
|
58827
|
-
var
|
|
58875
|
+
var import_chalk25, chatPath2, chatQueueClearCommand, chatQueueRemoveCommand, chatQueueEditCommand, chatQueueMoveCommand, chatQueueActionCommand;
|
|
58828
58876
|
var init_chat = __esm({
|
|
58829
58877
|
"src/commands/chat.ts"() {
|
|
58830
58878
|
"use strict";
|
|
58831
|
-
|
|
58879
|
+
import_chalk25 = __toESM(require("chalk"));
|
|
58832
58880
|
init_src();
|
|
58833
58881
|
init_api2();
|
|
58834
58882
|
init_output();
|
|
@@ -58873,13 +58921,13 @@ async function pluginsDisconnectCommand(pluginId, options) {
|
|
|
58873
58921
|
await pluginsPath(options, `/${pluginId}${options.connection ? `/connections/${options.connection}` : ""}`),
|
|
58874
58922
|
{ method: "DELETE" }
|
|
58875
58923
|
);
|
|
58876
|
-
output2(response, ({ success: success2 }) => console.log(success2 ?
|
|
58924
|
+
output2(response, ({ success: success2 }) => console.log(success2 ? import_chalk26.default.green(`Disconnected ${pluginId}`) : `${pluginId} was not connected`));
|
|
58877
58925
|
}
|
|
58878
|
-
var
|
|
58926
|
+
var import_chalk26, pluginsPath;
|
|
58879
58927
|
var init_plugins3 = __esm({
|
|
58880
58928
|
"src/commands/plugins.ts"() {
|
|
58881
58929
|
"use strict";
|
|
58882
|
-
|
|
58930
|
+
import_chalk26 = __toESM(require("chalk"));
|
|
58883
58931
|
init_api2();
|
|
58884
58932
|
init_command_utils();
|
|
58885
58933
|
init_output();
|
|
@@ -58898,20 +58946,20 @@ async function fetchCurrentRun() {
|
|
|
58898
58946
|
}
|
|
58899
58947
|
async function environmentSetupStatusCommand() {
|
|
58900
58948
|
output2(await fetchCurrentRun(), ({ run: run2, environment: environment2, repositories }) => {
|
|
58901
|
-
console.log(
|
|
58949
|
+
console.log(import_chalk27.default.bold(`
|
|
58902
58950
|
Environment setup: ${environment2.name}
|
|
58903
58951
|
`));
|
|
58904
58952
|
console.log(` Run: ${run2.id}`);
|
|
58905
|
-
console.log(` Status: ${run2.status}${run2.error ?
|
|
58953
|
+
console.log(` Status: ${run2.status}${run2.error ? import_chalk27.default.red(` (${run2.error})`) : ""}`);
|
|
58906
58954
|
console.log(` Environment: ${environment2.id}`);
|
|
58907
58955
|
console.log(` Repositories: ${repositories.map((repo) => `${repo.name} (${repo.default_branch})`).join(", ") || "none"}`);
|
|
58908
58956
|
console.log("\n Steps:");
|
|
58909
58957
|
for (const step2 of ENVIRONMENT_SETUP_STEPS) {
|
|
58910
58958
|
const status = run2.steps[step2.key] ?? "pending";
|
|
58911
|
-
const marker = status === "completed" ?
|
|
58912
|
-
console.log(` ${marker} ${step2.key.padEnd(11)} ${
|
|
58959
|
+
const marker = status === "completed" ? import_chalk27.default.green("\u2713") : status === "in_progress" ? import_chalk27.default.cyan("\u25B8") : status === "skipped" ? import_chalk27.default.gray("\u2013") : import_chalk27.default.gray("\u25CB");
|
|
58960
|
+
console.log(` ${marker} ${step2.key.padEnd(11)} ${import_chalk27.default.gray(step2.label)} ${import_chalk27.default.gray(`[${status}]`)}`);
|
|
58913
58961
|
}
|
|
58914
|
-
console.log(run2.proposal ?
|
|
58962
|
+
console.log(run2.proposal ? import_chalk27.default.gray("\n A proposal has been submitted. Run `propose` again to replace it.\n") : import_chalk27.default.gray("\n No proposal yet. Submit one with `replicas environment-setup propose --file <path>`.\n"));
|
|
58915
58963
|
});
|
|
58916
58964
|
}
|
|
58917
58965
|
async function environmentSetupStepCommand(key2, status) {
|
|
@@ -58927,7 +58975,7 @@ async function environmentSetupStepCommand(key2, status) {
|
|
|
58927
58975
|
method: "POST",
|
|
58928
58976
|
body: body2
|
|
58929
58977
|
});
|
|
58930
|
-
output2(result, () => console.log(
|
|
58978
|
+
output2(result, () => console.log(import_chalk27.default.green(`
|
|
58931
58979
|
\u2713 ${key2} \u2192 ${status}
|
|
58932
58980
|
`)));
|
|
58933
58981
|
}
|
|
@@ -58946,22 +58994,22 @@ async function environmentSetupProposeCommand(options) {
|
|
|
58946
58994
|
body: { proposal }
|
|
58947
58995
|
});
|
|
58948
58996
|
output2(result, ({ run: { proposal: submitted } }) => {
|
|
58949
|
-
console.log(
|
|
58997
|
+
console.log(import_chalk27.default.green("\n\u2713 Proposal submitted.\n"));
|
|
58950
58998
|
if (submitted) {
|
|
58951
58999
|
console.log(` Automations: ${submitted.automations.length}`);
|
|
58952
59000
|
console.log(` Variables: ${submitted.variables.length}`);
|
|
58953
59001
|
console.log(` Checks: ${submitted.verification.length}`);
|
|
58954
59002
|
console.log(` Media: ${submitted.media.length}`);
|
|
58955
59003
|
}
|
|
58956
|
-
console.log(
|
|
59004
|
+
console.log(import_chalk27.default.gray("\n The user reviews and saves it from the Environment panel; nothing has been applied yet.\n"));
|
|
58957
59005
|
});
|
|
58958
59006
|
}
|
|
58959
|
-
var import_fs7,
|
|
59007
|
+
var import_fs7, import_chalk27, STEP_KEYS;
|
|
58960
59008
|
var init_environment_setup2 = __esm({
|
|
58961
59009
|
"src/commands/environment-setup.ts"() {
|
|
58962
59010
|
"use strict";
|
|
58963
59011
|
import_fs7 = __toESM(require("fs"));
|
|
58964
|
-
|
|
59012
|
+
import_chalk27 = __toESM(require("chalk"));
|
|
58965
59013
|
init_api2();
|
|
58966
59014
|
init_command_utils();
|
|
58967
59015
|
init_config();
|
|
@@ -59212,41 +59260,41 @@ function resolveSelectableEnvironmentId(envInput, selectableEnvs) {
|
|
|
59212
59260
|
return resolved.id;
|
|
59213
59261
|
}
|
|
59214
59262
|
function printAutomation(automation2) {
|
|
59215
|
-
console.log(
|
|
59216
|
-
console.log(
|
|
59217
|
-
console.log(
|
|
59263
|
+
console.log(import_chalk28.default.white(` ${automation2.name}`));
|
|
59264
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59265
|
+
console.log(import_chalk28.default.gray(` Owner: ${automation2.user_id ? "personal" : "organization"}`));
|
|
59218
59266
|
if (automation2.description) {
|
|
59219
|
-
console.log(
|
|
59267
|
+
console.log(import_chalk28.default.gray(` Description: ${automation2.description}`));
|
|
59220
59268
|
}
|
|
59221
|
-
console.log(
|
|
59269
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? import_chalk28.default.green("yes") : import_chalk28.default.red("no")}`));
|
|
59222
59270
|
if (automation2.auto_paused_at) {
|
|
59223
|
-
console.log(
|
|
59271
|
+
console.log(import_chalk28.default.yellow(` ${truncate(formatAutoPause(automation2), 120)}`));
|
|
59224
59272
|
}
|
|
59225
59273
|
if (automation2.triggers.length > 0) {
|
|
59226
|
-
console.log(
|
|
59274
|
+
console.log(import_chalk28.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
59227
59275
|
}
|
|
59228
59276
|
if (automation2.github_check_names.length > 0) {
|
|
59229
|
-
console.log(
|
|
59277
|
+
console.log(import_chalk28.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
59230
59278
|
}
|
|
59231
|
-
console.log(
|
|
59279
|
+
console.log(import_chalk28.default.gray(` Prompt: ${truncate(automation2.prompt, 80)}`));
|
|
59232
59280
|
if (automation2.cron_next_fire_at) {
|
|
59233
|
-
console.log(
|
|
59281
|
+
console.log(import_chalk28.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
59234
59282
|
}
|
|
59235
|
-
console.log(
|
|
59236
|
-
console.log(
|
|
59237
|
-
if (automation2.background) console.log(
|
|
59283
|
+
console.log(import_chalk28.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
59284
|
+
console.log(import_chalk28.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
59285
|
+
if (automation2.background) console.log(import_chalk28.default.gray(" List: background"));
|
|
59238
59286
|
if (automation2.workspace_lifecycle_policy && automation2.workspace_lifecycle_policy !== "default") {
|
|
59239
|
-
console.log(
|
|
59287
|
+
console.log(import_chalk28.default.gray(` Lifecycle: ${automation2.workspace_lifecycle_policy}`));
|
|
59240
59288
|
}
|
|
59241
59289
|
if (automation2.agent_provider || automation2.model || automation2.thinking_level) {
|
|
59242
|
-
console.log(
|
|
59290
|
+
console.log(import_chalk28.default.gray(` Agent: ${formatAgentSummary(automation2)}`));
|
|
59243
59291
|
}
|
|
59244
59292
|
if (automation2.goal_mode || automation2.fast_mode) {
|
|
59245
|
-
console.log(
|
|
59293
|
+
console.log(import_chalk28.default.gray(` Modes: ${formatModeSummary(automation2)}`));
|
|
59246
59294
|
}
|
|
59247
|
-
console.log(
|
|
59248
|
-
console.log(
|
|
59249
|
-
console.log(
|
|
59295
|
+
console.log(import_chalk28.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? import_chalk28.default.green("managed") : "read-only"}`));
|
|
59296
|
+
console.log(import_chalk28.default.gray(` Created: ${formatDate(automation2.created_at)}`));
|
|
59297
|
+
console.log(import_chalk28.default.gray(` Updated: ${formatDate(automation2.updated_at)}`));
|
|
59250
59298
|
console.log();
|
|
59251
59299
|
}
|
|
59252
59300
|
async function resolveCredentialsMember(value) {
|
|
@@ -59276,10 +59324,10 @@ async function automationListCommand(options) {
|
|
|
59276
59324
|
);
|
|
59277
59325
|
output2(response, (response2) => {
|
|
59278
59326
|
if (response2.automations.length === 0) {
|
|
59279
|
-
console.log(
|
|
59327
|
+
console.log(import_chalk28.default.yellow("\nNo automations found.\n"));
|
|
59280
59328
|
return;
|
|
59281
59329
|
}
|
|
59282
|
-
console.log(
|
|
59330
|
+
console.log(import_chalk28.default.green(`
|
|
59283
59331
|
Automations (Page ${response2.page} of ${response2.totalPages}, Total: ${response2.total}):
|
|
59284
59332
|
`));
|
|
59285
59333
|
for (const automation2 of response2.automations) {
|
|
@@ -59291,49 +59339,49 @@ async function automationGetCommand(id) {
|
|
|
59291
59339
|
ensureOrgApiAuthenticated();
|
|
59292
59340
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`);
|
|
59293
59341
|
output2(response.automation, (automation2) => {
|
|
59294
|
-
console.log(
|
|
59342
|
+
console.log(import_chalk28.default.green(`
|
|
59295
59343
|
Automation: ${automation2.name}
|
|
59296
59344
|
`));
|
|
59297
|
-
console.log(
|
|
59345
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59298
59346
|
if (automation2.description) {
|
|
59299
|
-
console.log(
|
|
59347
|
+
console.log(import_chalk28.default.gray(` Description: ${automation2.description}`));
|
|
59300
59348
|
}
|
|
59301
|
-
console.log(
|
|
59349
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? import_chalk28.default.green("yes") : import_chalk28.default.red("no")}`));
|
|
59302
59350
|
if (automation2.auto_paused_at) {
|
|
59303
|
-
console.log(
|
|
59351
|
+
console.log(import_chalk28.default.yellow(` ${formatAutoPause(automation2)}`));
|
|
59304
59352
|
}
|
|
59305
59353
|
if (automation2.triggers.length > 0) {
|
|
59306
|
-
console.log(
|
|
59354
|
+
console.log(import_chalk28.default.gray(` Triggers:`));
|
|
59307
59355
|
for (const trigger of automation2.triggers) {
|
|
59308
|
-
console.log(
|
|
59356
|
+
console.log(import_chalk28.default.gray(` - ${formatTrigger(trigger)}`));
|
|
59309
59357
|
}
|
|
59310
59358
|
}
|
|
59311
59359
|
if (automation2.github_check_names.length > 0) {
|
|
59312
|
-
console.log(
|
|
59360
|
+
console.log(import_chalk28.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
59313
59361
|
}
|
|
59314
|
-
console.log(
|
|
59315
|
-
console.log(
|
|
59362
|
+
console.log(import_chalk28.default.gray(` Prompt: ${automation2.prompt}`));
|
|
59363
|
+
console.log(import_chalk28.default.gray(` Environment: ${automation2.environment_id}`));
|
|
59316
59364
|
if (automation2.cron_next_fire_at) {
|
|
59317
|
-
console.log(
|
|
59365
|
+
console.log(import_chalk28.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
59318
59366
|
}
|
|
59319
|
-
console.log(
|
|
59320
|
-
console.log(
|
|
59321
|
-
console.log(
|
|
59322
|
-
if (automation2.credential_user_id) console.log(
|
|
59323
|
-
console.log(
|
|
59367
|
+
console.log(import_chalk28.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
59368
|
+
console.log(import_chalk28.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
59369
|
+
console.log(import_chalk28.default.gray(` List: ${automation2.background ? "background" : "main"}`));
|
|
59370
|
+
if (automation2.credential_user_id) console.log(import_chalk28.default.gray(` Credentials: member ${automation2.credential_user_id}, then the organization's`));
|
|
59371
|
+
console.log(import_chalk28.default.gray(` Size: ${automation2.workspace_size ?? DEFAULT_AUTOMATION_WORKSPACE_SIZE}${automation2.target_workspace_id ? " (new workspaces only; runs reuse the pinned workspace)" : ""}`));
|
|
59324
59372
|
if (automation2.workspace_lifecycle_policy) {
|
|
59325
|
-
console.log(
|
|
59373
|
+
console.log(import_chalk28.default.gray(` Lifecycle Policy: ${automation2.workspace_lifecycle_policy}`));
|
|
59326
59374
|
}
|
|
59327
59375
|
if (automation2.workspace_auto_stop_minutes) {
|
|
59328
|
-
console.log(
|
|
59329
|
-
}
|
|
59330
|
-
console.log(
|
|
59331
|
-
console.log(
|
|
59332
|
-
console.log(
|
|
59333
|
-
console.log(
|
|
59334
|
-
console.log(
|
|
59335
|
-
console.log(
|
|
59336
|
-
console.log(
|
|
59376
|
+
console.log(import_chalk28.default.gray(` Auto-stop: ${automation2.workspace_auto_stop_minutes} minutes`));
|
|
59377
|
+
}
|
|
59378
|
+
console.log(import_chalk28.default.gray(` Agent: ${automation2.agent_provider ? getProviderDisplayName(automation2.agent_provider) : "organization default"}`));
|
|
59379
|
+
console.log(import_chalk28.default.gray(` Model: ${automation2.model ? MODEL_LABELS[automation2.model] ?? automation2.model : "agent default"}`));
|
|
59380
|
+
console.log(import_chalk28.default.gray(` Thinking Level: ${automation2.thinking_level ?? "agent default"}`));
|
|
59381
|
+
console.log(import_chalk28.default.gray(` Modes: ${formatModeSummary(automation2)}`));
|
|
59382
|
+
console.log(import_chalk28.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? "managed" : "read-only"}`));
|
|
59383
|
+
console.log(import_chalk28.default.gray(` Created: ${formatDate(automation2.created_at)}`));
|
|
59384
|
+
console.log(import_chalk28.default.gray(` Updated: ${formatDate(automation2.updated_at)}`));
|
|
59337
59385
|
console.log();
|
|
59338
59386
|
});
|
|
59339
59387
|
}
|
|
@@ -59505,7 +59553,7 @@ async function automationCreateCommand(name, options) {
|
|
|
59505
59553
|
});
|
|
59506
59554
|
const answer = response2.name;
|
|
59507
59555
|
if (!answer) {
|
|
59508
|
-
console.log(
|
|
59556
|
+
console.log(import_chalk28.default.yellow("\nCancelled."));
|
|
59509
59557
|
return;
|
|
59510
59558
|
}
|
|
59511
59559
|
automationName = answer;
|
|
@@ -59520,7 +59568,7 @@ async function automationCreateCommand(name, options) {
|
|
|
59520
59568
|
});
|
|
59521
59569
|
const answer = response2.prompt;
|
|
59522
59570
|
if (!answer) {
|
|
59523
|
-
console.log(
|
|
59571
|
+
console.log(import_chalk28.default.yellow("\nCancelled."));
|
|
59524
59572
|
return;
|
|
59525
59573
|
}
|
|
59526
59574
|
automationPrompt = answer;
|
|
@@ -59542,7 +59590,7 @@ async function automationCreateCommand(name, options) {
|
|
|
59542
59590
|
}))
|
|
59543
59591
|
});
|
|
59544
59592
|
if (!envResponse2.env) {
|
|
59545
|
-
console.log(
|
|
59593
|
+
console.log(import_chalk28.default.yellow("\nCancelled."));
|
|
59546
59594
|
return;
|
|
59547
59595
|
}
|
|
59548
59596
|
selectedEnvironmentId = envResponse2.env;
|
|
@@ -59583,25 +59631,25 @@ async function automationCreateCommand(name, options) {
|
|
|
59583
59631
|
...options.fastMode ? { fast_mode: true } : {},
|
|
59584
59632
|
...agentSelection
|
|
59585
59633
|
};
|
|
59586
|
-
console.log(
|
|
59634
|
+
console.log(import_chalk28.default.gray("\nCreating automation..."));
|
|
59587
59635
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
59588
59636
|
method: "POST",
|
|
59589
59637
|
body: body2
|
|
59590
59638
|
});
|
|
59591
59639
|
output2(response.automation, (automation2) => {
|
|
59592
|
-
console.log(
|
|
59640
|
+
console.log(import_chalk28.default.green(`
|
|
59593
59641
|
Created automation: ${automation2.name}`));
|
|
59594
|
-
console.log(
|
|
59595
|
-
console.log(
|
|
59642
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59643
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
59596
59644
|
if (automation2.triggers.length > 0) {
|
|
59597
|
-
console.log(
|
|
59645
|
+
console.log(import_chalk28.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
59598
59646
|
}
|
|
59599
59647
|
if (automation2.cron_next_fire_at) {
|
|
59600
|
-
console.log(
|
|
59648
|
+
console.log(import_chalk28.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)} (${automation2.cron_next_fire_at})`));
|
|
59601
59649
|
}
|
|
59602
|
-
console.log(
|
|
59603
|
-
console.log(
|
|
59604
|
-
console.log(
|
|
59650
|
+
console.log(import_chalk28.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
59651
|
+
console.log(import_chalk28.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
59652
|
+
console.log(import_chalk28.default.gray(` List: ${automation2.background ? "background" : "main"}`));
|
|
59605
59653
|
console.log();
|
|
59606
59654
|
});
|
|
59607
59655
|
}
|
|
@@ -59757,21 +59805,21 @@ async function automationEditCommand(id, options) {
|
|
|
59757
59805
|
Object.assign(body2, agentSelection);
|
|
59758
59806
|
}
|
|
59759
59807
|
if (Object.keys(body2).length === 0) {
|
|
59760
|
-
output2(existing.automation, () => console.log(
|
|
59808
|
+
output2(existing.automation, () => console.log(import_chalk28.default.yellow("\nNo changes made.\n")));
|
|
59761
59809
|
return;
|
|
59762
59810
|
}
|
|
59763
|
-
console.log(
|
|
59811
|
+
console.log(import_chalk28.default.gray("\nUpdating automation..."));
|
|
59764
59812
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`, {
|
|
59765
59813
|
method: "PATCH",
|
|
59766
59814
|
body: body2
|
|
59767
59815
|
});
|
|
59768
59816
|
output2(response.automation, (automation2) => {
|
|
59769
|
-
console.log(
|
|
59817
|
+
console.log(import_chalk28.default.green(`
|
|
59770
59818
|
Updated automation: ${automation2.name}`));
|
|
59771
|
-
console.log(
|
|
59772
|
-
console.log(
|
|
59819
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59820
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
59773
59821
|
if (automation2.triggers.length > 0) {
|
|
59774
|
-
console.log(
|
|
59822
|
+
console.log(import_chalk28.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
59775
59823
|
}
|
|
59776
59824
|
console.log();
|
|
59777
59825
|
});
|
|
@@ -59783,7 +59831,7 @@ async function automationRunCommand(id) {
|
|
|
59783
59831
|
if (!hasCronTrigger(automation2.triggers)) {
|
|
59784
59832
|
throw new Error(`Manual run is only allowed for automations with a cron trigger. This automation has triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`);
|
|
59785
59833
|
}
|
|
59786
|
-
console.log(
|
|
59834
|
+
console.log(import_chalk28.default.gray(`
|
|
59787
59835
|
Triggering automation "${automation2.name}"...`));
|
|
59788
59836
|
const response = await orgAuthenticatedFetch(
|
|
59789
59837
|
`/v1/automations/${id}/trigger`,
|
|
@@ -59794,11 +59842,11 @@ Triggering automation "${automation2.name}"...`));
|
|
|
59794
59842
|
);
|
|
59795
59843
|
if (!response.execution_id) throw new Error("Automation trigger returned no execution ID. The automation may not have started.");
|
|
59796
59844
|
output2(response, (response2) => {
|
|
59797
|
-
console.log(
|
|
59845
|
+
console.log(import_chalk28.default.green(`
|
|
59798
59846
|
Automation triggered successfully.`));
|
|
59799
|
-
console.log(
|
|
59847
|
+
console.log(import_chalk28.default.gray(` Execution ID: ${response2.execution_id}`));
|
|
59800
59848
|
if (response2.workspace_id) {
|
|
59801
|
-
console.log(
|
|
59849
|
+
console.log(import_chalk28.default.gray(` Workspace ID: ${response2.workspace_id}`));
|
|
59802
59850
|
}
|
|
59803
59851
|
console.log();
|
|
59804
59852
|
});
|
|
@@ -59832,9 +59880,9 @@ async function automationCheckCommand(checkRunId, options) {
|
|
|
59832
59880
|
`/v1/automations/checks/${id}`,
|
|
59833
59881
|
{ method: "POST", body: body2 }
|
|
59834
59882
|
);
|
|
59835
|
-
output2(response, (response2) => console.log(response2.reported ?
|
|
59883
|
+
output2(response, (response2) => console.log(response2.reported ? import_chalk28.default.green(`
|
|
59836
59884
|
Reported ${conclusion} for "${response2.name}".
|
|
59837
|
-
`) :
|
|
59885
|
+
`) : import_chalk28.default.yellow(`
|
|
59838
59886
|
Skipped "${response2.name}" \u2014 a newer run of this automation owns it and will report the verdict.
|
|
59839
59887
|
`)));
|
|
59840
59888
|
}
|
|
@@ -59850,7 +59898,7 @@ async function automationExecutionsCommand(id, options) {
|
|
|
59850
59898
|
for (const execution of response2.executions) {
|
|
59851
59899
|
console.log(`${execution.id} ${execution.status} ${formatDate(execution.triggered_at)} ${execution.workspace_id ?? "-"}${execution.error ? ` ${execution.error}` : ""}`);
|
|
59852
59900
|
}
|
|
59853
|
-
console.log(
|
|
59901
|
+
console.log(import_chalk28.default.gray(`Page ${response2.page} of ${response2.totalPages} (${response2.total} runs)`));
|
|
59854
59902
|
});
|
|
59855
59903
|
}
|
|
59856
59904
|
async function automationRetryCommand(id, executionId) {
|
|
@@ -59858,13 +59906,13 @@ async function automationRetryCommand(id, executionId) {
|
|
|
59858
59906
|
`/v1/automations/${id}/executions/${executionId}/retry`,
|
|
59859
59907
|
{ method: "POST" }
|
|
59860
59908
|
);
|
|
59861
|
-
output2(response, (response2) => console.log(
|
|
59909
|
+
output2(response, (response2) => console.log(import_chalk28.default.green(`Retried as execution ${response2.execution_id}${response2.workspace_id ? ` in workspace ${response2.workspace_id}` : ""}`)));
|
|
59862
59910
|
}
|
|
59863
|
-
var
|
|
59911
|
+
var import_chalk28, DURATION_UNIT_MS;
|
|
59864
59912
|
var init_automation = __esm({
|
|
59865
59913
|
"src/commands/automation.ts"() {
|
|
59866
59914
|
"use strict";
|
|
59867
|
-
|
|
59915
|
+
import_chalk28 = __toESM(require("chalk"));
|
|
59868
59916
|
init_output();
|
|
59869
59917
|
init_api2();
|
|
59870
59918
|
init_config();
|
|
@@ -59984,9 +60032,9 @@ async function previewListCommand(workspaceId) {
|
|
|
59984
60032
|
`/v1/replica/${workspaceId}/previews`
|
|
59985
60033
|
);
|
|
59986
60034
|
output2(result, ({ previews }) => {
|
|
59987
|
-
if (previews.length === 0) console.log(
|
|
60035
|
+
if (previews.length === 0) console.log(import_chalk29.default.dim("No active previews"));
|
|
59988
60036
|
for (const preview2 of previews) {
|
|
59989
|
-
console.log(` ${
|
|
60037
|
+
console.log(` ${import_chalk29.default.cyan(String(preview2.port))} \u2192 ${import_chalk29.default.underline(preview2.publicUrl)}`);
|
|
59990
60038
|
}
|
|
59991
60039
|
});
|
|
59992
60040
|
}
|
|
@@ -60000,7 +60048,7 @@ async function previewAddCommand(workspaceId, options) {
|
|
|
60000
60048
|
body: { port: portNum, authenticated: options.authenticated ?? false }
|
|
60001
60049
|
}
|
|
60002
60050
|
);
|
|
60003
|
-
output2(result, ({ preview: preview2 }) => console.log(
|
|
60051
|
+
output2(result, ({ preview: preview2 }) => console.log(import_chalk29.default.green(`Preview created: ${preview2.publicUrl}`)));
|
|
60004
60052
|
}
|
|
60005
60053
|
async function previewDeleteCommand(port2) {
|
|
60006
60054
|
const portNum = parsePreviewPort(port2);
|
|
@@ -60015,11 +60063,11 @@ async function previewRemoveCommand(workspaceId, options) {
|
|
|
60015
60063
|
);
|
|
60016
60064
|
outputSuccess(`Preview deleted on port ${portNum}`);
|
|
60017
60065
|
}
|
|
60018
|
-
var
|
|
60066
|
+
var import_chalk29, parsePreviewPort;
|
|
60019
60067
|
var init_preview = __esm({
|
|
60020
60068
|
"src/commands/preview.ts"() {
|
|
60021
60069
|
"use strict";
|
|
60022
|
-
|
|
60070
|
+
import_chalk29 = __toESM(require("chalk"));
|
|
60023
60071
|
init_config();
|
|
60024
60072
|
init_agent_api();
|
|
60025
60073
|
init_api2();
|
|
@@ -60510,7 +60558,7 @@ async function callIssueTool(name, args, schema, printHuman) {
|
|
|
60510
60558
|
const report = createIssueContractReport();
|
|
60511
60559
|
const parsed = parseIssueContractResponse(schema, isRecord(response) ? body2 : response, report);
|
|
60512
60560
|
if (parsed === void 0) throw new Error(`Unexpected response from the server: ${[...report.problems].join("; ")}`);
|
|
60513
|
-
if (report.dropped) console.error(
|
|
60561
|
+
if (report.dropped) console.error(import_chalk30.default.yellow(`Skipped ${report.dropped} record(s) this CLI can't read: ${[...report.problems].filter((problem) => !problem.includes("unknown_value")).join("; ")}`));
|
|
60514
60562
|
const actors = issueActorDirectorySchema.catch({}).parse(directory);
|
|
60515
60563
|
output2(mapIssueActors(parsed, { actor: (who) => issueActorHandle(who, actors), text: (text5) => renderIssueMentions(text5, actors) }), () => printHuman(parsed, actors));
|
|
60516
60564
|
}
|
|
@@ -60550,14 +60598,14 @@ async function issueUpdateCommand(issue3, options) {
|
|
|
60550
60598
|
async function issueViewCommand(issue3) {
|
|
60551
60599
|
await callIssueTool(ISSUE_COMMANDS.get, { issue: issue3 }, issueDetailResponseSchema, (detail, actors) => {
|
|
60552
60600
|
const name = (actor) => formatIssueActor(actor, actors);
|
|
60553
|
-
console.log(`${
|
|
60554
|
-
console.log(
|
|
60601
|
+
console.log(`${import_chalk30.default.bold.cyan(detail.issue.identifier)} ${import_chalk30.default.bold(detail.issue.title)}`);
|
|
60602
|
+
console.log(import_chalk30.default.dim(`${detail.issue.status} \xB7 priority ${detail.issue.priority}`));
|
|
60555
60603
|
const assignees = detail.subscribers.filter((subscriber) => subscriber.role === "assignee");
|
|
60556
|
-
if (assignees.length) console.log(
|
|
60604
|
+
if (assignees.length) console.log(import_chalk30.default.dim(`Assignees: ${assignees.map((a) => name(a.subscriber)).join(", ")}`));
|
|
60557
60605
|
if (detail.issue.description) console.log(`
|
|
60558
60606
|
${renderIssueMentions(detail.issue.description, actors)}`);
|
|
60559
60607
|
for (const pr2 of detail.pull_requests) console.log(`
|
|
60560
|
-
${
|
|
60608
|
+
${import_chalk30.default.magenta("PR")} ${pr2.url} (${pr2.state})`);
|
|
60561
60609
|
const issueById = new Map([detail.issue, ...detail.sub_issues, ...detail.related_issues ?? []].map((related) => [related.id, related]));
|
|
60562
60610
|
const identifierOf = (id) => issueById.get(id)?.identifier ?? (detail.related_issues ? "a deleted issue" : id);
|
|
60563
60611
|
const links = [
|
|
@@ -60570,21 +60618,21 @@ ${import_chalk29.default.magenta("PR")} ${pr2.url} (${pr2.state})`);
|
|
|
60570
60618
|
];
|
|
60571
60619
|
const linkLines = links.map(({ label, id }) => {
|
|
60572
60620
|
const related = issueById.get(id);
|
|
60573
|
-
return `${
|
|
60621
|
+
return `${import_chalk30.default.dim(label.padEnd(13))} ${related ? issueLine(related) : import_chalk30.default.dim(identifierOf(id))}`;
|
|
60574
60622
|
});
|
|
60575
60623
|
if (linkLines.length) console.log(`
|
|
60576
60624
|
${linkLines.join("\n")}`);
|
|
60577
60625
|
for (const comment of detail.comments) {
|
|
60578
60626
|
console.log(`
|
|
60579
|
-
${
|
|
60627
|
+
${import_chalk30.default.dim(`\u2014 ${name(comment.author)}, ${comment.created_at}`)}
|
|
60580
60628
|
${renderIssueMentions(comment.body, actors)}`);
|
|
60581
60629
|
}
|
|
60582
60630
|
const activity = detail.events.flatMap((event) => {
|
|
60583
60631
|
const change2 = describeIssueEvent(event, name, identifierOf);
|
|
60584
|
-
return change2 ? [`${
|
|
60632
|
+
return change2 ? [`${import_chalk30.default.dim(event.created_at)} ${name(event.actor)} ${change2}`] : [];
|
|
60585
60633
|
});
|
|
60586
60634
|
if (activity.length) console.log(`
|
|
60587
|
-
${
|
|
60635
|
+
${import_chalk30.default.bold("Activity")}
|
|
60588
60636
|
${activity.join("\n")}`);
|
|
60589
60637
|
});
|
|
60590
60638
|
}
|
|
@@ -60599,38 +60647,38 @@ async function issueListCommand(options) {
|
|
|
60599
60647
|
include_archived: options.archived,
|
|
60600
60648
|
limit: options.limit ? Number(options.limit) : void 0
|
|
60601
60649
|
}, listIssuesResponseSchema, ({ issues, next_cursor }) => {
|
|
60602
|
-
if (issues.length === 0) console.log(
|
|
60650
|
+
if (issues.length === 0) console.log(import_chalk30.default.dim("No issues"));
|
|
60603
60651
|
issues.forEach((issue3) => console.log(issueLine(issue3)));
|
|
60604
|
-
if (next_cursor !== null) console.log(
|
|
60652
|
+
if (next_cursor !== null) console.log(import_chalk30.default.dim("More issues exist; narrow the filters or raise --limit."));
|
|
60605
60653
|
});
|
|
60606
60654
|
}
|
|
60607
60655
|
async function issueCommentCommand(issue3, body2, options) {
|
|
60608
60656
|
const text5 = readText2(body2, options.file, "file") ?? "";
|
|
60609
60657
|
const media_ids = await uploadAttachments(options.attach);
|
|
60610
60658
|
if (!text5.trim() && !media_ids) throw new Error("Pass the comment text, --file, or --attach");
|
|
60611
|
-
await callIssueTool(ISSUE_COMMANDS.comment, { issue: issue3, body: text5, media_ids }, noData, () => console.log(`${
|
|
60659
|
+
await callIssueTool(ISSUE_COMMANDS.comment, { issue: issue3, body: text5, media_ids }, noData, () => console.log(`${import_chalk30.default.green("\u2713")} Commented on ${issue3}`));
|
|
60612
60660
|
}
|
|
60613
60661
|
function issueActorCommand(tool, done) {
|
|
60614
60662
|
return async (issue3, who) => {
|
|
60615
|
-
await callIssueTool(tool, { issue: issue3, who }, external_exports.looseObject({ subscriber: external_exports.looseObject({ subscriber: issueActorSchema }) }), ({ subscriber }, actors) => console.log(`${
|
|
60663
|
+
await callIssueTool(tool, { issue: issue3, who }, external_exports.looseObject({ subscriber: external_exports.looseObject({ subscriber: issueActorSchema }) }), ({ subscriber }, actors) => console.log(`${import_chalk30.default.green("\u2713")} ${done} ${formatIssueActor(subscriber.subscriber, actors)} ${tool.startsWith("un") ? "from" : "to"} ${issue3}`));
|
|
60616
60664
|
};
|
|
60617
60665
|
}
|
|
60618
60666
|
async function issueLinkPrCommand(issue3, url2) {
|
|
60619
|
-
await callIssueTool(ISSUE_COMMANDS.linkPr, { issue: issue3, url: url2 }, noData, () => console.log(`${
|
|
60667
|
+
await callIssueTool(ISSUE_COMMANDS.linkPr, { issue: issue3, url: url2 }, noData, () => console.log(`${import_chalk30.default.green("\u2713")} Linked ${url2} to ${issue3}`));
|
|
60620
60668
|
}
|
|
60621
60669
|
async function issueUnlinkPrCommand(issue3, url2) {
|
|
60622
|
-
await callIssueTool(ISSUE_COMMANDS.unlinkPr, { issue: issue3, url: url2 }, noData, () => console.log(`${
|
|
60670
|
+
await callIssueTool(ISSUE_COMMANDS.unlinkPr, { issue: issue3, url: url2 }, noData, () => console.log(`${import_chalk30.default.green("\u2713")} Unlinked ${url2} from ${issue3}`));
|
|
60623
60671
|
}
|
|
60624
60672
|
async function issueRelateCommand(issue3, type, related) {
|
|
60625
|
-
await callIssueTool(ISSUE_COMMANDS.relate, { issue: issue3, type, related_issue: related }, noData, () => console.log(`${
|
|
60673
|
+
await callIssueTool(ISSUE_COMMANDS.relate, { issue: issue3, type, related_issue: related }, noData, () => console.log(`${import_chalk30.default.green("\u2713")} ${issue3} ${type.replace("_", " ")} ${related}`));
|
|
60626
60674
|
}
|
|
60627
|
-
var import_node_fs2, import_node_path2,
|
|
60675
|
+
var import_node_fs2, import_node_path2, import_chalk30, mutationSchema, noData, csv, issueLine, printMutation;
|
|
60628
60676
|
var init_issue = __esm({
|
|
60629
60677
|
"src/commands/issue.ts"() {
|
|
60630
60678
|
"use strict";
|
|
60631
60679
|
import_node_fs2 = __toESM(require("fs"));
|
|
60632
60680
|
import_node_path2 = __toESM(require("path"));
|
|
60633
|
-
|
|
60681
|
+
import_chalk30 = __toESM(require("chalk"));
|
|
60634
60682
|
init_zod();
|
|
60635
60683
|
init_src();
|
|
60636
60684
|
init_api2();
|
|
@@ -60640,8 +60688,8 @@ var init_issue = __esm({
|
|
|
60640
60688
|
mutationSchema = external_exports.object({ issue: issueSchema });
|
|
60641
60689
|
noData = external_exports.looseObject({});
|
|
60642
60690
|
csv = (value) => value?.split(",").map((entry) => entry.trim()).filter(Boolean).join(",");
|
|
60643
|
-
issueLine = (issue3) => `${
|
|
60644
|
-
printMutation = ({ issue: issue3 }) => console.log(`${
|
|
60691
|
+
issueLine = (issue3) => `${import_chalk30.default.cyan(issue3.identifier.padEnd(9))} ${issue3.status.padEnd(11)} ${issue3.priority === "none" ? "" : import_chalk30.default.yellow(`${issue3.priority} `)}${issue3.title}${issue3.archived_at ? import_chalk30.default.dim(" (archived)") : ""}`;
|
|
60692
|
+
printMutation = ({ issue: issue3 }) => console.log(`${import_chalk30.default.green("\u2713")} ${import_chalk30.default.cyan(issue3.identifier)} ${issue3.title} (${issue3.status})`);
|
|
60645
60693
|
}
|
|
60646
60694
|
});
|
|
60647
60695
|
|
|
@@ -60999,10 +61047,10 @@ function parseEnv(values) {
|
|
|
60999
61047
|
return values?.length ? parseKeyValuePairs(values) : void 0;
|
|
61000
61048
|
}
|
|
61001
61049
|
function describe3(sandbox) {
|
|
61002
|
-
console.log(`${
|
|
61003
|
-
console.log(
|
|
61050
|
+
console.log(`${import_chalk31.default.bold(sandbox.id)} ${sandbox.status} ${sandbox.kind === "gpu" ? `${sandbox.gpu} ${sandbox.image}` : "macOS"}`);
|
|
61051
|
+
console.log(import_chalk31.default.gray(` expires ${new Date(sandbox.expiresAt).toLocaleString()}`));
|
|
61004
61052
|
for (const tunnel of sandbox.tunnels) console.log(` port ${tunnel.port}: ${tunnel.url}`);
|
|
61005
|
-
if (sandbox.error) console.log(
|
|
61053
|
+
if (sandbox.error) console.log(import_chalk31.default.red(` ${sandbox.error}`));
|
|
61006
61054
|
}
|
|
61007
61055
|
async function listSandboxes(kind) {
|
|
61008
61056
|
const { sandboxes } = await agentFetch(BASE);
|
|
@@ -61029,7 +61077,7 @@ async function createSandbox(kind, options) {
|
|
|
61029
61077
|
let { sandbox } = await agentFetch(BASE, { method: "POST", body: request2 });
|
|
61030
61078
|
if (options.wait === false) return sandbox;
|
|
61031
61079
|
const label = COMPUTE_SANDBOX_LABELS[kind];
|
|
61032
|
-
process.stderr.write(
|
|
61080
|
+
process.stderr.write(import_chalk31.default.gray(kind === "gpu" ? `Starting ${sandbox.gpu} sandbox ${sandbox.id} (a new image can take a few minutes to pull)...
|
|
61033
61081
|
` : `Starting ${label} ${sandbox.id}...
|
|
61034
61082
|
`));
|
|
61035
61083
|
const deadline = Date.now() + CREATE_WAIT_TIMEOUT_MS;
|
|
@@ -61096,8 +61144,8 @@ function computeExecCommand(kind) {
|
|
|
61096
61144
|
if (options.detach) {
|
|
61097
61145
|
const { jobId } = await agentFetch(path14, execRequest(command.join(" "), options));
|
|
61098
61146
|
output2({ jobId, sandboxId }, () => {
|
|
61099
|
-
console.log(`Started job ${
|
|
61100
|
-
console.log(
|
|
61147
|
+
console.log(`Started job ${import_chalk31.default.bold(jobId)} in ${sandboxId}`);
|
|
61148
|
+
console.log(import_chalk31.default.gray(`Follow it with: replicas ${kind} logs ${jobId} -f`));
|
|
61101
61149
|
});
|
|
61102
61150
|
return;
|
|
61103
61151
|
}
|
|
@@ -61118,13 +61166,13 @@ async function gpuLogsCommand(jobId, options) {
|
|
|
61118
61166
|
return;
|
|
61119
61167
|
}
|
|
61120
61168
|
if (exitCode === null) {
|
|
61121
|
-
process.stderr.write(
|
|
61169
|
+
process.stderr.write(import_chalk31.default.gray(`
|
|
61122
61170
|
Job ${jobId} is still running.
|
|
61123
61171
|
`));
|
|
61124
61172
|
return;
|
|
61125
61173
|
}
|
|
61126
61174
|
if (options.follow) process.exitCode = exitCode;
|
|
61127
|
-
process.stderr.write(
|
|
61175
|
+
process.stderr.write(import_chalk31.default.gray(`
|
|
61128
61176
|
Job ${jobId} exited with code ${exitCode}.
|
|
61129
61177
|
`));
|
|
61130
61178
|
}
|
|
@@ -61238,7 +61286,7 @@ function computeRunCommand(kind) {
|
|
|
61238
61286
|
const sandbox = await createSandbox(kind, { ...createOptions, wait: true });
|
|
61239
61287
|
const workdir = COMPUTE_SANDBOX_WORKDIRS[kind];
|
|
61240
61288
|
try {
|
|
61241
|
-
process.stderr.write(
|
|
61289
|
+
process.stderr.write(import_chalk31.default.gray(`Copying ${process.cwd()} to ${workdir}...
|
|
61242
61290
|
`));
|
|
61243
61291
|
await push(sandbox.id, ".", workdir);
|
|
61244
61292
|
const exitCode = await streamOutput(await agentRequest(`${BASE}/${sandbox.id}/exec`, execRequest(command.join(" "), { env })));
|
|
@@ -61249,17 +61297,17 @@ function computeRunCommand(kind) {
|
|
|
61249
61297
|
if (isJsonMode()) output2({ sandboxId: sandbox.id, exitCode }, () => {
|
|
61250
61298
|
});
|
|
61251
61299
|
} finally {
|
|
61252
|
-
if (options.keep) process.stderr.write(
|
|
61300
|
+
if (options.keep) process.stderr.write(import_chalk31.default.gray(`Kept ${COMPUTE_SANDBOX_LABELS[kind]} ${sandbox.id} running.
|
|
61253
61301
|
`));
|
|
61254
61302
|
else await agentRequest(`${BASE}/${sandbox.id}`, { method: "DELETE" });
|
|
61255
61303
|
}
|
|
61256
61304
|
};
|
|
61257
61305
|
}
|
|
61258
|
-
var
|
|
61306
|
+
var import_chalk31, import_node_child_process2, import_node_crypto2, import_node_fs3, import_node_os2, import_node_path3, import_node_stream, import_promises, BASE, CREATE_POLL_INTERVAL_MS, CREATE_WAIT_TIMEOUT_MS;
|
|
61259
61307
|
var init_compute2 = __esm({
|
|
61260
61308
|
"src/commands/compute.ts"() {
|
|
61261
61309
|
"use strict";
|
|
61262
|
-
|
|
61310
|
+
import_chalk31 = __toESM(require("chalk"));
|
|
61263
61311
|
import_node_child_process2 = require("child_process");
|
|
61264
61312
|
import_node_crypto2 = require("crypto");
|
|
61265
61313
|
import_node_fs3 = require("fs");
|
|
@@ -61294,8 +61342,8 @@ function printSource({ source }) {
|
|
|
61294
61342
|
console.log(`Managed skills: ${source.managed.skills?.join(", ") || "(none)"}`);
|
|
61295
61343
|
if (source.required_plugins?.length) console.log(`Required plugins: ${source.required_plugins.join(", ")}`);
|
|
61296
61344
|
if (source.required_secrets.length) console.log(`Required secrets: ${source.required_secrets.join(", ")}`);
|
|
61297
|
-
if (source.pending_rebuild) console.log(
|
|
61298
|
-
if (source.last_error) console.log(
|
|
61345
|
+
if (source.pending_rebuild) console.log(import_chalk32.default.yellow("Configuration saved; environment rebuild pending."));
|
|
61346
|
+
if (source.last_error) console.log(import_chalk32.default.red(source.last_error));
|
|
61299
61347
|
}
|
|
61300
61348
|
function printPreview({ preview: preview2 }) {
|
|
61301
61349
|
console.log(preview2.kind === "file" ? `${preview2.filename} @ ${preview2.file_sha}` : `${preview2.repository_name}/${preview2.filename} @ ${preview2.commit_sha}`);
|
|
@@ -61304,14 +61352,14 @@ function printPreview({ preview: preview2 }) {
|
|
|
61304
61352
|
const requiredAfter = preview2.required_secrets?.after ?? [];
|
|
61305
61353
|
const addedSecrets = requiredAfter.filter((key2) => !requiredBefore.includes(key2));
|
|
61306
61354
|
const removedSecrets = requiredBefore.filter((key2) => !requiredAfter.includes(key2));
|
|
61307
|
-
if (preview2.blockers.length || preview2.missing_secrets.length) console.log(
|
|
61355
|
+
if (preview2.blockers.length || preview2.missing_secrets.length) console.log(import_chalk32.default.yellow("Cannot apply this configuration. No changes have been made."));
|
|
61308
61356
|
if (!preview2.changes.length && !addedSecrets.length && !removedSecrets.length) console.log("No setting changes. Applying records this configuration.");
|
|
61309
61357
|
else console.log("Proposed changes (not applied):");
|
|
61310
61358
|
for (const change2 of preview2.changes) console.log(` ${change2.kind === "plugin" ? change2.operation === "remove" ? "stop requiring" : "require" : change2.operation}: ${change2.kind} ${change2.key}`);
|
|
61311
61359
|
for (const key2 of addedSecrets) console.log(` require: secret ${key2}`);
|
|
61312
61360
|
for (const key2 of removedSecrets) console.log(` stop requiring: secret ${key2}`);
|
|
61313
|
-
if (preview2.missing_secrets.length) console.log(
|
|
61314
|
-
for (const blocker of preview2.blockers) console.log(
|
|
61361
|
+
if (preview2.missing_secrets.length) console.log(import_chalk32.default.yellow(`Missing required secrets: ${preview2.missing_secrets.join(", ")}`));
|
|
61362
|
+
for (const blocker of preview2.blockers) console.log(import_chalk32.default.red(` Cannot apply: ${blocker}`));
|
|
61315
61363
|
}
|
|
61316
61364
|
async function readConfigFile(filename) {
|
|
61317
61365
|
let content;
|
|
@@ -61389,11 +61437,11 @@ async function environmentConfigDisconnectCommand(environment2, options) {
|
|
|
61389
61437
|
console.log("Configuration source disconnected. Current settings preserved.");
|
|
61390
61438
|
});
|
|
61391
61439
|
}
|
|
61392
|
-
var
|
|
61440
|
+
var import_chalk32, import_promises2, import_node_path4;
|
|
61393
61441
|
var init_environment_config2 = __esm({
|
|
61394
61442
|
"src/commands/environment-config.ts"() {
|
|
61395
61443
|
"use strict";
|
|
61396
|
-
|
|
61444
|
+
import_chalk32 = __toESM(require("chalk"));
|
|
61397
61445
|
import_promises2 = require("fs/promises");
|
|
61398
61446
|
import_node_path4 = require("path");
|
|
61399
61447
|
init_src();
|
|
@@ -61448,12 +61496,12 @@ async function skillsSuggestCommand(file2, options) {
|
|
|
61448
61496
|
async function skillsListCommand() {
|
|
61449
61497
|
output2(await orgAuthenticatedFetch("/v1/learned-skills"), ({ skills: skills2, suggestions }) => {
|
|
61450
61498
|
for (const skill of skills2) console.log(`${skill.id} ${skill.name} ${skill.title}`);
|
|
61451
|
-
if (suggestions.length > 0) console.log(
|
|
61499
|
+
if (suggestions.length > 0) console.log(import_chalk33.default.gray(`${suggestions.length} pending suggestion(s) to review in the dashboard.`));
|
|
61452
61500
|
});
|
|
61453
61501
|
}
|
|
61454
61502
|
async function skillsCreateCommand(file2, options) {
|
|
61455
61503
|
const body2 = { content: (0, import_node_fs5.readFileSync)(file2, "utf-8"), title: options.title };
|
|
61456
|
-
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body: body2 }), ({ id, name }) => console.log(
|
|
61504
|
+
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body: body2 }), ({ id, name }) => console.log(import_chalk33.default.green(`Saved learning '${name}' (${id})`)));
|
|
61457
61505
|
}
|
|
61458
61506
|
async function skillsUpdateCommand(id, options) {
|
|
61459
61507
|
const { skills: skills2 } = await orgAuthenticatedFetch("/v1/learned-skills");
|
|
@@ -61463,18 +61511,18 @@ async function skillsUpdateCommand(id, options) {
|
|
|
61463
61511
|
title: options.title ?? existing.title,
|
|
61464
61512
|
content: options.file ? (0, import_node_fs5.readFileSync)(options.file, "utf-8") : existing.content
|
|
61465
61513
|
};
|
|
61466
|
-
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body: body2 }), ({ name }) => console.log(
|
|
61514
|
+
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body: body2 }), ({ name }) => console.log(import_chalk33.default.green(`Updated learning '${name}'`)));
|
|
61467
61515
|
}
|
|
61468
61516
|
async function skillsDeleteCommand(id) {
|
|
61469
61517
|
await orgAuthenticatedFetch(`/v1/learned-skills/${id}`, { method: "DELETE" });
|
|
61470
61518
|
outputSuccess(`Deleted learning ${id}`);
|
|
61471
61519
|
}
|
|
61472
|
-
var import_node_fs5,
|
|
61520
|
+
var import_node_fs5, import_chalk33;
|
|
61473
61521
|
var init_skills = __esm({
|
|
61474
61522
|
"src/commands/skills.ts"() {
|
|
61475
61523
|
"use strict";
|
|
61476
61524
|
import_node_fs5 = require("fs");
|
|
61477
|
-
|
|
61525
|
+
import_chalk33 = __toESM(require("chalk"));
|
|
61478
61526
|
init_agent_api();
|
|
61479
61527
|
init_api2();
|
|
61480
61528
|
init_monolith_url();
|
|
@@ -61500,10 +61548,10 @@ async function attachThread(request2) {
|
|
|
61500
61548
|
body: request2
|
|
61501
61549
|
});
|
|
61502
61550
|
output2(response, ({ thread, workspace }) => {
|
|
61503
|
-
console.log(
|
|
61504
|
-
console.log(
|
|
61505
|
-
console.log(
|
|
61506
|
-
console.log(
|
|
61551
|
+
console.log(import_chalk34.default.green("Slack thread attached."));
|
|
61552
|
+
console.log(import_chalk34.default.gray(` Channel: ${thread.channel_id}`));
|
|
61553
|
+
console.log(import_chalk34.default.gray(` Thread: ${thread.thread_ts}`));
|
|
61554
|
+
console.log(import_chalk34.default.gray(` Workspace: ${workspace.name} (${workspace.id})`));
|
|
61507
61555
|
});
|
|
61508
61556
|
}
|
|
61509
61557
|
async function slackThreadAttachCommand(options) {
|
|
@@ -61531,11 +61579,11 @@ async function slackThreadSwitchCommand(workspace, options) {
|
|
|
61531
61579
|
workspace_id: workspaceId
|
|
61532
61580
|
});
|
|
61533
61581
|
}
|
|
61534
|
-
var
|
|
61582
|
+
var import_chalk34;
|
|
61535
61583
|
var init_slack4 = __esm({
|
|
61536
61584
|
"src/commands/slack.ts"() {
|
|
61537
61585
|
"use strict";
|
|
61538
|
-
|
|
61586
|
+
import_chalk34 = __toESM(require("chalk"));
|
|
61539
61587
|
init_api2();
|
|
61540
61588
|
init_config();
|
|
61541
61589
|
init_output();
|
|
@@ -61699,7 +61747,7 @@ async function serviceListCommand() {
|
|
|
61699
61747
|
return;
|
|
61700
61748
|
}
|
|
61701
61749
|
for (const service of services) {
|
|
61702
|
-
const status = service.running ?
|
|
61750
|
+
const status = service.running ? import_chalk35.default.green("running") : import_chalk35.default.red("stopped");
|
|
61703
61751
|
console.log(`${service.name} ${status} pid ${service.pid} started ${service.startedAt}`);
|
|
61704
61752
|
console.log(` command: ${service.command} (cwd: ${service.cwd})`);
|
|
61705
61753
|
console.log(` logs: ${service.logFile}`);
|
|
@@ -61719,11 +61767,11 @@ async function serviceLogsCommand(name, options) {
|
|
|
61719
61767
|
console.log(logs || "(no log output yet)");
|
|
61720
61768
|
});
|
|
61721
61769
|
}
|
|
61722
|
-
var
|
|
61770
|
+
var import_chalk35, import_node_child_process3, import_node_fs6, import_node_os3, import_node_path6, SERVICES_DIR, NAME_PATTERN, LOG_KEEP_BYTES, LOG_TRIM_LOOP;
|
|
61723
61771
|
var init_service = __esm({
|
|
61724
61772
|
"src/commands/service.ts"() {
|
|
61725
61773
|
"use strict";
|
|
61726
|
-
|
|
61774
|
+
import_chalk35 = __toESM(require("chalk"));
|
|
61727
61775
|
import_node_child_process3 = require("child_process");
|
|
61728
61776
|
import_node_fs6 = require("fs");
|
|
61729
61777
|
import_node_os3 = require("os");
|
|
@@ -61781,7 +61829,7 @@ async function deviceConnectCommand() {
|
|
|
61781
61829
|
stream.destroy();
|
|
61782
61830
|
};
|
|
61783
61831
|
sshd.once("error", (error62) => {
|
|
61784
|
-
console.log(
|
|
61832
|
+
console.log(import_chalk36.default.yellow(`A workspace couldn't reach SSH on port ${port2} here (${error62.message}). ${REMOTE_LOGIN_HINT}`));
|
|
61785
61833
|
});
|
|
61786
61834
|
sshd.on("error", close).on("close", close);
|
|
61787
61835
|
stream.on("error", close).on("close", close);
|
|
@@ -61825,16 +61873,16 @@ async function deviceConnectCommand() {
|
|
|
61825
61873
|
}
|
|
61826
61874
|
}
|
|
61827
61875
|
const next = problem ?? `\u2713 ${device?.name}: ready for ${waiting.size} ${waiting.size === 1 ? "workspace" : "workspaces"}, forwarding to SSH on port ${port2}`;
|
|
61828
|
-
if (next !== summary) console.log(problem ?
|
|
61876
|
+
if (next !== summary) console.log(problem ? import_chalk36.default.yellow(next) : import_chalk36.default.green(next));
|
|
61829
61877
|
summary = next;
|
|
61830
61878
|
await (0, import_promises3.setTimeout)(POLL_INTERVAL_MS);
|
|
61831
61879
|
}
|
|
61832
61880
|
}
|
|
61833
|
-
var
|
|
61881
|
+
var import_chalk36, 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;
|
|
61834
61882
|
var init_device = __esm({
|
|
61835
61883
|
"src/commands/device.ts"() {
|
|
61836
61884
|
"use strict";
|
|
61837
|
-
|
|
61885
|
+
import_chalk36 = __toESM(require("chalk"));
|
|
61838
61886
|
import_node_child_process4 = require("child_process");
|
|
61839
61887
|
import_node_net = require("net");
|
|
61840
61888
|
import_promises3 = require("timers/promises");
|
|
@@ -61936,8 +61984,8 @@ async function localControlRequestCommand(options) {
|
|
|
61936
61984
|
await orgAuthenticatedFetch("/v1/local-control-request", { method: "DELETE" });
|
|
61937
61985
|
output2({ status: "connected", computers: computers2 }, () => {
|
|
61938
61986
|
console.log(`
|
|
61939
|
-
${
|
|
61940
|
-
console.log(
|
|
61987
|
+
${import_chalk37.default.green("Connected:")} ${computers2.join(", ")}`);
|
|
61988
|
+
console.log(import_chalk37.default.gray(` Run commands there with: ssh ${computers2[0]} '<command>'
|
|
61941
61989
|
`));
|
|
61942
61990
|
});
|
|
61943
61991
|
};
|
|
@@ -61959,7 +62007,7 @@ async function localControlRequestCommand(options) {
|
|
|
61959
62007
|
});
|
|
61960
62008
|
if (found.length > 0) return connected(found);
|
|
61961
62009
|
output2({ status: "not_connected", computers: [], url: created2.url }, () => {
|
|
61962
|
-
console.log(
|
|
62010
|
+
console.log(import_chalk37.default.gray("\n This workspace may use the user's computer, but it isn't connected: the Replicas desktop app isn't open there, or isn't signed in as them. Keep working without it and tell the user. You get a message once it connects; run this command again then.\n"));
|
|
61963
62011
|
});
|
|
61964
62012
|
return;
|
|
61965
62013
|
}
|
|
@@ -61982,10 +62030,10 @@ async function localControlRequestCommand(options) {
|
|
|
61982
62030
|
}
|
|
61983
62031
|
output2({ status: pending ? "pending" : "declined", computers: [], url: created2.url }, () => {
|
|
61984
62032
|
if (!pending) {
|
|
61985
|
-
console.log(
|
|
62033
|
+
console.log(import_chalk37.default.yellow("\n The user declined. Continue without their computer, or ask how they want to proceed.\n"));
|
|
61986
62034
|
return;
|
|
61987
62035
|
}
|
|
61988
|
-
console.log(
|
|
62036
|
+
console.log(import_chalk37.default.gray(options.wait === false ? `
|
|
61989
62037
|
Asked above the chat composer (${created2.url}). Keep working, and run this command again when you need the computer.
|
|
61990
62038
|
` : created2.wait ? `
|
|
61991
62039
|
The user hasn't answered yet, so stop waiting. The request stays open (${created2.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.
|
|
@@ -61995,7 +62043,7 @@ async function localControlRequestCommand(options) {
|
|
|
61995
62043
|
`));
|
|
61996
62044
|
});
|
|
61997
62045
|
}
|
|
61998
|
-
var import_child_process6, import_fs11, import_os5, import_path11, import_util10,
|
|
62046
|
+
var import_child_process6, import_fs11, import_os5, import_path11, import_util10, import_chalk37, execFileAsync2;
|
|
61999
62047
|
var init_local_control = __esm({
|
|
62000
62048
|
"src/commands/local-control.ts"() {
|
|
62001
62049
|
"use strict";
|
|
@@ -62004,7 +62052,7 @@ var init_local_control = __esm({
|
|
|
62004
62052
|
import_os5 = __toESM(require("os"));
|
|
62005
62053
|
import_path11 = __toESM(require("path"));
|
|
62006
62054
|
import_util10 = require("util");
|
|
62007
|
-
|
|
62055
|
+
import_chalk37 = __toESM(require("chalk"));
|
|
62008
62056
|
init_src();
|
|
62009
62057
|
init_api2();
|
|
62010
62058
|
init_command_utils();
|
|
@@ -62094,7 +62142,7 @@ function printRun({ run: run2 }) {
|
|
|
62094
62142
|
const units = Object.values(run2.coverage);
|
|
62095
62143
|
const done = units.filter((unit) => unit.status === "covered" || unit.status === "skipped").length;
|
|
62096
62144
|
console.log(`
|
|
62097
|
-
Run ${run2.id} (${run2.type}): ${
|
|
62145
|
+
Run ${run2.id} (${run2.type}): ${import_chalk38.default.bold(run2.status)}`);
|
|
62098
62146
|
console.log(` Coverage: ${done}/${units.length} units recorded`);
|
|
62099
62147
|
console.log(` Effort: ${run2.budget.effort} (${run2.budget.minutes} min, ${run2.budget.agent_calls} agent calls${run2.budget.cents ? `, $${run2.budget.cents / 100}` : ""})
|
|
62100
62148
|
`);
|
|
@@ -62107,7 +62155,7 @@ async function securityStatusCommand() {
|
|
|
62107
62155
|
if (run2.agents) console.log(` Agents: finder ${run2.agents.finder.model}, checker ${run2.agents.checker.model} (${run2.agents.checker_mode})
|
|
62108
62156
|
`);
|
|
62109
62157
|
const threatModel = run2.threat_model ?? profile?.threat_model;
|
|
62110
|
-
console.log(
|
|
62158
|
+
console.log(import_chalk38.default.bold(" Threat model"));
|
|
62111
62159
|
if (!threatModel) console.log(" None yet. Write one in your plan.");
|
|
62112
62160
|
else {
|
|
62113
62161
|
for (const [label, value] of [["Attackers", threatModel.attackers], ["Entry points", threatModel.entry_points], ["Must never happen", threatModel.must_never_happen], ["Notes", threatModel.notes]]) {
|
|
@@ -62116,17 +62164,17 @@ async function securityStatusCommand() {
|
|
|
62116
62164
|
}
|
|
62117
62165
|
}
|
|
62118
62166
|
if (profile?.settings.custom_direction) console.log(`
|
|
62119
|
-
${
|
|
62167
|
+
${import_chalk38.default.bold(" Direction from the admin")}
|
|
62120
62168
|
${profile.settings.custom_direction}`);
|
|
62121
62169
|
if (environment2) {
|
|
62122
62170
|
console.log(`
|
|
62123
|
-
${
|
|
62171
|
+
${import_chalk38.default.bold(" Environment")} (names only)`);
|
|
62124
62172
|
console.log(` Variables: ${environment2.variable_names.join(", ") || "none"}`);
|
|
62125
62173
|
console.log(` Files: ${environment2.file_paths.join(", ") || "none"}`);
|
|
62126
62174
|
}
|
|
62127
62175
|
console.log("");
|
|
62128
62176
|
if (dismissed.length) {
|
|
62129
|
-
console.log(
|
|
62177
|
+
console.log(import_chalk38.default.bold(` Dismissed before (${dismissed.length}); don't raise these again unless something changed:`));
|
|
62130
62178
|
for (const finding2 of dismissed) {
|
|
62131
62179
|
console.log(` - ${finding2.title} [${finding2.kind}/${finding2.weakness}] ${finding2.dismissal_reason}${finding2.dismissal_note ? `: ${finding2.dismissal_note}` : ""}`);
|
|
62132
62180
|
}
|
|
@@ -62137,7 +62185,7 @@ ${import_chalk37.default.bold(" Environment")} (names only)`);
|
|
|
62137
62185
|
async function securityPlanCommand(options) {
|
|
62138
62186
|
output2(await request("/plan", { method: "POST", body: await measurePlan(readJson(options.file)) }), (result) => {
|
|
62139
62187
|
printRun(result);
|
|
62140
|
-
console.log(result.run.status === "awaiting_approval" ?
|
|
62188
|
+
console.log(result.run.status === "awaiting_approval" ? import_chalk38.default.gray(" Waiting for an admin to approve the plan. You will get a message when it is approved; stop until then.\n") : import_chalk38.default.gray(" Approved automatically. Start hunting.\n"));
|
|
62141
62189
|
});
|
|
62142
62190
|
}
|
|
62143
62191
|
async function securityUnitCommand(key2, status, options) {
|
|
@@ -62240,7 +62288,7 @@ async function checkLocation(body2) {
|
|
|
62240
62288
|
}
|
|
62241
62289
|
function printUpsertedFinding({ finding, created: created2 }) {
|
|
62242
62290
|
console.log(`
|
|
62243
|
-
${created2 ?
|
|
62291
|
+
${created2 ? import_chalk38.default.green("New finding") : "Matched an existing finding"} ${finding.id} (${finding.status}, ${finding.proof_level})
|
|
62244
62292
|
`);
|
|
62245
62293
|
}
|
|
62246
62294
|
async function securityCandidateCommand(options) {
|
|
@@ -62324,7 +62372,7 @@ async function securityProofCommand(findingId, options) {
|
|
|
62324
62372
|
async function securityPolicyBlockCommand(provider2, code) {
|
|
62325
62373
|
const body2 = { provider: provider2, code };
|
|
62326
62374
|
output2(await request("/policy-blocks", { method: "POST", body: body2 }), () => {
|
|
62327
|
-
console.log(
|
|
62375
|
+
console.log(import_chalk38.default.gray(`
|
|
62328
62376
|
Recorded a ${code} block from ${provider2}.
|
|
62329
62377
|
`));
|
|
62330
62378
|
});
|
|
@@ -62333,7 +62381,7 @@ async function securityAppSetupCommand(options) {
|
|
|
62333
62381
|
const result = options.file ? await request("/app-setup", { method: "PUT", body: readJson(options.file) }) : await request("/app-setup");
|
|
62334
62382
|
output2(result, ({ app_setup }) => {
|
|
62335
62383
|
console.log(app_setup ? `
|
|
62336
|
-
App setup: ${
|
|
62384
|
+
App setup: ${import_chalk38.default.bold(app_setup.status)}${app_setup.reason ? ` (${app_setup.reason})` : ""}
|
|
62337
62385
|
` : "\n No app setup yet.\n");
|
|
62338
62386
|
});
|
|
62339
62387
|
}
|
|
@@ -62404,14 +62452,14 @@ async function securityReviewCommand(options) {
|
|
|
62404
62452
|
` : "\n Recorded. No pull request was opened.\n");
|
|
62405
62453
|
});
|
|
62406
62454
|
}
|
|
62407
|
-
var import_child_process7, import_fs12, import_path12,
|
|
62455
|
+
var import_child_process7, import_fs12, import_path12, import_chalk38, CHUNK_LINES, CHUNK_FILES, TRACE_BRIEF;
|
|
62408
62456
|
var init_security2 = __esm({
|
|
62409
62457
|
"src/commands/security.ts"() {
|
|
62410
62458
|
"use strict";
|
|
62411
62459
|
import_child_process7 = require("child_process");
|
|
62412
62460
|
import_fs12 = __toESM(require("fs"));
|
|
62413
62461
|
import_path12 = require("path");
|
|
62414
|
-
|
|
62462
|
+
import_chalk38 = __toESM(require("chalk"));
|
|
62415
62463
|
init_src();
|
|
62416
62464
|
init_security_checkout();
|
|
62417
62465
|
init_api2();
|
|
@@ -62651,6 +62699,7 @@ var init_src2 = __esm({
|
|
|
62651
62699
|
repos.command("list").description("List all repositories").action(run(repositoriesListCommand));
|
|
62652
62700
|
repos.command("available").description("List GitHub and GitLab repositories Replicas can add").option("--provider <provider>", "Filter by provider: github or gitlab").action(run(repositoriesAvailableCommand));
|
|
62653
62701
|
repos.command("add <owner/name>").description("Add a GitHub or GitLab repository (admins only)").option("-b, --default-branch <branch>", "Default branch (defaults to the repository default)").option("--provider <provider>", "Provider: github or gitlab").action(run(repositoriesAddCommand));
|
|
62702
|
+
repos.command("import-group <group>").description("Connect all projects in a GitLab group (admins only)").option("--no-subgroups", "Only import direct projects in the group, excluding subgroups").action(run(repositoriesImportGroupCommand));
|
|
62654
62703
|
repos.command("update <name-or-id>").description("Change the default branch of a repository (admins only)").requiredOption("-b, --default-branch <branch>", "New default branch").action(run(repositoriesUpdateCommand));
|
|
62655
62704
|
repos.command("delete <name-or-id>").description("Remove a repository (admins only)").action(run(repositoriesDeleteCommand));
|
|
62656
62705
|
repos.command("branches <name-or-id>").description("List branches of a repository").action(run(repositoriesBranchesCommand));
|
|
@@ -62914,11 +62963,11 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
62914
62963
|
|
|
62915
62964
|
// src/bin.ts
|
|
62916
62965
|
var import_node_child_process6 = require("child_process");
|
|
62917
|
-
var
|
|
62966
|
+
var import_chalk39 = __toESM(require("chalk"));
|
|
62918
62967
|
init_config();
|
|
62919
62968
|
if (process.argv[2] === "computer" && isAgentMode()) {
|
|
62920
62969
|
const result = (0, import_node_child_process6.spawnSync)("replicas-computer", process.argv.slice(3), { stdio: "inherit" });
|
|
62921
|
-
if (result.error) console.error(
|
|
62970
|
+
if (result.error) console.error(import_chalk39.default.red(`
|
|
62922
62971
|
\u2717 replicas-computer is unavailable in this workspace image
|
|
62923
62972
|
`));
|
|
62924
62973
|
process.exitCode = result.error ? 1 : result.status ?? 1;
|