replicas-cli 0.3.656 → 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 +565 -546
- 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
|
}
|
|
@@ -57403,15 +57427,15 @@ async function repositoriesImportGroupCommand(group, options) {
|
|
|
57403
57427
|
res.already_connected > 0 ? `${res.already_connected} already connected` : null,
|
|
57404
57428
|
res.failed.length > 0 ? `${res.failed.length} failed` : null
|
|
57405
57429
|
].filter(Boolean);
|
|
57406
|
-
console.log(
|
|
57430
|
+
console.log(import_chalk21.default.green(`
|
|
57407
57431
|
Imported GitLab group ${res.group}: ${parts.join(", ")} (${res.total} total).
|
|
57408
57432
|
`));
|
|
57409
57433
|
if (res.has_more) {
|
|
57410
|
-
console.log(
|
|
57434
|
+
console.log(import_chalk21.default.yellow("Warning: GitLab returned more projects than the page limit. Import specific subgroups to connect the rest.\n"));
|
|
57411
57435
|
}
|
|
57412
57436
|
if (res.failed.length > 0) {
|
|
57413
57437
|
for (const failure2 of res.failed) {
|
|
57414
|
-
console.log(
|
|
57438
|
+
console.log(import_chalk21.default.red(` \u2717 ${failure2.path}: ${failure2.error}`));
|
|
57415
57439
|
}
|
|
57416
57440
|
console.log();
|
|
57417
57441
|
}
|
|
@@ -57434,11 +57458,11 @@ async function repositoriesBranchesCommand(repository) {
|
|
|
57434
57458
|
for (const branch of branches) console.log(branch);
|
|
57435
57459
|
});
|
|
57436
57460
|
}
|
|
57437
|
-
var
|
|
57461
|
+
var import_chalk21, splitList;
|
|
57438
57462
|
var init_repositories2 = __esm({
|
|
57439
57463
|
"src/commands/repositories.ts"() {
|
|
57440
57464
|
"use strict";
|
|
57441
|
-
|
|
57465
|
+
import_chalk21 = __toESM(require("chalk"));
|
|
57442
57466
|
init_api2();
|
|
57443
57467
|
init_command_utils();
|
|
57444
57468
|
init_output();
|
|
@@ -57467,23 +57491,23 @@ async function resolveEnvironmentId(input2) {
|
|
|
57467
57491
|
return resolved.id;
|
|
57468
57492
|
}
|
|
57469
57493
|
function printEnvironment(env, repoSkillCount) {
|
|
57470
|
-
console.log(
|
|
57471
|
-
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}`));
|
|
57472
57496
|
if (env.description) {
|
|
57473
|
-
console.log(
|
|
57497
|
+
console.log(import_chalk22.default.gray(` Description: ${env.description}`));
|
|
57474
57498
|
}
|
|
57475
57499
|
const repositoryIds = env.repository_ids ?? [];
|
|
57476
57500
|
if (repositoryIds.length > 0) {
|
|
57477
|
-
console.log(
|
|
57501
|
+
console.log(import_chalk22.default.gray(` Repositories: ${repositoryIds.join(", ")}`));
|
|
57478
57502
|
}
|
|
57479
|
-
console.log(
|
|
57503
|
+
console.log(import_chalk22.default.gray(` Setup source: ${env.setup_source_mode}`));
|
|
57480
57504
|
if (env.variable_count !== void 0) {
|
|
57481
|
-
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}`));
|
|
57482
57506
|
}
|
|
57483
57507
|
if (repoSkillCount !== void 0) {
|
|
57484
|
-
console.log(
|
|
57508
|
+
console.log(import_chalk22.default.gray(` Repository skills: ${repoSkillCount}`));
|
|
57485
57509
|
}
|
|
57486
|
-
console.log(
|
|
57510
|
+
console.log(import_chalk22.default.gray(` Updated: ${formatDate(env.updated_at)}`));
|
|
57487
57511
|
console.log();
|
|
57488
57512
|
}
|
|
57489
57513
|
async function environmentListCommand() {
|
|
@@ -57491,10 +57515,10 @@ async function environmentListCommand() {
|
|
|
57491
57515
|
const response = await orgAuthenticatedFetch("/v1/environments?scope=all");
|
|
57492
57516
|
output2(response, ({ environments }) => {
|
|
57493
57517
|
if (environments.length === 0) {
|
|
57494
|
-
console.log(
|
|
57518
|
+
console.log(import_chalk22.default.yellow("\nNo environments found.\n"));
|
|
57495
57519
|
return;
|
|
57496
57520
|
}
|
|
57497
|
-
console.log(
|
|
57521
|
+
console.log(import_chalk22.default.green(`
|
|
57498
57522
|
Environments (${environments.length}):
|
|
57499
57523
|
`));
|
|
57500
57524
|
for (const env of environments) printEnvironment(env);
|
|
@@ -57506,13 +57530,13 @@ async function environmentGetCommand(idOrName) {
|
|
|
57506
57530
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}`);
|
|
57507
57531
|
const repoSkills = await orgAuthenticatedFetch(`/v1/environments/${response.environment.id}/repo-skills`);
|
|
57508
57532
|
output2({ ...response, ...repoSkills }, ({ environment: environment2 }) => {
|
|
57509
|
-
console.log(
|
|
57533
|
+
console.log(import_chalk22.default.green(`
|
|
57510
57534
|
Environment: ${environment2.name}
|
|
57511
57535
|
`));
|
|
57512
57536
|
const linkedSkills = repoSkills.repo_skills.filter((skill) => skill.path.startsWith(`.${skill.framework}/skills/`));
|
|
57513
57537
|
printEnvironment(environment2, new Set(linkedSkills.map((skill) => `${skill.repository_id}:${skill.path.split("/")[2]}`)).size);
|
|
57514
57538
|
for (const message2 of [repoSkills.error, ...repoSkills.repo_errors.map((repo) => `${repo.repository_full_name}: ${repo.error}`)]) {
|
|
57515
|
-
if (message2) console.log(
|
|
57539
|
+
if (message2) console.log(import_chalk22.default.yellow(` Could not read repository skills: ${message2}`));
|
|
57516
57540
|
}
|
|
57517
57541
|
});
|
|
57518
57542
|
}
|
|
@@ -57527,7 +57551,7 @@ async function environmentCreateCommand(name, options) {
|
|
|
57527
57551
|
validate: (v2) => v2.trim() ? true : "Name is required"
|
|
57528
57552
|
});
|
|
57529
57553
|
if (!r.name) {
|
|
57530
|
-
console.log(
|
|
57554
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
57531
57555
|
return;
|
|
57532
57556
|
}
|
|
57533
57557
|
envName = r.name;
|
|
@@ -57561,9 +57585,9 @@ async function environmentCreateCommand(name, options) {
|
|
|
57561
57585
|
body: body2
|
|
57562
57586
|
});
|
|
57563
57587
|
output2(response, ({ environment: environment2 }) => {
|
|
57564
|
-
console.log(
|
|
57588
|
+
console.log(import_chalk22.default.green(`
|
|
57565
57589
|
Created environment: ${environment2.name}`));
|
|
57566
|
-
console.log(
|
|
57590
|
+
console.log(import_chalk22.default.gray(` ID: ${environment2.id}
|
|
57567
57591
|
`));
|
|
57568
57592
|
});
|
|
57569
57593
|
}
|
|
@@ -57588,7 +57612,7 @@ async function environmentEditCommand(idOrName, options) {
|
|
|
57588
57612
|
method: "PATCH",
|
|
57589
57613
|
body: body2
|
|
57590
57614
|
});
|
|
57591
|
-
output2(response, ({ environment: environment2 }) => console.log(
|
|
57615
|
+
output2(response, ({ environment: environment2 }) => console.log(import_chalk22.default.green(`
|
|
57592
57616
|
Updated environment: ${environment2.name}
|
|
57593
57617
|
`)));
|
|
57594
57618
|
}
|
|
@@ -57602,11 +57626,11 @@ Deleted environment ${idOrName}.
|
|
|
57602
57626
|
`);
|
|
57603
57627
|
}
|
|
57604
57628
|
function printVariable(v2) {
|
|
57605
|
-
console.log(
|
|
57606
|
-
console.log(
|
|
57607
|
-
console.log(
|
|
57608
|
-
if (v2.proxy_hosts.length > 0) console.log(
|
|
57609
|
-
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)}`));
|
|
57610
57634
|
console.log();
|
|
57611
57635
|
}
|
|
57612
57636
|
async function envVarsListCommand(envIdOrName, options) {
|
|
@@ -57618,14 +57642,14 @@ async function envVarsListCommand(envIdOrName, options) {
|
|
|
57618
57642
|
const variables = options.reveal ? response.environment_variables : response.environment_variables.map((v2) => ({ ...v2, value: maskValue(v2.value) }));
|
|
57619
57643
|
output2({ environment_variables: variables }, ({ environment_variables }) => {
|
|
57620
57644
|
if (environment_variables.length === 0) {
|
|
57621
|
-
console.log(
|
|
57645
|
+
console.log(import_chalk22.default.yellow("\nNo variables.\n"));
|
|
57622
57646
|
return;
|
|
57623
57647
|
}
|
|
57624
|
-
console.log(
|
|
57648
|
+
console.log(import_chalk22.default.green(`
|
|
57625
57649
|
Variables (${environment_variables.length}):
|
|
57626
57650
|
`));
|
|
57627
57651
|
if (!options.reveal) {
|
|
57628
|
-
console.log(
|
|
57652
|
+
console.log(import_chalk22.default.gray(" Values are masked. Pass --reveal to show full values.\n"));
|
|
57629
57653
|
}
|
|
57630
57654
|
for (const v2 of environment_variables) printVariable(v2);
|
|
57631
57655
|
});
|
|
@@ -57640,13 +57664,8 @@ async function envVarsProxyCommand(envIdOrName, key2, hosts) {
|
|
|
57640
57664
|
const match = await findVariableByKey(id, key2);
|
|
57641
57665
|
if (!match) throw new Error(`No variable named ${key2} in this environment`);
|
|
57642
57666
|
const body2 = { proxy_hosts: hosts };
|
|
57643
|
-
const response = await orgAuthenticatedFetch(
|
|
57644
|
-
|
|
57645
|
-
{ method: "PATCH", body: body2 }
|
|
57646
|
-
);
|
|
57647
|
-
output2(response, (result) => console.log("message" in result ? import_chalk21.default.yellow(`
|
|
57648
|
-
${result.message}
|
|
57649
|
-
`) : 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(`
|
|
57650
57669
|
${key2} is ${result.environment_variable.proxy_hosts.length > 0 ? `sent only to ${result.environment_variable.proxy_hosts.join(", ")}` : "no longer proxied"}.
|
|
57651
57670
|
`)));
|
|
57652
57671
|
}
|
|
@@ -57660,7 +57679,7 @@ async function envVarsSetCommand(envIdOrName, key2, value, options) {
|
|
|
57660
57679
|
`/v1/environments/${id}/variables/${match.id}`,
|
|
57661
57680
|
{ method: "PATCH", body: body3 }
|
|
57662
57681
|
);
|
|
57663
|
-
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(`
|
|
57664
57683
|
Updated variable ${environment_variable.key}.
|
|
57665
57684
|
`)));
|
|
57666
57685
|
return;
|
|
@@ -57675,7 +57694,7 @@ Updated variable ${environment_variable.key}.
|
|
|
57675
57694
|
`/v1/environments/${id}/variables`,
|
|
57676
57695
|
{ method: "POST", body: body2 }
|
|
57677
57696
|
);
|
|
57678
|
-
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(`
|
|
57679
57698
|
Created variable ${environment_variable.key}.
|
|
57680
57699
|
`)));
|
|
57681
57700
|
}
|
|
@@ -57710,15 +57729,15 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57710
57729
|
const local = parsePosixEnvFile(readRuntimeEnv());
|
|
57711
57730
|
const available = options.replace ? [] : keys.filter((key2) => Object.hasOwn(local, key2) && local[key2].length > 0);
|
|
57712
57731
|
const wanted = keys.filter((key2) => !available.includes(key2));
|
|
57713
|
-
const loadHint =
|
|
57732
|
+
const loadHint = import_chalk22.default.gray(`
|
|
57714
57733
|
Values are never printed. Load them into a command with: . ~/.replicas/runtime-env.sh && <command>
|
|
57715
57734
|
`);
|
|
57716
57735
|
if (wanted.length === 0) {
|
|
57717
57736
|
output2({ status: "provided", exported: available, missing: [] }, () => {
|
|
57718
57737
|
console.log(`
|
|
57719
|
-
${
|
|
57738
|
+
${import_chalk22.default.green("Already available:")} ${available.join(", ")}`);
|
|
57720
57739
|
console.log(loadHint);
|
|
57721
|
-
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"));
|
|
57722
57741
|
});
|
|
57723
57742
|
return;
|
|
57724
57743
|
}
|
|
@@ -57754,11 +57773,11 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57754
57773
|
console.log("");
|
|
57755
57774
|
if (exported.length > 0 || available.length > 0) {
|
|
57756
57775
|
const where = request2.destination === "workspace" ? "this workspace only" : "saved to the environment";
|
|
57757
|
-
console.log(` ${
|
|
57776
|
+
console.log(` ${import_chalk22.default.green("Provided:")} ${[...available, ...exported].join(", ")} ${import_chalk22.default.gray(`(${where})`)}`);
|
|
57758
57777
|
}
|
|
57759
57778
|
if (request2.status === "pending") {
|
|
57760
|
-
console.log(` ${
|
|
57761
|
-
console.log(
|
|
57779
|
+
console.log(` ${import_chalk22.default.yellow("Still waiting for:")} ${missing.join(", ")}`);
|
|
57780
|
+
console.log(import_chalk22.default.gray(options.wait === false ? `
|
|
57762
57781
|
Asked above the chat composer (${created2.url}). Keep working, and run this command again when you need the values.
|
|
57763
57782
|
` : created2.wait ? `
|
|
57764
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.
|
|
@@ -57768,21 +57787,21 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57768
57787
|
`));
|
|
57769
57788
|
return;
|
|
57770
57789
|
}
|
|
57771
|
-
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(", ")}`);
|
|
57772
57791
|
if (exported.length === 0) {
|
|
57773
|
-
console.log(
|
|
57792
|
+
console.log(import_chalk22.default.gray("\n Continue without them, or ask the user how they want to proceed.\n"));
|
|
57774
57793
|
return;
|
|
57775
57794
|
}
|
|
57776
57795
|
console.log(loadHint);
|
|
57777
|
-
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"));
|
|
57778
57797
|
});
|
|
57779
57798
|
}
|
|
57780
57799
|
function printFile(f) {
|
|
57781
|
-
console.log(
|
|
57782
|
-
console.log(
|
|
57783
|
-
console.log(
|
|
57784
|
-
console.log(
|
|
57785
|
-
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)}`));
|
|
57786
57805
|
console.log();
|
|
57787
57806
|
}
|
|
57788
57807
|
async function envFilesListCommand(envIdOrName) {
|
|
@@ -57793,10 +57812,10 @@ async function envFilesListCommand(envIdOrName) {
|
|
|
57793
57812
|
);
|
|
57794
57813
|
output2(response, ({ environment_files }) => {
|
|
57795
57814
|
if (environment_files.length === 0) {
|
|
57796
|
-
console.log(
|
|
57815
|
+
console.log(import_chalk22.default.yellow("\nNo files.\n"));
|
|
57797
57816
|
return;
|
|
57798
57817
|
}
|
|
57799
|
-
console.log(
|
|
57818
|
+
console.log(import_chalk22.default.green(`
|
|
57800
57819
|
Files (${environment_files.length}):
|
|
57801
57820
|
`));
|
|
57802
57821
|
for (const f of environment_files) printFile(f);
|
|
@@ -57828,7 +57847,7 @@ async function envFilesSetCommand(envIdOrName, destinationPath, options) {
|
|
|
57828
57847
|
`/v1/environments/${id}/files/${match.id}`,
|
|
57829
57848
|
{ method: "PATCH", body: body3 }
|
|
57830
57849
|
);
|
|
57831
|
-
output2(response2, ({ environment_file }) => console.log(
|
|
57850
|
+
output2(response2, ({ environment_file }) => console.log(import_chalk22.default.green(`
|
|
57832
57851
|
Updated file ${environment_file.path}.
|
|
57833
57852
|
`)));
|
|
57834
57853
|
return;
|
|
@@ -57843,7 +57862,7 @@ Updated file ${environment_file.path}.
|
|
|
57843
57862
|
`/v1/environments/${id}/files`,
|
|
57844
57863
|
{ method: "POST", body: body2 }
|
|
57845
57864
|
);
|
|
57846
|
-
output2(response, ({ environment_file }) => console.log(
|
|
57865
|
+
output2(response, ({ environment_file }) => console.log(import_chalk22.default.green(`
|
|
57847
57866
|
Created file ${environment_file.path}.
|
|
57848
57867
|
`)));
|
|
57849
57868
|
}
|
|
@@ -57873,16 +57892,16 @@ async function envHookGetCommand(envIdOrName, kind) {
|
|
|
57873
57892
|
const hook = kind === "warm" ? (await orgAuthenticatedFetch(`/v1/environments/${id}/warm-hooks`)).warm_hook : (await orgAuthenticatedFetch(`/v1/environments/${id}/start-hooks`)).start_hook;
|
|
57874
57893
|
output2({ hook }, () => {
|
|
57875
57894
|
if (!hook) {
|
|
57876
|
-
console.log(
|
|
57895
|
+
console.log(import_chalk22.default.yellow(`
|
|
57877
57896
|
No ${kind} hook configured.
|
|
57878
57897
|
`));
|
|
57879
57898
|
return;
|
|
57880
57899
|
}
|
|
57881
|
-
console.log(
|
|
57900
|
+
console.log(import_chalk22.default.green(`
|
|
57882
57901
|
${kind === "warm" ? "Warm" : "Start"} hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
57883
57902
|
`));
|
|
57884
|
-
console.log(
|
|
57885
|
-
console.log(
|
|
57903
|
+
console.log(import_chalk22.default.gray(` ID: ${hook.id}`));
|
|
57904
|
+
console.log(import_chalk22.default.gray(` Created: ${formatDate(hook.created_at)}
|
|
57886
57905
|
`));
|
|
57887
57906
|
console.log(hook.content);
|
|
57888
57907
|
console.log();
|
|
@@ -57898,7 +57917,7 @@ async function envHookSaveCommand(envIdOrName, options, kind) {
|
|
|
57898
57917
|
`/v1/environments/${id}/warm-hooks/save`,
|
|
57899
57918
|
{ method: "POST", body: body3 }
|
|
57900
57919
|
);
|
|
57901
|
-
output2(response2, ({ warm_hook }) => console.log(
|
|
57920
|
+
output2(response2, ({ warm_hook }) => console.log(import_chalk22.default.green(warm_hook ? `
|
|
57902
57921
|
Saved warm hook v${warm_hook.version}.
|
|
57903
57922
|
` : "\nCleared warm hook.\n")));
|
|
57904
57923
|
return;
|
|
@@ -57908,7 +57927,7 @@ Saved warm hook v${warm_hook.version}.
|
|
|
57908
57927
|
`/v1/environments/${id}/start-hooks/save`,
|
|
57909
57928
|
{ method: "POST", body: body2 }
|
|
57910
57929
|
);
|
|
57911
|
-
output2(response, ({ start_hook }) => console.log(
|
|
57930
|
+
output2(response, ({ start_hook }) => console.log(import_chalk22.default.green(start_hook ? `
|
|
57912
57931
|
Saved start hook v${start_hook.version}.
|
|
57913
57932
|
` : "\nCleared start hook.\n")));
|
|
57914
57933
|
}
|
|
@@ -57926,7 +57945,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
57926
57945
|
body: kind === "warm" ? { content, mode: options.save ? "save_test" : "test_only" } : { content },
|
|
57927
57946
|
onEvent: (event) => {
|
|
57928
57947
|
if (event.type === "progress" && event.message) {
|
|
57929
|
-
console.log(
|
|
57948
|
+
console.log(import_chalk22.default.gray(event.message));
|
|
57930
57949
|
} else if (event.type === "output" && event.output) {
|
|
57931
57950
|
logs += event.output;
|
|
57932
57951
|
if (!isJsonMode()) process.stdout.write(event.output);
|
|
@@ -57943,7 +57962,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
57943
57962
|
const label = kind === "warm" ? "Warm" : "Start";
|
|
57944
57963
|
const passed = !timedOut && exitCode === 0;
|
|
57945
57964
|
output2({ passed, exit_code: exitCode, timed_out: timedOut, saved: passed && !!options.save, output: logs }, () => {
|
|
57946
|
-
if (passed) console.log(
|
|
57965
|
+
if (passed) console.log(import_chalk22.default.green(`
|
|
57947
57966
|
${label} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
|
|
57948
57967
|
`));
|
|
57949
57968
|
});
|
|
@@ -57960,24 +57979,24 @@ async function envHookRepositoryHooksCommand(envIdOrName, kind) {
|
|
|
57960
57979
|
)).repositories.map((repository) => ({ ...repository, hook: repository.start_hook }));
|
|
57961
57980
|
output2({ repositories }, () => {
|
|
57962
57981
|
if (repositories.length === 0) {
|
|
57963
|
-
console.log(
|
|
57982
|
+
console.log(import_chalk22.default.yellow("\nNo repositories bound to this environment.\n"));
|
|
57964
57983
|
return;
|
|
57965
57984
|
}
|
|
57966
|
-
console.log(
|
|
57985
|
+
console.log(import_chalk22.default.green(`
|
|
57967
57986
|
Repository ${kind} hooks (${repositories.length}):
|
|
57968
57987
|
`));
|
|
57969
57988
|
for (const repo of repositories) {
|
|
57970
|
-
console.log(
|
|
57989
|
+
console.log(import_chalk22.default.white(` ${repo.repository_name} @${repo.default_branch}`));
|
|
57971
57990
|
if (repo.error) {
|
|
57972
|
-
console.log(
|
|
57991
|
+
console.log(import_chalk22.default.red(` Error: ${repo.error}`));
|
|
57973
57992
|
} else if (repo.hook) {
|
|
57974
|
-
console.log(
|
|
57975
|
-
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}):`));
|
|
57976
57995
|
for (const cmd of repo.hook.commands) {
|
|
57977
|
-
console.log(
|
|
57996
|
+
console.log(import_chalk22.default.gray(` ${cmd}`));
|
|
57978
57997
|
}
|
|
57979
57998
|
} else {
|
|
57980
|
-
console.log(
|
|
57999
|
+
console.log(import_chalk22.default.gray(` No ${kind}Hook defined.`));
|
|
57981
58000
|
}
|
|
57982
58001
|
console.log();
|
|
57983
58002
|
}
|
|
@@ -58019,7 +58038,7 @@ async function envSkillsAddCommand(env, source, slug2, options) {
|
|
|
58019
58038
|
const id = await resolveEnvironmentId(env);
|
|
58020
58039
|
const body2 = { environment_id: id, source, slug: slug2, name: options.name ?? slug2 };
|
|
58021
58040
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/skills`, { method: "POST", body: body2 });
|
|
58022
|
-
output2(response, () => console.log(
|
|
58041
|
+
output2(response, () => console.log(import_chalk22.default.green(`Added skill ${slug2} from ${source}`)));
|
|
58023
58042
|
}
|
|
58024
58043
|
async function envSkillsRemoveCommand(env, slugOrId) {
|
|
58025
58044
|
const id = await resolveEnvironmentId(env);
|
|
@@ -58047,7 +58066,7 @@ async function envMcpsAddCommand(env, name, options) {
|
|
|
58047
58066
|
const id = await resolveEnvironmentId(env);
|
|
58048
58067
|
const body2 = { environment_id: id, name, ...server };
|
|
58049
58068
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/mcps`, { method: "POST", body: body2 });
|
|
58050
|
-
output2(response, () => console.log(
|
|
58069
|
+
output2(response, () => console.log(import_chalk22.default.green(`Added MCP server ${name}`)));
|
|
58051
58070
|
}
|
|
58052
58071
|
async function envMcpsRemoveCommand(env, nameOrId) {
|
|
58053
58072
|
const id = await resolveEnvironmentId(env);
|
|
@@ -58063,13 +58082,13 @@ async function envDevicesListCommand(env) {
|
|
|
58063
58082
|
);
|
|
58064
58083
|
output2(response, ({ environment_devices }) => {
|
|
58065
58084
|
if (environment_devices.length === 0) {
|
|
58066
|
-
console.log(
|
|
58085
|
+
console.log(import_chalk22.default.yellow(`
|
|
58067
58086
|
No devices. Add one with: replicas env devices add ${env} <name> --user <user>
|
|
58068
58087
|
`));
|
|
58069
58088
|
return;
|
|
58070
58089
|
}
|
|
58071
58090
|
for (const device of environment_devices) {
|
|
58072
|
-
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");
|
|
58073
58092
|
console.log(`${device.id} ${device.name} ${device.host === null ? `${device.username}, connects from the device ${status}` : `${device.username}@${device.host}:${device.port}`}`);
|
|
58074
58093
|
}
|
|
58075
58094
|
});
|
|
@@ -58080,10 +58099,10 @@ async function envDevicesAddCommand(env, name, options) {
|
|
|
58080
58099
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`, { method: "POST", body: body2 });
|
|
58081
58100
|
const connect2 = options.host === void 0 ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${response.environment_device.id}/connect-token`) : void 0;
|
|
58082
58101
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
58083
|
-
console.log(
|
|
58102
|
+
console.log(import_chalk22.default.green(`Added device ${name}. Allow its key by running this on the device as ${options.user}:`));
|
|
58084
58103
|
console.log(`mkdir -p ~/.ssh && echo '${environment_device.public_key}' >> ~/.ssh/authorized_keys`);
|
|
58085
58104
|
if (connect_token) {
|
|
58086
|
-
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:"));
|
|
58087
58106
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
58088
58107
|
console.log(connect_token);
|
|
58089
58108
|
}
|
|
@@ -58101,9 +58120,9 @@ async function envDevicesEditCommand(env, nameOrId, options) {
|
|
|
58101
58120
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}`, { method: "PATCH", body: body2 });
|
|
58102
58121
|
const connect2 = device.host !== null && response.environment_device.host === null ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`) : void 0;
|
|
58103
58122
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
58104
|
-
console.log(
|
|
58123
|
+
console.log(import_chalk22.default.green(`Updated device ${environment_device.name}. Workspaces started from now on get the change.`));
|
|
58105
58124
|
if (connect_token) {
|
|
58106
|
-
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:"));
|
|
58107
58126
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
58108
58127
|
console.log(connect_token);
|
|
58109
58128
|
}
|
|
@@ -58124,7 +58143,7 @@ async function envDevicesResetCommand(env, nameOrId) {
|
|
|
58124
58143
|
if (!device) throw new Error(`Device not found: ${nameOrId}`);
|
|
58125
58144
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`, { method: "POST" });
|
|
58126
58145
|
output2(response, ({ token }) => {
|
|
58127
|
-
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:`));
|
|
58128
58147
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
58129
58148
|
console.log(token);
|
|
58130
58149
|
});
|
|
@@ -58134,17 +58153,17 @@ function envWarmPoolCommand(enabled) {
|
|
|
58134
58153
|
const id = await resolveEnvironmentId(env);
|
|
58135
58154
|
const body2 = { environment_id: id, enabled };
|
|
58136
58155
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/warm-pools`, { method: "PUT", body: body2 });
|
|
58137
|
-
output2(response, () => console.log(
|
|
58156
|
+
output2(response, () => console.log(import_chalk22.default.green(`Warm pool ${enabled ? "enabled" : "disabled"}`)));
|
|
58138
58157
|
};
|
|
58139
58158
|
}
|
|
58140
|
-
var import_fs5, import_os3, import_path6,
|
|
58159
|
+
var import_fs5, import_os3, import_path6, import_chalk22, RUNTIME_ENV_FILE;
|
|
58141
58160
|
var init_environment3 = __esm({
|
|
58142
58161
|
"src/commands/environment.ts"() {
|
|
58143
58162
|
"use strict";
|
|
58144
58163
|
import_fs5 = __toESM(require("fs"));
|
|
58145
58164
|
import_os3 = __toESM(require("os"));
|
|
58146
58165
|
import_path6 = __toESM(require("path"));
|
|
58147
|
-
|
|
58166
|
+
import_chalk22 = __toESM(require("chalk"));
|
|
58148
58167
|
init_api2();
|
|
58149
58168
|
init_command_utils();
|
|
58150
58169
|
init_output();
|
|
@@ -58164,101 +58183,101 @@ function parseReplicaAgent(value) {
|
|
|
58164
58183
|
throw new Error(`Invalid coding agent: ${value}. Must be one of: ${CLI_CODING_AGENT_LABEL}`);
|
|
58165
58184
|
}
|
|
58166
58185
|
function formatStatus(status) {
|
|
58167
|
-
if (status === "active") return
|
|
58168
|
-
if (isWorkspaceSuspendedStatus(status)) return
|
|
58186
|
+
if (status === "active") return import_chalk23.default.green(status);
|
|
58187
|
+
if (isWorkspaceSuspendedStatus(status)) return import_chalk23.default.gray(status);
|
|
58169
58188
|
return status;
|
|
58170
58189
|
}
|
|
58171
58190
|
function formatDisplayMessage(message2) {
|
|
58172
58191
|
const time3 = new Date(message2.timestamp).toLocaleTimeString();
|
|
58173
58192
|
switch (message2.type) {
|
|
58174
58193
|
case "user":
|
|
58175
|
-
console.log(
|
|
58194
|
+
console.log(import_chalk23.default.blue(`
|
|
58176
58195
|
[${time3}] USER:`));
|
|
58177
|
-
console.log(
|
|
58196
|
+
console.log(import_chalk23.default.white(` ${truncate(userMessageText(message2), 500)}`));
|
|
58178
58197
|
break;
|
|
58179
58198
|
case "agent":
|
|
58180
|
-
console.log(
|
|
58199
|
+
console.log(import_chalk23.default.green(`
|
|
58181
58200
|
[${time3}] ASSISTANT:`));
|
|
58182
|
-
console.log(
|
|
58201
|
+
console.log(import_chalk23.default.white(` ${truncate(message2.content, 500)}`));
|
|
58183
58202
|
break;
|
|
58184
58203
|
case "reasoning":
|
|
58185
|
-
console.log(
|
|
58204
|
+
console.log(import_chalk23.default.gray(`
|
|
58186
58205
|
[${time3}] THINKING:`));
|
|
58187
|
-
console.log(
|
|
58206
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.content, 300)}`));
|
|
58188
58207
|
break;
|
|
58189
58208
|
case "command":
|
|
58190
|
-
console.log(
|
|
58209
|
+
console.log(import_chalk23.default.magenta(`
|
|
58191
58210
|
[${time3}] COMMAND:`));
|
|
58192
|
-
console.log(
|
|
58211
|
+
console.log(import_chalk23.default.white(` $ ${message2.command}`));
|
|
58193
58212
|
if (message2.output) {
|
|
58194
|
-
console.log(
|
|
58213
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.output, 200)}`));
|
|
58195
58214
|
}
|
|
58196
58215
|
if (message2.exitCode !== void 0) {
|
|
58197
|
-
const exitColor = message2.exitCode === 0 ?
|
|
58216
|
+
const exitColor = message2.exitCode === 0 ? import_chalk23.default.green : import_chalk23.default.red;
|
|
58198
58217
|
console.log(exitColor(` Exit code: ${message2.exitCode}`));
|
|
58199
58218
|
}
|
|
58200
58219
|
break;
|
|
58201
58220
|
case "file_change":
|
|
58202
|
-
console.log(
|
|
58221
|
+
console.log(import_chalk23.default.yellow(`
|
|
58203
58222
|
[${time3}] FILE CHANGES:`));
|
|
58204
58223
|
for (const change2 of message2.changes) {
|
|
58205
58224
|
const icon = change2.kind === "add" ? "+" : change2.kind === "delete" ? "-" : "~";
|
|
58206
|
-
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;
|
|
58207
58226
|
console.log(color(` ${icon} ${change2.path}`));
|
|
58208
58227
|
}
|
|
58209
58228
|
break;
|
|
58210
58229
|
case "patch":
|
|
58211
|
-
console.log(
|
|
58230
|
+
console.log(import_chalk23.default.yellow(`
|
|
58212
58231
|
[${time3}] PATCH:`));
|
|
58213
58232
|
for (const op of message2.operations) {
|
|
58214
58233
|
const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
|
|
58215
|
-
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;
|
|
58216
58235
|
console.log(color(` ${icon} ${op.path}`));
|
|
58217
58236
|
}
|
|
58218
58237
|
break;
|
|
58219
58238
|
case "tool_call":
|
|
58220
|
-
console.log(
|
|
58239
|
+
console.log(import_chalk23.default.cyan(`
|
|
58221
58240
|
[${time3}] TOOL: ${message2.tool}`));
|
|
58222
58241
|
if (message2.output) {
|
|
58223
|
-
console.log(
|
|
58242
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.output, 200)}`));
|
|
58224
58243
|
}
|
|
58225
58244
|
if (message2.inputRequest?.status === "pending") {
|
|
58226
58245
|
const { requestId, options, questions } = message2.inputRequest;
|
|
58227
|
-
console.log(
|
|
58228
|
-
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}`));
|
|
58229
58248
|
for (const question of questions ?? []) {
|
|
58230
|
-
console.log(
|
|
58231
|
-
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}`));
|
|
58232
58251
|
}
|
|
58233
58252
|
if (questions?.length) {
|
|
58234
|
-
console.log(
|
|
58253
|
+
console.log(import_chalk23.default.gray(` Selection ID: '{"<question>":{"options":["<option>"]}}', '{"<question>":{"custom":"<text>"}}', or declined`));
|
|
58235
58254
|
}
|
|
58236
58255
|
}
|
|
58237
58256
|
break;
|
|
58238
58257
|
case "web_search":
|
|
58239
|
-
console.log(
|
|
58258
|
+
console.log(import_chalk23.default.cyan(`
|
|
58240
58259
|
[${time3}] WEB SEARCH:`));
|
|
58241
|
-
console.log(
|
|
58260
|
+
console.log(import_chalk23.default.white(` "${message2.query}"`));
|
|
58242
58261
|
break;
|
|
58243
58262
|
case "todo_list":
|
|
58244
|
-
console.log(
|
|
58263
|
+
console.log(import_chalk23.default.blue(`
|
|
58245
58264
|
[${time3}] PLAN:`));
|
|
58246
58265
|
for (const item of message2.items) {
|
|
58247
|
-
const icon = item.completed ?
|
|
58266
|
+
const icon = item.completed ? import_chalk23.default.green("[x]") : import_chalk23.default.gray("[ ]");
|
|
58248
58267
|
console.log(` ${icon} ${item.text}`);
|
|
58249
58268
|
}
|
|
58250
58269
|
break;
|
|
58251
58270
|
case "subagent":
|
|
58252
|
-
console.log(
|
|
58271
|
+
console.log(import_chalk23.default.magenta(`
|
|
58253
58272
|
[${time3}] SUBAGENT: ${message2.description}`));
|
|
58254
58273
|
if (message2.output) {
|
|
58255
|
-
console.log(
|
|
58274
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.output, 200)}`));
|
|
58256
58275
|
}
|
|
58257
58276
|
break;
|
|
58258
58277
|
case "error":
|
|
58259
|
-
console.log(
|
|
58278
|
+
console.log(import_chalk23.default.red(`
|
|
58260
58279
|
[${time3}] ERROR:`));
|
|
58261
|
-
console.log(
|
|
58280
|
+
console.log(import_chalk23.default.red(` ${message2.message}`));
|
|
58262
58281
|
break;
|
|
58263
58282
|
}
|
|
58264
58283
|
}
|
|
@@ -58274,24 +58293,24 @@ async function replicaListCommand(options) {
|
|
|
58274
58293
|
);
|
|
58275
58294
|
output2(response, (response2) => {
|
|
58276
58295
|
if (response2.replicas.length === 0) {
|
|
58277
|
-
console.log(
|
|
58296
|
+
console.log(import_chalk23.default.yellow("\nNo replicas found.\n"));
|
|
58278
58297
|
return;
|
|
58279
58298
|
}
|
|
58280
|
-
console.log(
|
|
58299
|
+
console.log(import_chalk23.default.green(`
|
|
58281
58300
|
Replicas (Page ${response2.page} of ${response2.total_pages}, Total: ${response2.total}):
|
|
58282
58301
|
`));
|
|
58283
58302
|
for (const replica of response2.replicas) {
|
|
58284
|
-
console.log(
|
|
58285
|
-
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}`));
|
|
58286
58305
|
if (replica.repositories.length > 0) {
|
|
58287
|
-
console.log(
|
|
58306
|
+
console.log(import_chalk23.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
58288
58307
|
}
|
|
58289
|
-
console.log(
|
|
58290
|
-
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)}`));
|
|
58291
58310
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
58292
|
-
console.log(
|
|
58311
|
+
console.log(import_chalk23.default.gray(` Pull Requests:`));
|
|
58293
58312
|
for (const pr2 of replica.pull_requests) {
|
|
58294
|
-
console.log(
|
|
58313
|
+
console.log(import_chalk23.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
58295
58314
|
}
|
|
58296
58315
|
}
|
|
58297
58316
|
console.log();
|
|
@@ -58302,31 +58321,31 @@ async function replicaGetCommand(id) {
|
|
|
58302
58321
|
ensureOrgApiAuthenticated();
|
|
58303
58322
|
const response = await orgAuthenticatedFetch(`/v1/replica/${id}`);
|
|
58304
58323
|
output2(response, ({ replica }) => {
|
|
58305
|
-
console.log(
|
|
58324
|
+
console.log(import_chalk23.default.green(`
|
|
58306
58325
|
Replica: ${replica.name}
|
|
58307
58326
|
`));
|
|
58308
|
-
console.log(
|
|
58309
|
-
console.log(
|
|
58327
|
+
console.log(import_chalk23.default.gray(` ID: ${replica.id}`));
|
|
58328
|
+
console.log(import_chalk23.default.gray(` Kind: ${replica.kind}`));
|
|
58310
58329
|
if (replica.repositories.length > 0) {
|
|
58311
|
-
console.log(
|
|
58330
|
+
console.log(import_chalk23.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
58312
58331
|
}
|
|
58313
|
-
console.log(
|
|
58314
|
-
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)}`));
|
|
58315
58334
|
if (replica.coding_agent) {
|
|
58316
|
-
console.log(
|
|
58335
|
+
console.log(import_chalk23.default.gray(` Coding Agent: ${replica.coding_agent}`));
|
|
58317
58336
|
}
|
|
58318
58337
|
if (replica.activity) printReplicaActivity(replica.activity);
|
|
58319
58338
|
if (replica.repository_statuses && replica.repository_statuses.length > 0) {
|
|
58320
|
-
console.log(
|
|
58339
|
+
console.log(import_chalk23.default.gray(" Repository Statuses:"));
|
|
58321
58340
|
for (const repositoryStatus of replica.repository_statuses) {
|
|
58322
|
-
const changeText = repositoryStatus.git_diff ? ` (${
|
|
58323
|
-
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}`));
|
|
58324
58343
|
}
|
|
58325
58344
|
}
|
|
58326
58345
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
58327
|
-
console.log(
|
|
58346
|
+
console.log(import_chalk23.default.gray(` Pull Requests:`));
|
|
58328
58347
|
for (const pr2 of replica.pull_requests) {
|
|
58329
|
-
console.log(
|
|
58348
|
+
console.log(import_chalk23.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
58330
58349
|
}
|
|
58331
58350
|
}
|
|
58332
58351
|
console.log();
|
|
@@ -58353,7 +58372,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58353
58372
|
});
|
|
58354
58373
|
const answer = response2.name;
|
|
58355
58374
|
if (!answer) {
|
|
58356
|
-
console.log(
|
|
58375
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58357
58376
|
return;
|
|
58358
58377
|
}
|
|
58359
58378
|
replicaName = answer;
|
|
@@ -58371,7 +58390,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58371
58390
|
});
|
|
58372
58391
|
const answer = response2.environment;
|
|
58373
58392
|
if (!answer) {
|
|
58374
|
-
console.log(
|
|
58393
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58375
58394
|
return;
|
|
58376
58395
|
}
|
|
58377
58396
|
selectedEnvironmentId = answer;
|
|
@@ -58385,7 +58404,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58385
58404
|
});
|
|
58386
58405
|
const answer = response2.message;
|
|
58387
58406
|
if (!answer) {
|
|
58388
|
-
console.log(
|
|
58407
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58389
58408
|
return;
|
|
58390
58409
|
}
|
|
58391
58410
|
message2 = answer;
|
|
@@ -58399,7 +58418,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58399
58418
|
initial: 0
|
|
58400
58419
|
});
|
|
58401
58420
|
if (!response2.agent) {
|
|
58402
|
-
console.log(
|
|
58421
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58403
58422
|
return;
|
|
58404
58423
|
}
|
|
58405
58424
|
codingAgent = parseReplicaAgent(response2.agent);
|
|
@@ -58411,20 +58430,20 @@ async function replicaCreateCommand(name, options) {
|
|
|
58411
58430
|
coding_agent: codingAgent,
|
|
58412
58431
|
lifecycle_policy: "default"
|
|
58413
58432
|
};
|
|
58414
|
-
console.log(
|
|
58433
|
+
console.log(import_chalk23.default.gray("\nCreating replica..."));
|
|
58415
58434
|
const response = await orgAuthenticatedFetch("/v1/replica", {
|
|
58416
58435
|
method: "POST",
|
|
58417
58436
|
body: body2
|
|
58418
58437
|
});
|
|
58419
58438
|
output2(response, ({ replica }) => {
|
|
58420
|
-
console.log(
|
|
58439
|
+
console.log(import_chalk23.default.green(`
|
|
58421
58440
|
Created replica: ${replica.name}`));
|
|
58422
|
-
console.log(
|
|
58423
|
-
console.log(
|
|
58441
|
+
console.log(import_chalk23.default.gray(` ID: ${replica.id}`));
|
|
58442
|
+
console.log(import_chalk23.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
58424
58443
|
if (replica.repositories.length > 0) {
|
|
58425
|
-
console.log(
|
|
58444
|
+
console.log(import_chalk23.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
58426
58445
|
}
|
|
58427
|
-
console.log(
|
|
58446
|
+
console.log(import_chalk23.default.cyan(` Link: ${getWorkspaceDashboardUrl(replica.id, { webAppUrl: process.env.REPLICAS_WEB_URL || DEFAULT_WEB_APP_URL })}`));
|
|
58428
58447
|
console.log();
|
|
58429
58448
|
});
|
|
58430
58449
|
}
|
|
@@ -58440,7 +58459,7 @@ async function replicaSendCommand(id, options) {
|
|
|
58440
58459
|
});
|
|
58441
58460
|
const answer = response2.message;
|
|
58442
58461
|
if (!answer) {
|
|
58443
|
-
console.log(
|
|
58462
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58444
58463
|
return;
|
|
58445
58464
|
}
|
|
58446
58465
|
message2 = answer;
|
|
@@ -58465,14 +58484,14 @@ async function replicaSendCommand(id, options) {
|
|
|
58465
58484
|
}
|
|
58466
58485
|
);
|
|
58467
58486
|
output2(response, (response2) => {
|
|
58468
|
-
const statusColor = response2.status === "sent" ?
|
|
58487
|
+
const statusColor = response2.status === "sent" ? import_chalk23.default.green : import_chalk23.default.yellow;
|
|
58469
58488
|
console.log(statusColor(`
|
|
58470
58489
|
Message ${response2.status}`));
|
|
58471
58490
|
if (response2.chat_id) {
|
|
58472
|
-
console.log(
|
|
58491
|
+
console.log(import_chalk23.default.gray(` Chat: ${response2.chat_id}`));
|
|
58473
58492
|
}
|
|
58474
58493
|
if (response2.position !== void 0 && response2.position > 0) {
|
|
58475
|
-
console.log(
|
|
58494
|
+
console.log(import_chalk23.default.gray(` Queue position: ${response2.position}`));
|
|
58476
58495
|
}
|
|
58477
58496
|
console.log();
|
|
58478
58497
|
});
|
|
@@ -58499,40 +58518,40 @@ async function replicaReadCommand(id, options) {
|
|
|
58499
58518
|
`/v1/replica/${id}/history${query ? "?" + query : ""}`
|
|
58500
58519
|
);
|
|
58501
58520
|
output2(response, (response2) => {
|
|
58502
|
-
console.log(
|
|
58521
|
+
console.log(import_chalk23.default.green(`
|
|
58503
58522
|
Conversation History
|
|
58504
58523
|
`));
|
|
58505
58524
|
if (response2.coding_agent) {
|
|
58506
|
-
console.log(
|
|
58525
|
+
console.log(import_chalk23.default.gray(` Agent: ${response2.coding_agent}`));
|
|
58507
58526
|
}
|
|
58508
58527
|
if (response2.thread_id) {
|
|
58509
|
-
console.log(
|
|
58528
|
+
console.log(import_chalk23.default.gray(` Thread ID: ${response2.thread_id}`));
|
|
58510
58529
|
}
|
|
58511
|
-
console.log(
|
|
58530
|
+
console.log(import_chalk23.default.gray(` Total Events: ${response2.total}`));
|
|
58512
58531
|
if (response2.has_more) {
|
|
58513
58532
|
const previousPage = response2.beforeCursor ? `--before '${response2.beforeCursor}'` : `--before-event ${response2.eventsStartIndex}`;
|
|
58514
|
-
console.log(
|
|
58533
|
+
console.log(import_chalk23.default.gray(` Has More: yes (${previousPage} for the previous page)`));
|
|
58515
58534
|
}
|
|
58516
58535
|
console.log();
|
|
58517
58536
|
if (response2.events.length === 0) {
|
|
58518
|
-
console.log(
|
|
58537
|
+
console.log(import_chalk23.default.yellow(" No events found.\n"));
|
|
58519
58538
|
return;
|
|
58520
58539
|
}
|
|
58521
|
-
console.log(
|
|
58540
|
+
console.log(import_chalk23.default.gray("-".repeat(60)));
|
|
58522
58541
|
const agentType = response2.coding_agent || "claude";
|
|
58523
58542
|
const displayMessages = parseDisplayMessages(response2.events, agentType);
|
|
58524
58543
|
for (const message2 of displayMessages) {
|
|
58525
58544
|
formatDisplayMessage(message2);
|
|
58526
58545
|
}
|
|
58527
|
-
console.log(
|
|
58546
|
+
console.log(import_chalk23.default.gray("\n" + "-".repeat(60)));
|
|
58528
58547
|
console.log();
|
|
58529
58548
|
});
|
|
58530
58549
|
}
|
|
58531
|
-
var
|
|
58550
|
+
var import_chalk23, CLI_CODING_AGENT_LABEL;
|
|
58532
58551
|
var init_replica2 = __esm({
|
|
58533
58552
|
"src/commands/replica.ts"() {
|
|
58534
58553
|
"use strict";
|
|
58535
|
-
|
|
58554
|
+
import_chalk23 = __toESM(require("chalk"));
|
|
58536
58555
|
init_api2();
|
|
58537
58556
|
init_environment3();
|
|
58538
58557
|
init_command_utils();
|
|
@@ -58548,7 +58567,7 @@ async function workspaceRenameCommand(id, name) {
|
|
|
58548
58567
|
method: "PATCH",
|
|
58549
58568
|
body: { name }
|
|
58550
58569
|
});
|
|
58551
|
-
output2(response, ({ workspace }) => console.log(
|
|
58570
|
+
output2(response, ({ workspace }) => console.log(import_chalk24.default.green(`Renamed workspace to ${workspace.name}`)));
|
|
58552
58571
|
}
|
|
58553
58572
|
async function workspaceWakeCommand(id, options) {
|
|
58554
58573
|
await orgAuthenticatedFetch(`/v1/replica/${id}/wake${options.restore ? "?restore=true" : ""}`, { method: "POST" });
|
|
@@ -58558,7 +58577,7 @@ async function workspaceRefreshEnvironmentCommand(id) {
|
|
|
58558
58577
|
const result = await orgAuthenticatedFetch(`/v1/replica/${id}/environment/refresh`, { method: "POST" });
|
|
58559
58578
|
output2(result, ({ status, changes }) => {
|
|
58560
58579
|
console.log(status === "waking" ? `Waking workspace ${id} with its latest environment.` : `Workspace ${id} is up to date with its environment.`);
|
|
58561
|
-
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}`));
|
|
58562
58581
|
});
|
|
58563
58582
|
}
|
|
58564
58583
|
function workspaceLifecycleCommand(action) {
|
|
@@ -58575,7 +58594,7 @@ async function workspaceWaitCommand(id, options) {
|
|
|
58575
58594
|
if (options.chat) query.set("chat_id", options.chat);
|
|
58576
58595
|
const step2 = result?.activity.current_step;
|
|
58577
58596
|
result = await orgAuthenticatedFetch(`/v1/replica/${id}/wait?${query}`);
|
|
58578
|
-
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}`));
|
|
58579
58598
|
} while (!result.done && result.activity.state !== "waiting_for_input" && Date.now() < deadline);
|
|
58580
58599
|
output2(result, ({ done, status, deleted, activity }) => {
|
|
58581
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})`);
|
|
@@ -58587,7 +58606,7 @@ async function workspaceStatusCommand(id) {
|
|
|
58587
58606
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/status`), (status) => {
|
|
58588
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());
|
|
58589
58608
|
console.log(`Status: ${status.status}`);
|
|
58590
|
-
if (status.message || status.error) console.log(
|
|
58609
|
+
if (status.message || status.error) console.log(import_chalk24.default.yellow(status.message || status.error));
|
|
58591
58610
|
const working = agentsWith("Processing");
|
|
58592
58611
|
const awaiting = agentsWith("AwaitingInput");
|
|
58593
58612
|
if (working.length > 0) console.log(`Working: ${working.join(", ")}`);
|
|
@@ -58615,8 +58634,8 @@ async function workspaceExecCommand(id, command, options) {
|
|
|
58615
58634
|
output2(result, () => {
|
|
58616
58635
|
process.stdout.write(result.output.endsWith("\n") || !result.output ? result.output : `${result.output}
|
|
58617
58636
|
`);
|
|
58618
|
-
if (result.truncated) console.error(
|
|
58619
|
-
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."));
|
|
58620
58639
|
});
|
|
58621
58640
|
process.exitCode = result.exit_code ?? 1;
|
|
58622
58641
|
}
|
|
@@ -58631,11 +58650,11 @@ async function workspaceHooksCommand(id) {
|
|
|
58631
58650
|
return;
|
|
58632
58651
|
}
|
|
58633
58652
|
for (const entry of entries) {
|
|
58634
|
-
const result = entry.timedOut ?
|
|
58635
|
-
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(`
|
|
58636
58655
|
[${entry.kind}] ${entry.hookName} (${entry.hookType}) ${result} at ${formatDate(entry.executedAt)}`));
|
|
58637
58656
|
console.log(entry.output.trimEnd());
|
|
58638
|
-
if (entry.outputTruncated) console.log(
|
|
58657
|
+
if (entry.outputTruncated) console.log(import_chalk24.default.gray(`\u2026 truncated (${entry.outputTotalChars} chars total)`));
|
|
58639
58658
|
}
|
|
58640
58659
|
});
|
|
58641
58660
|
}
|
|
@@ -58643,7 +58662,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
58643
58662
|
if (!sessionId) {
|
|
58644
58663
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs`), ({ currentSessionId, sessions }) => {
|
|
58645
58664
|
for (const session of sessions) {
|
|
58646
|
-
const current = session.sessionId === currentSessionId ?
|
|
58665
|
+
const current = session.sessionId === currentSessionId ? import_chalk24.default.green(" (current)") : "";
|
|
58647
58666
|
console.log(`${session.sessionId} ${session.sizeBytes} bytes ${formatDate(session.updatedAt)}${current}`);
|
|
58648
58667
|
}
|
|
58649
58668
|
});
|
|
@@ -58656,7 +58675,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
58656
58675
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs/${sessionId}${query ? `?${query}` : ""}`), (log) => {
|
|
58657
58676
|
console.log(log.lines.join("\n"));
|
|
58658
58677
|
if (log.hasMore) {
|
|
58659
|
-
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}`));
|
|
58660
58679
|
}
|
|
58661
58680
|
});
|
|
58662
58681
|
}
|
|
@@ -58696,16 +58715,16 @@ async function prViewCommand(id, prUrls) {
|
|
|
58696
58715
|
);
|
|
58697
58716
|
output2(response, ({ pullRequests }) => {
|
|
58698
58717
|
for (const { url: url2, details, error: error62 } of pullRequests) {
|
|
58699
|
-
console.log(
|
|
58718
|
+
console.log(import_chalk24.default.bold(`
|
|
58700
58719
|
${url2}`));
|
|
58701
58720
|
if (!details) {
|
|
58702
|
-
console.log(
|
|
58721
|
+
console.log(import_chalk24.default.red(` ${error62 ?? "Details unavailable"}`));
|
|
58703
58722
|
continue;
|
|
58704
58723
|
}
|
|
58705
58724
|
console.log(` ${details.title}`);
|
|
58706
58725
|
console.log(` State: ${details.state} Mergeability: ${details.mergeability} CI: ${details.ciStatus}`);
|
|
58707
58726
|
console.log(` ${details.headBranch} \u2192 ${details.baseBranch} +${details.additions ?? 0} -${details.deletions ?? 0} in ${details.changedFiles} files`);
|
|
58708
|
-
if (details.mergeBlockers?.length) console.log(
|
|
58727
|
+
if (details.mergeBlockers?.length) console.log(import_chalk24.default.yellow(` Blocked by: ${details.mergeBlockers.join(", ").replaceAll("_", " ")}`));
|
|
58709
58728
|
}
|
|
58710
58729
|
});
|
|
58711
58730
|
}
|
|
@@ -58745,14 +58764,14 @@ async function canvasPutCommand(id, filename, options) {
|
|
|
58745
58764
|
{ method: "PUT", body: body2 }
|
|
58746
58765
|
);
|
|
58747
58766
|
if (!result.saved) throw new Error(`${filename} changed while saving; retry`);
|
|
58748
|
-
output2(result, () => console.log(
|
|
58767
|
+
output2(result, () => console.log(import_chalk24.default.green(`Saved ${filename}`)));
|
|
58749
58768
|
}
|
|
58750
|
-
var import_fs6,
|
|
58769
|
+
var import_fs6, import_chalk24, getCanvasFile;
|
|
58751
58770
|
var init_workspace = __esm({
|
|
58752
58771
|
"src/commands/workspace.ts"() {
|
|
58753
58772
|
"use strict";
|
|
58754
58773
|
import_fs6 = __toESM(require("fs"));
|
|
58755
|
-
|
|
58774
|
+
import_chalk24 = __toESM(require("chalk"));
|
|
58756
58775
|
init_src();
|
|
58757
58776
|
init_api2();
|
|
58758
58777
|
init_command_utils();
|
|
@@ -58768,7 +58787,7 @@ function printQueue(queue) {
|
|
|
58768
58787
|
return;
|
|
58769
58788
|
}
|
|
58770
58789
|
queue.forEach((message2, index) => {
|
|
58771
|
-
const steered = message2.steeredAt ?
|
|
58790
|
+
const steered = message2.steeredAt ? import_chalk25.default.cyan(" (steered)") : "";
|
|
58772
58791
|
console.log(`${index} ${message2.id}${steered} ${message2.message.replace(/\s+/g, " ").slice(0, 120)}`);
|
|
58773
58792
|
});
|
|
58774
58793
|
}
|
|
@@ -58778,7 +58797,7 @@ function printGoal({ goal }) {
|
|
|
58778
58797
|
async function chatListCommand(id) {
|
|
58779
58798
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/chats`), ({ chats }) => {
|
|
58780
58799
|
for (const chat2 of chats) {
|
|
58781
|
-
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}`);
|
|
58782
58801
|
}
|
|
58783
58802
|
});
|
|
58784
58803
|
}
|
|
@@ -58801,7 +58820,7 @@ async function chatRestoreCommand(id, chatId) {
|
|
|
58801
58820
|
outputSuccess(`Restored chat ${chatId}`);
|
|
58802
58821
|
}
|
|
58803
58822
|
async function chatInterruptCommand(id, chatId) {
|
|
58804
|
-
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."));
|
|
58805
58824
|
}
|
|
58806
58825
|
async function chatForkCommand(id, chatId, options) {
|
|
58807
58826
|
const provider2 = parseReplicaAgent(options.agent);
|
|
@@ -58832,7 +58851,7 @@ async function chatAnswerCommand(id, chatId, requestId, selectionId) {
|
|
|
58832
58851
|
method: "POST",
|
|
58833
58852
|
body: { requestId, selectionId }
|
|
58834
58853
|
});
|
|
58835
|
-
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.")));
|
|
58836
58855
|
}
|
|
58837
58856
|
async function chatCommandsCommand(id, chatId) {
|
|
58838
58857
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/slash-commands")), ({ commands }) => {
|
|
@@ -58843,7 +58862,7 @@ async function chatCommandsCommand(id, chatId) {
|
|
|
58843
58862
|
}
|
|
58844
58863
|
async function chatQueueListCommand(id, chatId) {
|
|
58845
58864
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/queue")), ({ processing, queue }) => {
|
|
58846
|
-
console.log(
|
|
58865
|
+
console.log(import_chalk25.default.gray(processing ? "Agent is working." : "Agent is idle."));
|
|
58847
58866
|
printQueue(queue);
|
|
58848
58867
|
});
|
|
58849
58868
|
}
|
|
@@ -58853,11 +58872,11 @@ async function mutateQueue(path14, method, body2) {
|
|
|
58853
58872
|
else console.log("Done.");
|
|
58854
58873
|
});
|
|
58855
58874
|
}
|
|
58856
|
-
var
|
|
58875
|
+
var import_chalk25, chatPath2, chatQueueClearCommand, chatQueueRemoveCommand, chatQueueEditCommand, chatQueueMoveCommand, chatQueueActionCommand;
|
|
58857
58876
|
var init_chat = __esm({
|
|
58858
58877
|
"src/commands/chat.ts"() {
|
|
58859
58878
|
"use strict";
|
|
58860
|
-
|
|
58879
|
+
import_chalk25 = __toESM(require("chalk"));
|
|
58861
58880
|
init_src();
|
|
58862
58881
|
init_api2();
|
|
58863
58882
|
init_output();
|
|
@@ -58902,13 +58921,13 @@ async function pluginsDisconnectCommand(pluginId, options) {
|
|
|
58902
58921
|
await pluginsPath(options, `/${pluginId}${options.connection ? `/connections/${options.connection}` : ""}`),
|
|
58903
58922
|
{ method: "DELETE" }
|
|
58904
58923
|
);
|
|
58905
|
-
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`));
|
|
58906
58925
|
}
|
|
58907
|
-
var
|
|
58926
|
+
var import_chalk26, pluginsPath;
|
|
58908
58927
|
var init_plugins3 = __esm({
|
|
58909
58928
|
"src/commands/plugins.ts"() {
|
|
58910
58929
|
"use strict";
|
|
58911
|
-
|
|
58930
|
+
import_chalk26 = __toESM(require("chalk"));
|
|
58912
58931
|
init_api2();
|
|
58913
58932
|
init_command_utils();
|
|
58914
58933
|
init_output();
|
|
@@ -58927,20 +58946,20 @@ async function fetchCurrentRun() {
|
|
|
58927
58946
|
}
|
|
58928
58947
|
async function environmentSetupStatusCommand() {
|
|
58929
58948
|
output2(await fetchCurrentRun(), ({ run: run2, environment: environment2, repositories }) => {
|
|
58930
|
-
console.log(
|
|
58949
|
+
console.log(import_chalk27.default.bold(`
|
|
58931
58950
|
Environment setup: ${environment2.name}
|
|
58932
58951
|
`));
|
|
58933
58952
|
console.log(` Run: ${run2.id}`);
|
|
58934
|
-
console.log(` Status: ${run2.status}${run2.error ?
|
|
58953
|
+
console.log(` Status: ${run2.status}${run2.error ? import_chalk27.default.red(` (${run2.error})`) : ""}`);
|
|
58935
58954
|
console.log(` Environment: ${environment2.id}`);
|
|
58936
58955
|
console.log(` Repositories: ${repositories.map((repo) => `${repo.name} (${repo.default_branch})`).join(", ") || "none"}`);
|
|
58937
58956
|
console.log("\n Steps:");
|
|
58938
58957
|
for (const step2 of ENVIRONMENT_SETUP_STEPS) {
|
|
58939
58958
|
const status = run2.steps[step2.key] ?? "pending";
|
|
58940
|
-
const marker = status === "completed" ?
|
|
58941
|
-
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}]`)}`);
|
|
58942
58961
|
}
|
|
58943
|
-
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"));
|
|
58944
58963
|
});
|
|
58945
58964
|
}
|
|
58946
58965
|
async function environmentSetupStepCommand(key2, status) {
|
|
@@ -58956,7 +58975,7 @@ async function environmentSetupStepCommand(key2, status) {
|
|
|
58956
58975
|
method: "POST",
|
|
58957
58976
|
body: body2
|
|
58958
58977
|
});
|
|
58959
|
-
output2(result, () => console.log(
|
|
58978
|
+
output2(result, () => console.log(import_chalk27.default.green(`
|
|
58960
58979
|
\u2713 ${key2} \u2192 ${status}
|
|
58961
58980
|
`)));
|
|
58962
58981
|
}
|
|
@@ -58975,22 +58994,22 @@ async function environmentSetupProposeCommand(options) {
|
|
|
58975
58994
|
body: { proposal }
|
|
58976
58995
|
});
|
|
58977
58996
|
output2(result, ({ run: { proposal: submitted } }) => {
|
|
58978
|
-
console.log(
|
|
58997
|
+
console.log(import_chalk27.default.green("\n\u2713 Proposal submitted.\n"));
|
|
58979
58998
|
if (submitted) {
|
|
58980
58999
|
console.log(` Automations: ${submitted.automations.length}`);
|
|
58981
59000
|
console.log(` Variables: ${submitted.variables.length}`);
|
|
58982
59001
|
console.log(` Checks: ${submitted.verification.length}`);
|
|
58983
59002
|
console.log(` Media: ${submitted.media.length}`);
|
|
58984
59003
|
}
|
|
58985
|
-
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"));
|
|
58986
59005
|
});
|
|
58987
59006
|
}
|
|
58988
|
-
var import_fs7,
|
|
59007
|
+
var import_fs7, import_chalk27, STEP_KEYS;
|
|
58989
59008
|
var init_environment_setup2 = __esm({
|
|
58990
59009
|
"src/commands/environment-setup.ts"() {
|
|
58991
59010
|
"use strict";
|
|
58992
59011
|
import_fs7 = __toESM(require("fs"));
|
|
58993
|
-
|
|
59012
|
+
import_chalk27 = __toESM(require("chalk"));
|
|
58994
59013
|
init_api2();
|
|
58995
59014
|
init_command_utils();
|
|
58996
59015
|
init_config();
|
|
@@ -59241,41 +59260,41 @@ function resolveSelectableEnvironmentId(envInput, selectableEnvs) {
|
|
|
59241
59260
|
return resolved.id;
|
|
59242
59261
|
}
|
|
59243
59262
|
function printAutomation(automation2) {
|
|
59244
|
-
console.log(
|
|
59245
|
-
console.log(
|
|
59246
|
-
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"}`));
|
|
59247
59266
|
if (automation2.description) {
|
|
59248
|
-
console.log(
|
|
59267
|
+
console.log(import_chalk28.default.gray(` Description: ${automation2.description}`));
|
|
59249
59268
|
}
|
|
59250
|
-
console.log(
|
|
59269
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? import_chalk28.default.green("yes") : import_chalk28.default.red("no")}`));
|
|
59251
59270
|
if (automation2.auto_paused_at) {
|
|
59252
|
-
console.log(
|
|
59271
|
+
console.log(import_chalk28.default.yellow(` ${truncate(formatAutoPause(automation2), 120)}`));
|
|
59253
59272
|
}
|
|
59254
59273
|
if (automation2.triggers.length > 0) {
|
|
59255
|
-
console.log(
|
|
59274
|
+
console.log(import_chalk28.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
59256
59275
|
}
|
|
59257
59276
|
if (automation2.github_check_names.length > 0) {
|
|
59258
|
-
console.log(
|
|
59277
|
+
console.log(import_chalk28.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
59259
59278
|
}
|
|
59260
|
-
console.log(
|
|
59279
|
+
console.log(import_chalk28.default.gray(` Prompt: ${truncate(automation2.prompt, 80)}`));
|
|
59261
59280
|
if (automation2.cron_next_fire_at) {
|
|
59262
|
-
console.log(
|
|
59281
|
+
console.log(import_chalk28.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
59263
59282
|
}
|
|
59264
|
-
console.log(
|
|
59265
|
-
console.log(
|
|
59266
|
-
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"));
|
|
59267
59286
|
if (automation2.workspace_lifecycle_policy && automation2.workspace_lifecycle_policy !== "default") {
|
|
59268
|
-
console.log(
|
|
59287
|
+
console.log(import_chalk28.default.gray(` Lifecycle: ${automation2.workspace_lifecycle_policy}`));
|
|
59269
59288
|
}
|
|
59270
59289
|
if (automation2.agent_provider || automation2.model || automation2.thinking_level) {
|
|
59271
|
-
console.log(
|
|
59290
|
+
console.log(import_chalk28.default.gray(` Agent: ${formatAgentSummary(automation2)}`));
|
|
59272
59291
|
}
|
|
59273
59292
|
if (automation2.goal_mode || automation2.fast_mode) {
|
|
59274
|
-
console.log(
|
|
59293
|
+
console.log(import_chalk28.default.gray(` Modes: ${formatModeSummary(automation2)}`));
|
|
59275
59294
|
}
|
|
59276
|
-
console.log(
|
|
59277
|
-
console.log(
|
|
59278
|
-
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)}`));
|
|
59279
59298
|
console.log();
|
|
59280
59299
|
}
|
|
59281
59300
|
async function resolveCredentialsMember(value) {
|
|
@@ -59305,10 +59324,10 @@ async function automationListCommand(options) {
|
|
|
59305
59324
|
);
|
|
59306
59325
|
output2(response, (response2) => {
|
|
59307
59326
|
if (response2.automations.length === 0) {
|
|
59308
|
-
console.log(
|
|
59327
|
+
console.log(import_chalk28.default.yellow("\nNo automations found.\n"));
|
|
59309
59328
|
return;
|
|
59310
59329
|
}
|
|
59311
|
-
console.log(
|
|
59330
|
+
console.log(import_chalk28.default.green(`
|
|
59312
59331
|
Automations (Page ${response2.page} of ${response2.totalPages}, Total: ${response2.total}):
|
|
59313
59332
|
`));
|
|
59314
59333
|
for (const automation2 of response2.automations) {
|
|
@@ -59320,49 +59339,49 @@ async function automationGetCommand(id) {
|
|
|
59320
59339
|
ensureOrgApiAuthenticated();
|
|
59321
59340
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`);
|
|
59322
59341
|
output2(response.automation, (automation2) => {
|
|
59323
|
-
console.log(
|
|
59342
|
+
console.log(import_chalk28.default.green(`
|
|
59324
59343
|
Automation: ${automation2.name}
|
|
59325
59344
|
`));
|
|
59326
|
-
console.log(
|
|
59345
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59327
59346
|
if (automation2.description) {
|
|
59328
|
-
console.log(
|
|
59347
|
+
console.log(import_chalk28.default.gray(` Description: ${automation2.description}`));
|
|
59329
59348
|
}
|
|
59330
|
-
console.log(
|
|
59349
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? import_chalk28.default.green("yes") : import_chalk28.default.red("no")}`));
|
|
59331
59350
|
if (automation2.auto_paused_at) {
|
|
59332
|
-
console.log(
|
|
59351
|
+
console.log(import_chalk28.default.yellow(` ${formatAutoPause(automation2)}`));
|
|
59333
59352
|
}
|
|
59334
59353
|
if (automation2.triggers.length > 0) {
|
|
59335
|
-
console.log(
|
|
59354
|
+
console.log(import_chalk28.default.gray(` Triggers:`));
|
|
59336
59355
|
for (const trigger of automation2.triggers) {
|
|
59337
|
-
console.log(
|
|
59356
|
+
console.log(import_chalk28.default.gray(` - ${formatTrigger(trigger)}`));
|
|
59338
59357
|
}
|
|
59339
59358
|
}
|
|
59340
59359
|
if (automation2.github_check_names.length > 0) {
|
|
59341
|
-
console.log(
|
|
59360
|
+
console.log(import_chalk28.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
59342
59361
|
}
|
|
59343
|
-
console.log(
|
|
59344
|
-
console.log(
|
|
59362
|
+
console.log(import_chalk28.default.gray(` Prompt: ${automation2.prompt}`));
|
|
59363
|
+
console.log(import_chalk28.default.gray(` Environment: ${automation2.environment_id}`));
|
|
59345
59364
|
if (automation2.cron_next_fire_at) {
|
|
59346
|
-
console.log(
|
|
59365
|
+
console.log(import_chalk28.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
59347
59366
|
}
|
|
59348
|
-
console.log(
|
|
59349
|
-
console.log(
|
|
59350
|
-
console.log(
|
|
59351
|
-
if (automation2.credential_user_id) console.log(
|
|
59352
|
-
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)" : ""}`));
|
|
59353
59372
|
if (automation2.workspace_lifecycle_policy) {
|
|
59354
|
-
console.log(
|
|
59373
|
+
console.log(import_chalk28.default.gray(` Lifecycle Policy: ${automation2.workspace_lifecycle_policy}`));
|
|
59355
59374
|
}
|
|
59356
59375
|
if (automation2.workspace_auto_stop_minutes) {
|
|
59357
|
-
console.log(
|
|
59358
|
-
}
|
|
59359
|
-
console.log(
|
|
59360
|
-
console.log(
|
|
59361
|
-
console.log(
|
|
59362
|
-
console.log(
|
|
59363
|
-
console.log(
|
|
59364
|
-
console.log(
|
|
59365
|
-
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)}`));
|
|
59366
59385
|
console.log();
|
|
59367
59386
|
});
|
|
59368
59387
|
}
|
|
@@ -59534,7 +59553,7 @@ async function automationCreateCommand(name, options) {
|
|
|
59534
59553
|
});
|
|
59535
59554
|
const answer = response2.name;
|
|
59536
59555
|
if (!answer) {
|
|
59537
|
-
console.log(
|
|
59556
|
+
console.log(import_chalk28.default.yellow("\nCancelled."));
|
|
59538
59557
|
return;
|
|
59539
59558
|
}
|
|
59540
59559
|
automationName = answer;
|
|
@@ -59549,7 +59568,7 @@ async function automationCreateCommand(name, options) {
|
|
|
59549
59568
|
});
|
|
59550
59569
|
const answer = response2.prompt;
|
|
59551
59570
|
if (!answer) {
|
|
59552
|
-
console.log(
|
|
59571
|
+
console.log(import_chalk28.default.yellow("\nCancelled."));
|
|
59553
59572
|
return;
|
|
59554
59573
|
}
|
|
59555
59574
|
automationPrompt = answer;
|
|
@@ -59571,7 +59590,7 @@ async function automationCreateCommand(name, options) {
|
|
|
59571
59590
|
}))
|
|
59572
59591
|
});
|
|
59573
59592
|
if (!envResponse2.env) {
|
|
59574
|
-
console.log(
|
|
59593
|
+
console.log(import_chalk28.default.yellow("\nCancelled."));
|
|
59575
59594
|
return;
|
|
59576
59595
|
}
|
|
59577
59596
|
selectedEnvironmentId = envResponse2.env;
|
|
@@ -59612,25 +59631,25 @@ async function automationCreateCommand(name, options) {
|
|
|
59612
59631
|
...options.fastMode ? { fast_mode: true } : {},
|
|
59613
59632
|
...agentSelection
|
|
59614
59633
|
};
|
|
59615
|
-
console.log(
|
|
59634
|
+
console.log(import_chalk28.default.gray("\nCreating automation..."));
|
|
59616
59635
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
59617
59636
|
method: "POST",
|
|
59618
59637
|
body: body2
|
|
59619
59638
|
});
|
|
59620
59639
|
output2(response.automation, (automation2) => {
|
|
59621
|
-
console.log(
|
|
59640
|
+
console.log(import_chalk28.default.green(`
|
|
59622
59641
|
Created automation: ${automation2.name}`));
|
|
59623
|
-
console.log(
|
|
59624
|
-
console.log(
|
|
59642
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59643
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
59625
59644
|
if (automation2.triggers.length > 0) {
|
|
59626
|
-
console.log(
|
|
59645
|
+
console.log(import_chalk28.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
59627
59646
|
}
|
|
59628
59647
|
if (automation2.cron_next_fire_at) {
|
|
59629
|
-
console.log(
|
|
59648
|
+
console.log(import_chalk28.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)} (${automation2.cron_next_fire_at})`));
|
|
59630
59649
|
}
|
|
59631
|
-
console.log(
|
|
59632
|
-
console.log(
|
|
59633
|
-
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"}`));
|
|
59634
59653
|
console.log();
|
|
59635
59654
|
});
|
|
59636
59655
|
}
|
|
@@ -59786,21 +59805,21 @@ async function automationEditCommand(id, options) {
|
|
|
59786
59805
|
Object.assign(body2, agentSelection);
|
|
59787
59806
|
}
|
|
59788
59807
|
if (Object.keys(body2).length === 0) {
|
|
59789
|
-
output2(existing.automation, () => console.log(
|
|
59808
|
+
output2(existing.automation, () => console.log(import_chalk28.default.yellow("\nNo changes made.\n")));
|
|
59790
59809
|
return;
|
|
59791
59810
|
}
|
|
59792
|
-
console.log(
|
|
59811
|
+
console.log(import_chalk28.default.gray("\nUpdating automation..."));
|
|
59793
59812
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`, {
|
|
59794
59813
|
method: "PATCH",
|
|
59795
59814
|
body: body2
|
|
59796
59815
|
});
|
|
59797
59816
|
output2(response.automation, (automation2) => {
|
|
59798
|
-
console.log(
|
|
59817
|
+
console.log(import_chalk28.default.green(`
|
|
59799
59818
|
Updated automation: ${automation2.name}`));
|
|
59800
|
-
console.log(
|
|
59801
|
-
console.log(
|
|
59819
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59820
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
59802
59821
|
if (automation2.triggers.length > 0) {
|
|
59803
|
-
console.log(
|
|
59822
|
+
console.log(import_chalk28.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
59804
59823
|
}
|
|
59805
59824
|
console.log();
|
|
59806
59825
|
});
|
|
@@ -59812,7 +59831,7 @@ async function automationRunCommand(id) {
|
|
|
59812
59831
|
if (!hasCronTrigger(automation2.triggers)) {
|
|
59813
59832
|
throw new Error(`Manual run is only allowed for automations with a cron trigger. This automation has triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`);
|
|
59814
59833
|
}
|
|
59815
|
-
console.log(
|
|
59834
|
+
console.log(import_chalk28.default.gray(`
|
|
59816
59835
|
Triggering automation "${automation2.name}"...`));
|
|
59817
59836
|
const response = await orgAuthenticatedFetch(
|
|
59818
59837
|
`/v1/automations/${id}/trigger`,
|
|
@@ -59823,11 +59842,11 @@ Triggering automation "${automation2.name}"...`));
|
|
|
59823
59842
|
);
|
|
59824
59843
|
if (!response.execution_id) throw new Error("Automation trigger returned no execution ID. The automation may not have started.");
|
|
59825
59844
|
output2(response, (response2) => {
|
|
59826
|
-
console.log(
|
|
59845
|
+
console.log(import_chalk28.default.green(`
|
|
59827
59846
|
Automation triggered successfully.`));
|
|
59828
|
-
console.log(
|
|
59847
|
+
console.log(import_chalk28.default.gray(` Execution ID: ${response2.execution_id}`));
|
|
59829
59848
|
if (response2.workspace_id) {
|
|
59830
|
-
console.log(
|
|
59849
|
+
console.log(import_chalk28.default.gray(` Workspace ID: ${response2.workspace_id}`));
|
|
59831
59850
|
}
|
|
59832
59851
|
console.log();
|
|
59833
59852
|
});
|
|
@@ -59861,9 +59880,9 @@ async function automationCheckCommand(checkRunId, options) {
|
|
|
59861
59880
|
`/v1/automations/checks/${id}`,
|
|
59862
59881
|
{ method: "POST", body: body2 }
|
|
59863
59882
|
);
|
|
59864
|
-
output2(response, (response2) => console.log(response2.reported ?
|
|
59883
|
+
output2(response, (response2) => console.log(response2.reported ? import_chalk28.default.green(`
|
|
59865
59884
|
Reported ${conclusion} for "${response2.name}".
|
|
59866
|
-
`) :
|
|
59885
|
+
`) : import_chalk28.default.yellow(`
|
|
59867
59886
|
Skipped "${response2.name}" \u2014 a newer run of this automation owns it and will report the verdict.
|
|
59868
59887
|
`)));
|
|
59869
59888
|
}
|
|
@@ -59879,7 +59898,7 @@ async function automationExecutionsCommand(id, options) {
|
|
|
59879
59898
|
for (const execution of response2.executions) {
|
|
59880
59899
|
console.log(`${execution.id} ${execution.status} ${formatDate(execution.triggered_at)} ${execution.workspace_id ?? "-"}${execution.error ? ` ${execution.error}` : ""}`);
|
|
59881
59900
|
}
|
|
59882
|
-
console.log(
|
|
59901
|
+
console.log(import_chalk28.default.gray(`Page ${response2.page} of ${response2.totalPages} (${response2.total} runs)`));
|
|
59883
59902
|
});
|
|
59884
59903
|
}
|
|
59885
59904
|
async function automationRetryCommand(id, executionId) {
|
|
@@ -59887,13 +59906,13 @@ async function automationRetryCommand(id, executionId) {
|
|
|
59887
59906
|
`/v1/automations/${id}/executions/${executionId}/retry`,
|
|
59888
59907
|
{ method: "POST" }
|
|
59889
59908
|
);
|
|
59890
|
-
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}` : ""}`)));
|
|
59891
59910
|
}
|
|
59892
|
-
var
|
|
59911
|
+
var import_chalk28, DURATION_UNIT_MS;
|
|
59893
59912
|
var init_automation = __esm({
|
|
59894
59913
|
"src/commands/automation.ts"() {
|
|
59895
59914
|
"use strict";
|
|
59896
|
-
|
|
59915
|
+
import_chalk28 = __toESM(require("chalk"));
|
|
59897
59916
|
init_output();
|
|
59898
59917
|
init_api2();
|
|
59899
59918
|
init_config();
|
|
@@ -60013,9 +60032,9 @@ async function previewListCommand(workspaceId) {
|
|
|
60013
60032
|
`/v1/replica/${workspaceId}/previews`
|
|
60014
60033
|
);
|
|
60015
60034
|
output2(result, ({ previews }) => {
|
|
60016
|
-
if (previews.length === 0) console.log(
|
|
60035
|
+
if (previews.length === 0) console.log(import_chalk29.default.dim("No active previews"));
|
|
60017
60036
|
for (const preview2 of previews) {
|
|
60018
|
-
console.log(` ${
|
|
60037
|
+
console.log(` ${import_chalk29.default.cyan(String(preview2.port))} \u2192 ${import_chalk29.default.underline(preview2.publicUrl)}`);
|
|
60019
60038
|
}
|
|
60020
60039
|
});
|
|
60021
60040
|
}
|
|
@@ -60029,7 +60048,7 @@ async function previewAddCommand(workspaceId, options) {
|
|
|
60029
60048
|
body: { port: portNum, authenticated: options.authenticated ?? false }
|
|
60030
60049
|
}
|
|
60031
60050
|
);
|
|
60032
|
-
output2(result, ({ preview: preview2 }) => console.log(
|
|
60051
|
+
output2(result, ({ preview: preview2 }) => console.log(import_chalk29.default.green(`Preview created: ${preview2.publicUrl}`)));
|
|
60033
60052
|
}
|
|
60034
60053
|
async function previewDeleteCommand(port2) {
|
|
60035
60054
|
const portNum = parsePreviewPort(port2);
|
|
@@ -60044,11 +60063,11 @@ async function previewRemoveCommand(workspaceId, options) {
|
|
|
60044
60063
|
);
|
|
60045
60064
|
outputSuccess(`Preview deleted on port ${portNum}`);
|
|
60046
60065
|
}
|
|
60047
|
-
var
|
|
60066
|
+
var import_chalk29, parsePreviewPort;
|
|
60048
60067
|
var init_preview = __esm({
|
|
60049
60068
|
"src/commands/preview.ts"() {
|
|
60050
60069
|
"use strict";
|
|
60051
|
-
|
|
60070
|
+
import_chalk29 = __toESM(require("chalk"));
|
|
60052
60071
|
init_config();
|
|
60053
60072
|
init_agent_api();
|
|
60054
60073
|
init_api2();
|
|
@@ -60539,7 +60558,7 @@ async function callIssueTool(name, args, schema, printHuman) {
|
|
|
60539
60558
|
const report = createIssueContractReport();
|
|
60540
60559
|
const parsed = parseIssueContractResponse(schema, isRecord(response) ? body2 : response, report);
|
|
60541
60560
|
if (parsed === void 0) throw new Error(`Unexpected response from the server: ${[...report.problems].join("; ")}`);
|
|
60542
|
-
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("; ")}`));
|
|
60543
60562
|
const actors = issueActorDirectorySchema.catch({}).parse(directory);
|
|
60544
60563
|
output2(mapIssueActors(parsed, { actor: (who) => issueActorHandle(who, actors), text: (text5) => renderIssueMentions(text5, actors) }), () => printHuman(parsed, actors));
|
|
60545
60564
|
}
|
|
@@ -60579,14 +60598,14 @@ async function issueUpdateCommand(issue3, options) {
|
|
|
60579
60598
|
async function issueViewCommand(issue3) {
|
|
60580
60599
|
await callIssueTool(ISSUE_COMMANDS.get, { issue: issue3 }, issueDetailResponseSchema, (detail, actors) => {
|
|
60581
60600
|
const name = (actor) => formatIssueActor(actor, actors);
|
|
60582
|
-
console.log(`${
|
|
60583
|
-
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}`));
|
|
60584
60603
|
const assignees = detail.subscribers.filter((subscriber) => subscriber.role === "assignee");
|
|
60585
|
-
if (assignees.length) console.log(
|
|
60604
|
+
if (assignees.length) console.log(import_chalk30.default.dim(`Assignees: ${assignees.map((a) => name(a.subscriber)).join(", ")}`));
|
|
60586
60605
|
if (detail.issue.description) console.log(`
|
|
60587
60606
|
${renderIssueMentions(detail.issue.description, actors)}`);
|
|
60588
60607
|
for (const pr2 of detail.pull_requests) console.log(`
|
|
60589
|
-
${
|
|
60608
|
+
${import_chalk30.default.magenta("PR")} ${pr2.url} (${pr2.state})`);
|
|
60590
60609
|
const issueById = new Map([detail.issue, ...detail.sub_issues, ...detail.related_issues ?? []].map((related) => [related.id, related]));
|
|
60591
60610
|
const identifierOf = (id) => issueById.get(id)?.identifier ?? (detail.related_issues ? "a deleted issue" : id);
|
|
60592
60611
|
const links = [
|
|
@@ -60599,21 +60618,21 @@ ${import_chalk29.default.magenta("PR")} ${pr2.url} (${pr2.state})`);
|
|
|
60599
60618
|
];
|
|
60600
60619
|
const linkLines = links.map(({ label, id }) => {
|
|
60601
60620
|
const related = issueById.get(id);
|
|
60602
|
-
return `${
|
|
60621
|
+
return `${import_chalk30.default.dim(label.padEnd(13))} ${related ? issueLine(related) : import_chalk30.default.dim(identifierOf(id))}`;
|
|
60603
60622
|
});
|
|
60604
60623
|
if (linkLines.length) console.log(`
|
|
60605
60624
|
${linkLines.join("\n")}`);
|
|
60606
60625
|
for (const comment of detail.comments) {
|
|
60607
60626
|
console.log(`
|
|
60608
|
-
${
|
|
60627
|
+
${import_chalk30.default.dim(`\u2014 ${name(comment.author)}, ${comment.created_at}`)}
|
|
60609
60628
|
${renderIssueMentions(comment.body, actors)}`);
|
|
60610
60629
|
}
|
|
60611
60630
|
const activity = detail.events.flatMap((event) => {
|
|
60612
60631
|
const change2 = describeIssueEvent(event, name, identifierOf);
|
|
60613
|
-
return change2 ? [`${
|
|
60632
|
+
return change2 ? [`${import_chalk30.default.dim(event.created_at)} ${name(event.actor)} ${change2}`] : [];
|
|
60614
60633
|
});
|
|
60615
60634
|
if (activity.length) console.log(`
|
|
60616
|
-
${
|
|
60635
|
+
${import_chalk30.default.bold("Activity")}
|
|
60617
60636
|
${activity.join("\n")}`);
|
|
60618
60637
|
});
|
|
60619
60638
|
}
|
|
@@ -60628,38 +60647,38 @@ async function issueListCommand(options) {
|
|
|
60628
60647
|
include_archived: options.archived,
|
|
60629
60648
|
limit: options.limit ? Number(options.limit) : void 0
|
|
60630
60649
|
}, listIssuesResponseSchema, ({ issues, next_cursor }) => {
|
|
60631
|
-
if (issues.length === 0) console.log(
|
|
60650
|
+
if (issues.length === 0) console.log(import_chalk30.default.dim("No issues"));
|
|
60632
60651
|
issues.forEach((issue3) => console.log(issueLine(issue3)));
|
|
60633
|
-
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."));
|
|
60634
60653
|
});
|
|
60635
60654
|
}
|
|
60636
60655
|
async function issueCommentCommand(issue3, body2, options) {
|
|
60637
60656
|
const text5 = readText2(body2, options.file, "file") ?? "";
|
|
60638
60657
|
const media_ids = await uploadAttachments(options.attach);
|
|
60639
60658
|
if (!text5.trim() && !media_ids) throw new Error("Pass the comment text, --file, or --attach");
|
|
60640
|
-
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}`));
|
|
60641
60660
|
}
|
|
60642
60661
|
function issueActorCommand(tool, done) {
|
|
60643
60662
|
return async (issue3, who) => {
|
|
60644
|
-
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}`));
|
|
60645
60664
|
};
|
|
60646
60665
|
}
|
|
60647
60666
|
async function issueLinkPrCommand(issue3, url2) {
|
|
60648
|
-
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}`));
|
|
60649
60668
|
}
|
|
60650
60669
|
async function issueUnlinkPrCommand(issue3, url2) {
|
|
60651
|
-
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}`));
|
|
60652
60671
|
}
|
|
60653
60672
|
async function issueRelateCommand(issue3, type, related) {
|
|
60654
|
-
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}`));
|
|
60655
60674
|
}
|
|
60656
|
-
var import_node_fs2, import_node_path2,
|
|
60675
|
+
var import_node_fs2, import_node_path2, import_chalk30, mutationSchema, noData, csv, issueLine, printMutation;
|
|
60657
60676
|
var init_issue = __esm({
|
|
60658
60677
|
"src/commands/issue.ts"() {
|
|
60659
60678
|
"use strict";
|
|
60660
60679
|
import_node_fs2 = __toESM(require("fs"));
|
|
60661
60680
|
import_node_path2 = __toESM(require("path"));
|
|
60662
|
-
|
|
60681
|
+
import_chalk30 = __toESM(require("chalk"));
|
|
60663
60682
|
init_zod();
|
|
60664
60683
|
init_src();
|
|
60665
60684
|
init_api2();
|
|
@@ -60669,8 +60688,8 @@ var init_issue = __esm({
|
|
|
60669
60688
|
mutationSchema = external_exports.object({ issue: issueSchema });
|
|
60670
60689
|
noData = external_exports.looseObject({});
|
|
60671
60690
|
csv = (value) => value?.split(",").map((entry) => entry.trim()).filter(Boolean).join(",");
|
|
60672
|
-
issueLine = (issue3) => `${
|
|
60673
|
-
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})`);
|
|
60674
60693
|
}
|
|
60675
60694
|
});
|
|
60676
60695
|
|
|
@@ -61028,10 +61047,10 @@ function parseEnv(values) {
|
|
|
61028
61047
|
return values?.length ? parseKeyValuePairs(values) : void 0;
|
|
61029
61048
|
}
|
|
61030
61049
|
function describe3(sandbox) {
|
|
61031
|
-
console.log(`${
|
|
61032
|
-
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()}`));
|
|
61033
61052
|
for (const tunnel of sandbox.tunnels) console.log(` port ${tunnel.port}: ${tunnel.url}`);
|
|
61034
|
-
if (sandbox.error) console.log(
|
|
61053
|
+
if (sandbox.error) console.log(import_chalk31.default.red(` ${sandbox.error}`));
|
|
61035
61054
|
}
|
|
61036
61055
|
async function listSandboxes(kind) {
|
|
61037
61056
|
const { sandboxes } = await agentFetch(BASE);
|
|
@@ -61058,7 +61077,7 @@ async function createSandbox(kind, options) {
|
|
|
61058
61077
|
let { sandbox } = await agentFetch(BASE, { method: "POST", body: request2 });
|
|
61059
61078
|
if (options.wait === false) return sandbox;
|
|
61060
61079
|
const label = COMPUTE_SANDBOX_LABELS[kind];
|
|
61061
|
-
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)...
|
|
61062
61081
|
` : `Starting ${label} ${sandbox.id}...
|
|
61063
61082
|
`));
|
|
61064
61083
|
const deadline = Date.now() + CREATE_WAIT_TIMEOUT_MS;
|
|
@@ -61125,8 +61144,8 @@ function computeExecCommand(kind) {
|
|
|
61125
61144
|
if (options.detach) {
|
|
61126
61145
|
const { jobId } = await agentFetch(path14, execRequest(command.join(" "), options));
|
|
61127
61146
|
output2({ jobId, sandboxId }, () => {
|
|
61128
|
-
console.log(`Started job ${
|
|
61129
|
-
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`));
|
|
61130
61149
|
});
|
|
61131
61150
|
return;
|
|
61132
61151
|
}
|
|
@@ -61147,13 +61166,13 @@ async function gpuLogsCommand(jobId, options) {
|
|
|
61147
61166
|
return;
|
|
61148
61167
|
}
|
|
61149
61168
|
if (exitCode === null) {
|
|
61150
|
-
process.stderr.write(
|
|
61169
|
+
process.stderr.write(import_chalk31.default.gray(`
|
|
61151
61170
|
Job ${jobId} is still running.
|
|
61152
61171
|
`));
|
|
61153
61172
|
return;
|
|
61154
61173
|
}
|
|
61155
61174
|
if (options.follow) process.exitCode = exitCode;
|
|
61156
|
-
process.stderr.write(
|
|
61175
|
+
process.stderr.write(import_chalk31.default.gray(`
|
|
61157
61176
|
Job ${jobId} exited with code ${exitCode}.
|
|
61158
61177
|
`));
|
|
61159
61178
|
}
|
|
@@ -61267,7 +61286,7 @@ function computeRunCommand(kind) {
|
|
|
61267
61286
|
const sandbox = await createSandbox(kind, { ...createOptions, wait: true });
|
|
61268
61287
|
const workdir = COMPUTE_SANDBOX_WORKDIRS[kind];
|
|
61269
61288
|
try {
|
|
61270
|
-
process.stderr.write(
|
|
61289
|
+
process.stderr.write(import_chalk31.default.gray(`Copying ${process.cwd()} to ${workdir}...
|
|
61271
61290
|
`));
|
|
61272
61291
|
await push(sandbox.id, ".", workdir);
|
|
61273
61292
|
const exitCode = await streamOutput(await agentRequest(`${BASE}/${sandbox.id}/exec`, execRequest(command.join(" "), { env })));
|
|
@@ -61278,17 +61297,17 @@ function computeRunCommand(kind) {
|
|
|
61278
61297
|
if (isJsonMode()) output2({ sandboxId: sandbox.id, exitCode }, () => {
|
|
61279
61298
|
});
|
|
61280
61299
|
} finally {
|
|
61281
|
-
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.
|
|
61282
61301
|
`));
|
|
61283
61302
|
else await agentRequest(`${BASE}/${sandbox.id}`, { method: "DELETE" });
|
|
61284
61303
|
}
|
|
61285
61304
|
};
|
|
61286
61305
|
}
|
|
61287
|
-
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;
|
|
61288
61307
|
var init_compute2 = __esm({
|
|
61289
61308
|
"src/commands/compute.ts"() {
|
|
61290
61309
|
"use strict";
|
|
61291
|
-
|
|
61310
|
+
import_chalk31 = __toESM(require("chalk"));
|
|
61292
61311
|
import_node_child_process2 = require("child_process");
|
|
61293
61312
|
import_node_crypto2 = require("crypto");
|
|
61294
61313
|
import_node_fs3 = require("fs");
|
|
@@ -61323,8 +61342,8 @@ function printSource({ source }) {
|
|
|
61323
61342
|
console.log(`Managed skills: ${source.managed.skills?.join(", ") || "(none)"}`);
|
|
61324
61343
|
if (source.required_plugins?.length) console.log(`Required plugins: ${source.required_plugins.join(", ")}`);
|
|
61325
61344
|
if (source.required_secrets.length) console.log(`Required secrets: ${source.required_secrets.join(", ")}`);
|
|
61326
|
-
if (source.pending_rebuild) console.log(
|
|
61327
|
-
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));
|
|
61328
61347
|
}
|
|
61329
61348
|
function printPreview({ preview: preview2 }) {
|
|
61330
61349
|
console.log(preview2.kind === "file" ? `${preview2.filename} @ ${preview2.file_sha}` : `${preview2.repository_name}/${preview2.filename} @ ${preview2.commit_sha}`);
|
|
@@ -61333,14 +61352,14 @@ function printPreview({ preview: preview2 }) {
|
|
|
61333
61352
|
const requiredAfter = preview2.required_secrets?.after ?? [];
|
|
61334
61353
|
const addedSecrets = requiredAfter.filter((key2) => !requiredBefore.includes(key2));
|
|
61335
61354
|
const removedSecrets = requiredBefore.filter((key2) => !requiredAfter.includes(key2));
|
|
61336
|
-
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."));
|
|
61337
61356
|
if (!preview2.changes.length && !addedSecrets.length && !removedSecrets.length) console.log("No setting changes. Applying records this configuration.");
|
|
61338
61357
|
else console.log("Proposed changes (not applied):");
|
|
61339
61358
|
for (const change2 of preview2.changes) console.log(` ${change2.kind === "plugin" ? change2.operation === "remove" ? "stop requiring" : "require" : change2.operation}: ${change2.kind} ${change2.key}`);
|
|
61340
61359
|
for (const key2 of addedSecrets) console.log(` require: secret ${key2}`);
|
|
61341
61360
|
for (const key2 of removedSecrets) console.log(` stop requiring: secret ${key2}`);
|
|
61342
|
-
if (preview2.missing_secrets.length) console.log(
|
|
61343
|
-
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}`));
|
|
61344
61363
|
}
|
|
61345
61364
|
async function readConfigFile(filename) {
|
|
61346
61365
|
let content;
|
|
@@ -61418,11 +61437,11 @@ async function environmentConfigDisconnectCommand(environment2, options) {
|
|
|
61418
61437
|
console.log("Configuration source disconnected. Current settings preserved.");
|
|
61419
61438
|
});
|
|
61420
61439
|
}
|
|
61421
|
-
var
|
|
61440
|
+
var import_chalk32, import_promises2, import_node_path4;
|
|
61422
61441
|
var init_environment_config2 = __esm({
|
|
61423
61442
|
"src/commands/environment-config.ts"() {
|
|
61424
61443
|
"use strict";
|
|
61425
|
-
|
|
61444
|
+
import_chalk32 = __toESM(require("chalk"));
|
|
61426
61445
|
import_promises2 = require("fs/promises");
|
|
61427
61446
|
import_node_path4 = require("path");
|
|
61428
61447
|
init_src();
|
|
@@ -61477,12 +61496,12 @@ async function skillsSuggestCommand(file2, options) {
|
|
|
61477
61496
|
async function skillsListCommand() {
|
|
61478
61497
|
output2(await orgAuthenticatedFetch("/v1/learned-skills"), ({ skills: skills2, suggestions }) => {
|
|
61479
61498
|
for (const skill of skills2) console.log(`${skill.id} ${skill.name} ${skill.title}`);
|
|
61480
|
-
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.`));
|
|
61481
61500
|
});
|
|
61482
61501
|
}
|
|
61483
61502
|
async function skillsCreateCommand(file2, options) {
|
|
61484
61503
|
const body2 = { content: (0, import_node_fs5.readFileSync)(file2, "utf-8"), title: options.title };
|
|
61485
|
-
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})`)));
|
|
61486
61505
|
}
|
|
61487
61506
|
async function skillsUpdateCommand(id, options) {
|
|
61488
61507
|
const { skills: skills2 } = await orgAuthenticatedFetch("/v1/learned-skills");
|
|
@@ -61492,18 +61511,18 @@ async function skillsUpdateCommand(id, options) {
|
|
|
61492
61511
|
title: options.title ?? existing.title,
|
|
61493
61512
|
content: options.file ? (0, import_node_fs5.readFileSync)(options.file, "utf-8") : existing.content
|
|
61494
61513
|
};
|
|
61495
|
-
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}'`)));
|
|
61496
61515
|
}
|
|
61497
61516
|
async function skillsDeleteCommand(id) {
|
|
61498
61517
|
await orgAuthenticatedFetch(`/v1/learned-skills/${id}`, { method: "DELETE" });
|
|
61499
61518
|
outputSuccess(`Deleted learning ${id}`);
|
|
61500
61519
|
}
|
|
61501
|
-
var import_node_fs5,
|
|
61520
|
+
var import_node_fs5, import_chalk33;
|
|
61502
61521
|
var init_skills = __esm({
|
|
61503
61522
|
"src/commands/skills.ts"() {
|
|
61504
61523
|
"use strict";
|
|
61505
61524
|
import_node_fs5 = require("fs");
|
|
61506
|
-
|
|
61525
|
+
import_chalk33 = __toESM(require("chalk"));
|
|
61507
61526
|
init_agent_api();
|
|
61508
61527
|
init_api2();
|
|
61509
61528
|
init_monolith_url();
|
|
@@ -61529,10 +61548,10 @@ async function attachThread(request2) {
|
|
|
61529
61548
|
body: request2
|
|
61530
61549
|
});
|
|
61531
61550
|
output2(response, ({ thread, workspace }) => {
|
|
61532
|
-
console.log(
|
|
61533
|
-
console.log(
|
|
61534
|
-
console.log(
|
|
61535
|
-
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})`));
|
|
61536
61555
|
});
|
|
61537
61556
|
}
|
|
61538
61557
|
async function slackThreadAttachCommand(options) {
|
|
@@ -61560,11 +61579,11 @@ async function slackThreadSwitchCommand(workspace, options) {
|
|
|
61560
61579
|
workspace_id: workspaceId
|
|
61561
61580
|
});
|
|
61562
61581
|
}
|
|
61563
|
-
var
|
|
61582
|
+
var import_chalk34;
|
|
61564
61583
|
var init_slack4 = __esm({
|
|
61565
61584
|
"src/commands/slack.ts"() {
|
|
61566
61585
|
"use strict";
|
|
61567
|
-
|
|
61586
|
+
import_chalk34 = __toESM(require("chalk"));
|
|
61568
61587
|
init_api2();
|
|
61569
61588
|
init_config();
|
|
61570
61589
|
init_output();
|
|
@@ -61728,7 +61747,7 @@ async function serviceListCommand() {
|
|
|
61728
61747
|
return;
|
|
61729
61748
|
}
|
|
61730
61749
|
for (const service of services) {
|
|
61731
|
-
const status = service.running ?
|
|
61750
|
+
const status = service.running ? import_chalk35.default.green("running") : import_chalk35.default.red("stopped");
|
|
61732
61751
|
console.log(`${service.name} ${status} pid ${service.pid} started ${service.startedAt}`);
|
|
61733
61752
|
console.log(` command: ${service.command} (cwd: ${service.cwd})`);
|
|
61734
61753
|
console.log(` logs: ${service.logFile}`);
|
|
@@ -61748,11 +61767,11 @@ async function serviceLogsCommand(name, options) {
|
|
|
61748
61767
|
console.log(logs || "(no log output yet)");
|
|
61749
61768
|
});
|
|
61750
61769
|
}
|
|
61751
|
-
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;
|
|
61752
61771
|
var init_service = __esm({
|
|
61753
61772
|
"src/commands/service.ts"() {
|
|
61754
61773
|
"use strict";
|
|
61755
|
-
|
|
61774
|
+
import_chalk35 = __toESM(require("chalk"));
|
|
61756
61775
|
import_node_child_process3 = require("child_process");
|
|
61757
61776
|
import_node_fs6 = require("fs");
|
|
61758
61777
|
import_node_os3 = require("os");
|
|
@@ -61810,7 +61829,7 @@ async function deviceConnectCommand() {
|
|
|
61810
61829
|
stream.destroy();
|
|
61811
61830
|
};
|
|
61812
61831
|
sshd.once("error", (error62) => {
|
|
61813
|
-
console.log(
|
|
61832
|
+
console.log(import_chalk36.default.yellow(`A workspace couldn't reach SSH on port ${port2} here (${error62.message}). ${REMOTE_LOGIN_HINT}`));
|
|
61814
61833
|
});
|
|
61815
61834
|
sshd.on("error", close).on("close", close);
|
|
61816
61835
|
stream.on("error", close).on("close", close);
|
|
@@ -61854,16 +61873,16 @@ async function deviceConnectCommand() {
|
|
|
61854
61873
|
}
|
|
61855
61874
|
}
|
|
61856
61875
|
const next = problem ?? `\u2713 ${device?.name}: ready for ${waiting.size} ${waiting.size === 1 ? "workspace" : "workspaces"}, forwarding to SSH on port ${port2}`;
|
|
61857
|
-
if (next !== summary) console.log(problem ?
|
|
61876
|
+
if (next !== summary) console.log(problem ? import_chalk36.default.yellow(next) : import_chalk36.default.green(next));
|
|
61858
61877
|
summary = next;
|
|
61859
61878
|
await (0, import_promises3.setTimeout)(POLL_INTERVAL_MS);
|
|
61860
61879
|
}
|
|
61861
61880
|
}
|
|
61862
|
-
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;
|
|
61863
61882
|
var init_device = __esm({
|
|
61864
61883
|
"src/commands/device.ts"() {
|
|
61865
61884
|
"use strict";
|
|
61866
|
-
|
|
61885
|
+
import_chalk36 = __toESM(require("chalk"));
|
|
61867
61886
|
import_node_child_process4 = require("child_process");
|
|
61868
61887
|
import_node_net = require("net");
|
|
61869
61888
|
import_promises3 = require("timers/promises");
|
|
@@ -61965,8 +61984,8 @@ async function localControlRequestCommand(options) {
|
|
|
61965
61984
|
await orgAuthenticatedFetch("/v1/local-control-request", { method: "DELETE" });
|
|
61966
61985
|
output2({ status: "connected", computers: computers2 }, () => {
|
|
61967
61986
|
console.log(`
|
|
61968
|
-
${
|
|
61969
|
-
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>'
|
|
61970
61989
|
`));
|
|
61971
61990
|
});
|
|
61972
61991
|
};
|
|
@@ -61988,7 +62007,7 @@ async function localControlRequestCommand(options) {
|
|
|
61988
62007
|
});
|
|
61989
62008
|
if (found.length > 0) return connected(found);
|
|
61990
62009
|
output2({ status: "not_connected", computers: [], url: created2.url }, () => {
|
|
61991
|
-
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"));
|
|
61992
62011
|
});
|
|
61993
62012
|
return;
|
|
61994
62013
|
}
|
|
@@ -62011,10 +62030,10 @@ async function localControlRequestCommand(options) {
|
|
|
62011
62030
|
}
|
|
62012
62031
|
output2({ status: pending ? "pending" : "declined", computers: [], url: created2.url }, () => {
|
|
62013
62032
|
if (!pending) {
|
|
62014
|
-
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"));
|
|
62015
62034
|
return;
|
|
62016
62035
|
}
|
|
62017
|
-
console.log(
|
|
62036
|
+
console.log(import_chalk37.default.gray(options.wait === false ? `
|
|
62018
62037
|
Asked above the chat composer (${created2.url}). Keep working, and run this command again when you need the computer.
|
|
62019
62038
|
` : created2.wait ? `
|
|
62020
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.
|
|
@@ -62024,7 +62043,7 @@ async function localControlRequestCommand(options) {
|
|
|
62024
62043
|
`));
|
|
62025
62044
|
});
|
|
62026
62045
|
}
|
|
62027
|
-
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;
|
|
62028
62047
|
var init_local_control = __esm({
|
|
62029
62048
|
"src/commands/local-control.ts"() {
|
|
62030
62049
|
"use strict";
|
|
@@ -62033,7 +62052,7 @@ var init_local_control = __esm({
|
|
|
62033
62052
|
import_os5 = __toESM(require("os"));
|
|
62034
62053
|
import_path11 = __toESM(require("path"));
|
|
62035
62054
|
import_util10 = require("util");
|
|
62036
|
-
|
|
62055
|
+
import_chalk37 = __toESM(require("chalk"));
|
|
62037
62056
|
init_src();
|
|
62038
62057
|
init_api2();
|
|
62039
62058
|
init_command_utils();
|
|
@@ -62123,7 +62142,7 @@ function printRun({ run: run2 }) {
|
|
|
62123
62142
|
const units = Object.values(run2.coverage);
|
|
62124
62143
|
const done = units.filter((unit) => unit.status === "covered" || unit.status === "skipped").length;
|
|
62125
62144
|
console.log(`
|
|
62126
|
-
Run ${run2.id} (${run2.type}): ${
|
|
62145
|
+
Run ${run2.id} (${run2.type}): ${import_chalk38.default.bold(run2.status)}`);
|
|
62127
62146
|
console.log(` Coverage: ${done}/${units.length} units recorded`);
|
|
62128
62147
|
console.log(` Effort: ${run2.budget.effort} (${run2.budget.minutes} min, ${run2.budget.agent_calls} agent calls${run2.budget.cents ? `, $${run2.budget.cents / 100}` : ""})
|
|
62129
62148
|
`);
|
|
@@ -62136,7 +62155,7 @@ async function securityStatusCommand() {
|
|
|
62136
62155
|
if (run2.agents) console.log(` Agents: finder ${run2.agents.finder.model}, checker ${run2.agents.checker.model} (${run2.agents.checker_mode})
|
|
62137
62156
|
`);
|
|
62138
62157
|
const threatModel = run2.threat_model ?? profile?.threat_model;
|
|
62139
|
-
console.log(
|
|
62158
|
+
console.log(import_chalk38.default.bold(" Threat model"));
|
|
62140
62159
|
if (!threatModel) console.log(" None yet. Write one in your plan.");
|
|
62141
62160
|
else {
|
|
62142
62161
|
for (const [label, value] of [["Attackers", threatModel.attackers], ["Entry points", threatModel.entry_points], ["Must never happen", threatModel.must_never_happen], ["Notes", threatModel.notes]]) {
|
|
@@ -62145,17 +62164,17 @@ async function securityStatusCommand() {
|
|
|
62145
62164
|
}
|
|
62146
62165
|
}
|
|
62147
62166
|
if (profile?.settings.custom_direction) console.log(`
|
|
62148
|
-
${
|
|
62167
|
+
${import_chalk38.default.bold(" Direction from the admin")}
|
|
62149
62168
|
${profile.settings.custom_direction}`);
|
|
62150
62169
|
if (environment2) {
|
|
62151
62170
|
console.log(`
|
|
62152
|
-
${
|
|
62171
|
+
${import_chalk38.default.bold(" Environment")} (names only)`);
|
|
62153
62172
|
console.log(` Variables: ${environment2.variable_names.join(", ") || "none"}`);
|
|
62154
62173
|
console.log(` Files: ${environment2.file_paths.join(", ") || "none"}`);
|
|
62155
62174
|
}
|
|
62156
62175
|
console.log("");
|
|
62157
62176
|
if (dismissed.length) {
|
|
62158
|
-
console.log(
|
|
62177
|
+
console.log(import_chalk38.default.bold(` Dismissed before (${dismissed.length}); don't raise these again unless something changed:`));
|
|
62159
62178
|
for (const finding2 of dismissed) {
|
|
62160
62179
|
console.log(` - ${finding2.title} [${finding2.kind}/${finding2.weakness}] ${finding2.dismissal_reason}${finding2.dismissal_note ? `: ${finding2.dismissal_note}` : ""}`);
|
|
62161
62180
|
}
|
|
@@ -62166,7 +62185,7 @@ ${import_chalk37.default.bold(" Environment")} (names only)`);
|
|
|
62166
62185
|
async function securityPlanCommand(options) {
|
|
62167
62186
|
output2(await request("/plan", { method: "POST", body: await measurePlan(readJson(options.file)) }), (result) => {
|
|
62168
62187
|
printRun(result);
|
|
62169
|
-
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"));
|
|
62170
62189
|
});
|
|
62171
62190
|
}
|
|
62172
62191
|
async function securityUnitCommand(key2, status, options) {
|
|
@@ -62269,7 +62288,7 @@ async function checkLocation(body2) {
|
|
|
62269
62288
|
}
|
|
62270
62289
|
function printUpsertedFinding({ finding, created: created2 }) {
|
|
62271
62290
|
console.log(`
|
|
62272
|
-
${created2 ?
|
|
62291
|
+
${created2 ? import_chalk38.default.green("New finding") : "Matched an existing finding"} ${finding.id} (${finding.status}, ${finding.proof_level})
|
|
62273
62292
|
`);
|
|
62274
62293
|
}
|
|
62275
62294
|
async function securityCandidateCommand(options) {
|
|
@@ -62353,7 +62372,7 @@ async function securityProofCommand(findingId, options) {
|
|
|
62353
62372
|
async function securityPolicyBlockCommand(provider2, code) {
|
|
62354
62373
|
const body2 = { provider: provider2, code };
|
|
62355
62374
|
output2(await request("/policy-blocks", { method: "POST", body: body2 }), () => {
|
|
62356
|
-
console.log(
|
|
62375
|
+
console.log(import_chalk38.default.gray(`
|
|
62357
62376
|
Recorded a ${code} block from ${provider2}.
|
|
62358
62377
|
`));
|
|
62359
62378
|
});
|
|
@@ -62362,7 +62381,7 @@ async function securityAppSetupCommand(options) {
|
|
|
62362
62381
|
const result = options.file ? await request("/app-setup", { method: "PUT", body: readJson(options.file) }) : await request("/app-setup");
|
|
62363
62382
|
output2(result, ({ app_setup }) => {
|
|
62364
62383
|
console.log(app_setup ? `
|
|
62365
|
-
App setup: ${
|
|
62384
|
+
App setup: ${import_chalk38.default.bold(app_setup.status)}${app_setup.reason ? ` (${app_setup.reason})` : ""}
|
|
62366
62385
|
` : "\n No app setup yet.\n");
|
|
62367
62386
|
});
|
|
62368
62387
|
}
|
|
@@ -62433,14 +62452,14 @@ async function securityReviewCommand(options) {
|
|
|
62433
62452
|
` : "\n Recorded. No pull request was opened.\n");
|
|
62434
62453
|
});
|
|
62435
62454
|
}
|
|
62436
|
-
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;
|
|
62437
62456
|
var init_security2 = __esm({
|
|
62438
62457
|
"src/commands/security.ts"() {
|
|
62439
62458
|
"use strict";
|
|
62440
62459
|
import_child_process7 = require("child_process");
|
|
62441
62460
|
import_fs12 = __toESM(require("fs"));
|
|
62442
62461
|
import_path12 = require("path");
|
|
62443
|
-
|
|
62462
|
+
import_chalk38 = __toESM(require("chalk"));
|
|
62444
62463
|
init_src();
|
|
62445
62464
|
init_security_checkout();
|
|
62446
62465
|
init_api2();
|
|
@@ -62944,11 +62963,11 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
62944
62963
|
|
|
62945
62964
|
// src/bin.ts
|
|
62946
62965
|
var import_node_child_process6 = require("child_process");
|
|
62947
|
-
var
|
|
62966
|
+
var import_chalk39 = __toESM(require("chalk"));
|
|
62948
62967
|
init_config();
|
|
62949
62968
|
if (process.argv[2] === "computer" && isAgentMode()) {
|
|
62950
62969
|
const result = (0, import_node_child_process6.spawnSync)("replicas-computer", process.argv.slice(3), { stdio: "inherit" });
|
|
62951
|
-
if (result.error) console.error(
|
|
62970
|
+
if (result.error) console.error(import_chalk39.default.red(`
|
|
62952
62971
|
\u2717 replicas-computer is unavailable in this workspace image
|
|
62953
62972
|
`));
|
|
62954
62973
|
process.exitCode = result.error ? 1 : result.status ?? 1;
|