replicas-cli 0.3.656 → 0.3.659
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 +566 -549
- 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.659";
|
|
43374
43376
|
}
|
|
43375
43377
|
});
|
|
43376
43378
|
|
|
@@ -43932,9 +43934,7 @@ var init_artifacts2 = __esm({
|
|
|
43932
43934
|
listArtifactWorkspacesQuerySchema = external_exports.object({
|
|
43933
43935
|
workspace_id: external_exports.string().uuid().optional(),
|
|
43934
43936
|
q: external_exports.string().trim().max(ARTIFACT_DISPLAY_NAME_MAX_LENGTH).optional(),
|
|
43935
|
-
owner: external_exports.array(external_exports.union([external_exports.literal("organization"), external_exports.string().uuid()]))
|
|
43936
|
-
from: external_exports.string().datetime().optional(),
|
|
43937
|
-
to: external_exports.string().datetime().optional()
|
|
43937
|
+
owner: external_exports.array(external_exports.union([external_exports.literal("organization"), external_exports.string().uuid()]))
|
|
43938
43938
|
});
|
|
43939
43939
|
updateArtifactRequestSchema = external_exports.object({
|
|
43940
43940
|
display_name: external_exports.string().trim().min(1).max(ARTIFACT_DISPLAY_NAME_MAX_LENGTH)
|
|
@@ -54513,25 +54513,33 @@ var init_local_control_requests = __esm({
|
|
|
54513
54513
|
});
|
|
54514
54514
|
|
|
54515
54515
|
// ../shared/src/routes/approval-requests.ts
|
|
54516
|
-
var approvalChangeSchema, approvalRequestSchema, respondApprovalRequestSchema;
|
|
54516
|
+
var approvalChangeMethodSchema, approvalChangeSchema, approvalRequestSchema, respondApprovalRequestSchema;
|
|
54517
54517
|
var init_approval_requests = __esm({
|
|
54518
54518
|
"../shared/src/routes/approval-requests.ts"() {
|
|
54519
54519
|
"use strict";
|
|
54520
54520
|
init_zod();
|
|
54521
|
+
approvalChangeMethodSchema = external_exports.enum(["POST", "PUT", "PATCH", "DELETE"]);
|
|
54521
54522
|
approvalChangeSchema = external_exports.object({
|
|
54522
|
-
kind: external_exports.literal("
|
|
54523
|
-
|
|
54524
|
-
|
|
54525
|
-
|
|
54526
|
-
|
|
54527
|
-
|
|
54523
|
+
kind: external_exports.literal("api_request"),
|
|
54524
|
+
method: approvalChangeMethodSchema,
|
|
54525
|
+
path: external_exports.string().startsWith("/v1/"),
|
|
54526
|
+
body: external_exports.unknown().optional(),
|
|
54527
|
+
summary: external_exports.string(),
|
|
54528
|
+
detail: external_exports.string().nullable()
|
|
54528
54529
|
});
|
|
54529
54530
|
approvalRequestSchema = external_exports.object({
|
|
54530
54531
|
/** Changes whenever the request does, so an answer only counts for the changes the person saw. */
|
|
54531
54532
|
id: external_exports.string(),
|
|
54532
54533
|
changes: external_exports.array(approvalChangeSchema)
|
|
54533
54534
|
});
|
|
54534
|
-
respondApprovalRequestSchema = external_exports.object({
|
|
54535
|
+
respondApprovalRequestSchema = external_exports.object({
|
|
54536
|
+
id: external_exports.string(),
|
|
54537
|
+
/** `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. */
|
|
54538
|
+
action: external_exports.enum(["claim", "approved", "declined", "failed"]),
|
|
54539
|
+
/** For `failed`: how many changes were made before one failed, and why it failed. */
|
|
54540
|
+
applied: external_exports.number().int().min(0).optional(),
|
|
54541
|
+
error: external_exports.string().max(1e3).optional()
|
|
54542
|
+
});
|
|
54535
54543
|
}
|
|
54536
54544
|
});
|
|
54537
54545
|
|
|
@@ -54904,48 +54912,6 @@ var init_monolith_url = __esm({
|
|
|
54904
54912
|
}
|
|
54905
54913
|
});
|
|
54906
54914
|
|
|
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
54915
|
// src/lib/output.ts
|
|
54950
54916
|
function enableJsonMode() {
|
|
54951
54917
|
jsonMode = true;
|
|
@@ -54987,6 +54953,61 @@ var init_output = __esm({
|
|
|
54987
54953
|
}
|
|
54988
54954
|
});
|
|
54989
54955
|
|
|
54956
|
+
// src/lib/authenticated-api.ts
|
|
54957
|
+
async function throwResponseError(response) {
|
|
54958
|
+
const { error: error62 } = await readApiErrorBody(response);
|
|
54959
|
+
throw new ApiError(error62 || `Request failed with status ${response.status}`, response.status);
|
|
54960
|
+
}
|
|
54961
|
+
async function exitIfApprovalRequired(response) {
|
|
54962
|
+
if (response.status !== 202) return;
|
|
54963
|
+
const body2 = await response.clone().json().catch(() => null);
|
|
54964
|
+
if (!isRecord(body2) || typeof body2.approval_url !== "string" || typeof body2.message !== "string") return;
|
|
54965
|
+
const approval = { approval_url: body2.approval_url, message: body2.message };
|
|
54966
|
+
output2(approval, () => console.log(import_chalk2.default.yellow(`
|
|
54967
|
+
${approval.message}
|
|
54968
|
+
`)));
|
|
54969
|
+
process.exit(0);
|
|
54970
|
+
}
|
|
54971
|
+
async function apiFetch(url2, headers, options) {
|
|
54972
|
+
const requestHeaders = new Headers({ "Content-Type": "application/json", ...headers });
|
|
54973
|
+
new Headers(options?.headers).forEach((value, key2) => requestHeaders.set(key2, value));
|
|
54974
|
+
const response = await fetchWithRedirects(`${MONOLITH_URL}${url2}`, {
|
|
54975
|
+
...options,
|
|
54976
|
+
headers: requestHeaders,
|
|
54977
|
+
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
54978
|
+
});
|
|
54979
|
+
if (!response.ok) {
|
|
54980
|
+
await throwResponseError(response);
|
|
54981
|
+
}
|
|
54982
|
+
await exitIfApprovalRequired(response);
|
|
54983
|
+
return response.json();
|
|
54984
|
+
}
|
|
54985
|
+
async function authenticatedFetch(url2, options) {
|
|
54986
|
+
const token = await getValidToken();
|
|
54987
|
+
if (!token) {
|
|
54988
|
+
throw new Error("No access token available");
|
|
54989
|
+
}
|
|
54990
|
+
return apiFetch(url2, { Authorization: `Bearer ${token}` }, options);
|
|
54991
|
+
}
|
|
54992
|
+
var import_chalk2, ApiError;
|
|
54993
|
+
var init_authenticated_api = __esm({
|
|
54994
|
+
"src/lib/authenticated-api.ts"() {
|
|
54995
|
+
"use strict";
|
|
54996
|
+
import_chalk2 = __toESM(require("chalk"));
|
|
54997
|
+
init_src();
|
|
54998
|
+
init_auth();
|
|
54999
|
+
init_monolith_url();
|
|
55000
|
+
init_output();
|
|
55001
|
+
ApiError = class extends Error {
|
|
55002
|
+
constructor(message2, status) {
|
|
55003
|
+
super(message2);
|
|
55004
|
+
this.name = "ApiError";
|
|
55005
|
+
this.status = status;
|
|
55006
|
+
}
|
|
55007
|
+
};
|
|
55008
|
+
}
|
|
55009
|
+
});
|
|
55010
|
+
|
|
54990
55011
|
// src/lib/organization.ts
|
|
54991
55012
|
async function fetchOrganizations() {
|
|
54992
55013
|
const response = await authenticatedFetch(
|
|
@@ -55132,6 +55153,7 @@ async function orgAuthenticatedSseStream(url2, options) {
|
|
|
55132
55153
|
await throwResponseError(response);
|
|
55133
55154
|
return;
|
|
55134
55155
|
}
|
|
55156
|
+
await exitIfApprovalRequired(response);
|
|
55135
55157
|
await readSseStream(response.body, options.onEvent);
|
|
55136
55158
|
}
|
|
55137
55159
|
var init_api2 = __esm({
|
|
@@ -55149,7 +55171,7 @@ var init_api2 = __esm({
|
|
|
55149
55171
|
|
|
55150
55172
|
// src/lib/oauth-flow-ui.ts
|
|
55151
55173
|
function field(label, value) {
|
|
55152
|
-
console.log(` ${
|
|
55174
|
+
console.log(` ${import_chalk3.default.gray(label.padEnd(LABEL_WIDTH))}${value}`);
|
|
55153
55175
|
}
|
|
55154
55176
|
function appliesTo(target) {
|
|
55155
55177
|
if (!target.isUserScoped) return "Organization Settings";
|
|
@@ -55161,10 +55183,10 @@ function hyperlink(url2) {
|
|
|
55161
55183
|
function renderIdentity(identity) {
|
|
55162
55184
|
field(
|
|
55163
55185
|
"User",
|
|
55164
|
-
|
|
55186
|
+
import_chalk3.default.bold(identity.account ?? "unknown") + (identity.role ? import_chalk3.default.gray(` (${identity.role})`) : "")
|
|
55165
55187
|
);
|
|
55166
55188
|
if (identity.organizationName) {
|
|
55167
|
-
field("Organization",
|
|
55189
|
+
field("Organization", import_chalk3.default.bold(identity.organizationName));
|
|
55168
55190
|
}
|
|
55169
55191
|
}
|
|
55170
55192
|
function renderTargetFields(target) {
|
|
@@ -55173,7 +55195,7 @@ function renderTargetFields(target) {
|
|
|
55173
55195
|
role: target.role,
|
|
55174
55196
|
organizationName: target.organization?.name
|
|
55175
55197
|
});
|
|
55176
|
-
field("Applies to",
|
|
55198
|
+
field("Applies to", import_chalk3.default.yellow.bold(appliesTo(target)));
|
|
55177
55199
|
}
|
|
55178
55200
|
async function resolveAuthFlowTarget(identity) {
|
|
55179
55201
|
if (isAgentMode()) {
|
|
@@ -55207,11 +55229,11 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
55207
55229
|
`));
|
|
55208
55230
|
renderTargetFields(target);
|
|
55209
55231
|
if (!target.isUserScoped) {
|
|
55210
|
-
console.log(
|
|
55232
|
+
console.log(import_chalk3.default.gray("\n Use --user to apply this to your personal account instead."));
|
|
55211
55233
|
}
|
|
55212
55234
|
if (target.sharesWithOrganization) {
|
|
55213
55235
|
console.log(
|
|
55214
|
-
|
|
55236
|
+
import_chalk3.default.gray(
|
|
55215
55237
|
`
|
|
55216
55238
|
${target.organization?.name ?? "Your organization"} has no ${target.credentialLabel} default yet,
|
|
55217
55239
|
so this also becomes the organization default.`
|
|
@@ -55220,7 +55242,7 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
55220
55242
|
}
|
|
55221
55243
|
console.log();
|
|
55222
55244
|
if (assumeYes) {
|
|
55223
|
-
console.log(
|
|
55245
|
+
console.log(import_chalk3.default.gray(" Confirmed by --yes."));
|
|
55224
55246
|
} else {
|
|
55225
55247
|
if (!isInteractive()) {
|
|
55226
55248
|
throw new Error(
|
|
@@ -55234,10 +55256,10 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
55234
55256
|
initial: false
|
|
55235
55257
|
});
|
|
55236
55258
|
if (!confirmed) {
|
|
55237
|
-
console.log(
|
|
55259
|
+
console.log(import_chalk3.default.yellow("\n Cancelled. Nothing was saved."));
|
|
55238
55260
|
if (!target.isUserScoped) {
|
|
55239
55261
|
console.log(
|
|
55240
|
-
|
|
55262
|
+
import_chalk3.default.gray(" To set this for your personal account instead, use the --user flag.\n")
|
|
55241
55263
|
);
|
|
55242
55264
|
}
|
|
55243
55265
|
return false;
|
|
@@ -55246,11 +55268,11 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
55246
55268
|
return true;
|
|
55247
55269
|
}
|
|
55248
55270
|
function renderAuthFlowStep(step2, total, title3) {
|
|
55249
|
-
console.log(
|
|
55271
|
+
console.log(import_chalk3.default.bold(`
|
|
55250
55272
|
${step2}/${total} ${title3}`));
|
|
55251
55273
|
}
|
|
55252
55274
|
function renderAuthFlowDetail(text5) {
|
|
55253
|
-
console.log(
|
|
55275
|
+
console.log(import_chalk3.default.gray(` ${text5}`));
|
|
55254
55276
|
}
|
|
55255
55277
|
function renderAuthFlowSuccess(providerLabel, summary, target) {
|
|
55256
55278
|
console.log(brand.bold(`
|
|
@@ -55260,13 +55282,13 @@ function renderAuthFlowSuccess(providerLabel, summary, target) {
|
|
|
55260
55282
|
if (summary.email) {
|
|
55261
55283
|
field(
|
|
55262
55284
|
`${providerLabel} account`,
|
|
55263
|
-
|
|
55285
|
+
import_chalk3.default.bold(summary.email) + (summary.planType ? import_chalk3.default.gray(` \xB7 ${summary.planType}`) : "")
|
|
55264
55286
|
);
|
|
55265
55287
|
}
|
|
55266
55288
|
if (summary.accountOrdinal && summary.accountCount && summary.accountCount > 1) {
|
|
55267
55289
|
field(
|
|
55268
55290
|
"Account order",
|
|
55269
|
-
`${summary.accountOrdinal} of ${summary.accountCount}` +
|
|
55291
|
+
`${summary.accountOrdinal} of ${summary.accountCount}` + import_chalk3.default.gray(" \xB7 Replicas moves to the next account when one hits its usage limit")
|
|
55270
55292
|
);
|
|
55271
55293
|
}
|
|
55272
55294
|
console.log();
|
|
@@ -55280,13 +55302,13 @@ async function openForApproval(host2, authUrl) {
|
|
|
55280
55302
|
}
|
|
55281
55303
|
renderAuthFlowDetail(opened ? `Opened ${host2}` : `Could not open ${host2} automatically`);
|
|
55282
55304
|
renderAuthFlowDetail(opened ? "If it didn't open, visit:" : "Visit:");
|
|
55283
|
-
console.log(` ${
|
|
55305
|
+
console.log(` ${import_chalk3.default.gray.underline(hyperlink(authUrl))}`);
|
|
55284
55306
|
}
|
|
55285
|
-
var
|
|
55307
|
+
var import_chalk3, import_open, LABEL_WIDTH, brand;
|
|
55286
55308
|
var init_oauth_flow_ui = __esm({
|
|
55287
55309
|
"src/lib/oauth-flow-ui.ts"() {
|
|
55288
55310
|
"use strict";
|
|
55289
|
-
|
|
55311
|
+
import_chalk3 = __toESM(require("chalk"));
|
|
55290
55312
|
import_open = __toESM(require("open"));
|
|
55291
55313
|
init_api2();
|
|
55292
55314
|
init_auth();
|
|
@@ -55294,13 +55316,13 @@ var init_oauth_flow_ui = __esm({
|
|
|
55294
55316
|
init_organization2();
|
|
55295
55317
|
init_output();
|
|
55296
55318
|
LABEL_WIDTH = 16;
|
|
55297
|
-
brand =
|
|
55319
|
+
brand = import_chalk3.default.hex("#3eeba3");
|
|
55298
55320
|
}
|
|
55299
55321
|
});
|
|
55300
55322
|
|
|
55301
55323
|
// src/commands/whoami.ts
|
|
55302
55324
|
function printApiKeyIdentity({ organization, caller, user, is_admin }) {
|
|
55303
|
-
field("Organization",
|
|
55325
|
+
field("Organization", import_chalk4.default.bold(organization.name));
|
|
55304
55326
|
field("Identity", caller === "personal_api_key" ? `personal API key of ${user?.email ?? user?.display_name}` : "organization API key");
|
|
55305
55327
|
field("Admin", is_admin ? "yes" : "no");
|
|
55306
55328
|
}
|
|
@@ -55310,9 +55332,9 @@ async function whoamiCommand() {
|
|
|
55310
55332
|
if (!agent) throw new Error("Agent mode config is incomplete.");
|
|
55311
55333
|
output2({ workspace_id: agent.workspace_id, organization_id: agent.organization_id ?? null }, () => {
|
|
55312
55334
|
console.log(brand.bold("\n Workspace identity\n"));
|
|
55313
|
-
field("Workspace",
|
|
55335
|
+
field("Workspace", import_chalk4.default.bold(agent.workspace_id));
|
|
55314
55336
|
if (agent.organization_id) {
|
|
55315
|
-
field("Organization",
|
|
55337
|
+
field("Organization", import_chalk4.default.bold(agent.organization_id));
|
|
55316
55338
|
}
|
|
55317
55339
|
console.log();
|
|
55318
55340
|
});
|
|
@@ -55343,11 +55365,11 @@ async function whoamiCommand() {
|
|
|
55343
55365
|
console.log();
|
|
55344
55366
|
});
|
|
55345
55367
|
}
|
|
55346
|
-
var
|
|
55368
|
+
var import_chalk4;
|
|
55347
55369
|
var init_whoami = __esm({
|
|
55348
55370
|
"src/commands/whoami.ts"() {
|
|
55349
55371
|
"use strict";
|
|
55350
|
-
|
|
55372
|
+
import_chalk4 = __toESM(require("chalk"));
|
|
55351
55373
|
init_api2();
|
|
55352
55374
|
init_oauth_flow_ui();
|
|
55353
55375
|
init_auth();
|
|
@@ -55512,14 +55534,14 @@ async function loginCommand() {
|
|
|
55512
55534
|
organizationName: active?.organization?.name
|
|
55513
55535
|
});
|
|
55514
55536
|
if (!active) {
|
|
55515
|
-
field("Organization",
|
|
55516
|
-
console.log(
|
|
55537
|
+
field("Organization", import_chalk5.default.yellow("could not be fetched"));
|
|
55538
|
+
console.log(import_chalk5.default.gray('\n Set one with "replicas org switch".'));
|
|
55517
55539
|
} else if (!active.organization) {
|
|
55518
|
-
field("Organization",
|
|
55519
|
-
console.log(
|
|
55540
|
+
field("Organization", import_chalk5.default.yellow("none selected"));
|
|
55541
|
+
console.log(import_chalk5.default.gray('\n Choose one with "replicas org switch".'));
|
|
55520
55542
|
} else if (active.total > 1) {
|
|
55521
55543
|
console.log(
|
|
55522
|
-
|
|
55544
|
+
import_chalk5.default.gray(`
|
|
55523
55545
|
${active.total} organizations available. "replicas org switch" to change.`)
|
|
55524
55546
|
);
|
|
55525
55547
|
}
|
|
@@ -55558,12 +55580,12 @@ async function loginCommand() {
|
|
|
55558
55580
|
const port2 = address.port;
|
|
55559
55581
|
const loginUrl = `${WEB_APP_URL}/cli-login?port=${port2}&state=${state}`;
|
|
55560
55582
|
console.log(brand("\nOpening browser for authentication..."));
|
|
55561
|
-
console.log(
|
|
55583
|
+
console.log(import_chalk5.default.gray(`If the browser doesn't open automatically, visit:
|
|
55562
55584
|
${loginUrl}
|
|
55563
55585
|
`));
|
|
55564
55586
|
(0, import_open2.default)(loginUrl).catch(() => {
|
|
55565
|
-
console.log(
|
|
55566
|
-
console.log(
|
|
55587
|
+
console.log(import_chalk5.default.yellow("Failed to open browser automatically."));
|
|
55588
|
+
console.log(import_chalk5.default.gray(`Please open this URL manually:
|
|
55567
55589
|
${loginUrl}
|
|
55568
55590
|
`));
|
|
55569
55591
|
});
|
|
@@ -55575,7 +55597,7 @@ ${loginUrl}
|
|
|
55575
55597
|
}, 5 * 60 * 1e3);
|
|
55576
55598
|
});
|
|
55577
55599
|
}
|
|
55578
|
-
var import_http, import_url3, import_open2,
|
|
55600
|
+
var import_http, import_url3, import_open2, import_chalk5, WEB_APP_URL;
|
|
55579
55601
|
var init_login3 = __esm({
|
|
55580
55602
|
"src/commands/login.ts"() {
|
|
55581
55603
|
"use strict";
|
|
@@ -55583,7 +55605,7 @@ var init_login3 = __esm({
|
|
|
55583
55605
|
import_http = __toESM(require("http"));
|
|
55584
55606
|
import_url3 = require("url");
|
|
55585
55607
|
import_open2 = __toESM(require("open"));
|
|
55586
|
-
|
|
55608
|
+
import_chalk5 = __toESM(require("chalk"));
|
|
55587
55609
|
init_config();
|
|
55588
55610
|
init_oauth_flow_ui();
|
|
55589
55611
|
init_auth();
|
|
@@ -55598,17 +55620,17 @@ var init_login3 = __esm({
|
|
|
55598
55620
|
// src/commands/logout.ts
|
|
55599
55621
|
function logoutCommand() {
|
|
55600
55622
|
if (!isAuthenticated() && !getApiKey()) {
|
|
55601
|
-
output2({ success: true }, () => console.log(
|
|
55623
|
+
output2({ success: true }, () => console.log(import_chalk6.default.yellow("You are not logged in.")));
|
|
55602
55624
|
return;
|
|
55603
55625
|
}
|
|
55604
55626
|
clearAuthentication();
|
|
55605
55627
|
outputSuccess("\u2713 Successfully logged out!");
|
|
55606
55628
|
}
|
|
55607
|
-
var
|
|
55629
|
+
var import_chalk6;
|
|
55608
55630
|
var init_logout = __esm({
|
|
55609
55631
|
"src/commands/logout.ts"() {
|
|
55610
55632
|
"use strict";
|
|
55611
|
-
|
|
55633
|
+
import_chalk6 = __toESM(require("chalk"));
|
|
55612
55634
|
init_config();
|
|
55613
55635
|
init_output();
|
|
55614
55636
|
}
|
|
@@ -55633,8 +55655,8 @@ function truncate(text5, maxLength) {
|
|
|
55633
55655
|
return text5.substring(0, maxLength) + "...";
|
|
55634
55656
|
}
|
|
55635
55657
|
function printReplicaActivity(activity) {
|
|
55636
|
-
console.log(
|
|
55637
|
-
if (activity.last_agent_message) console.log(
|
|
55658
|
+
console.log(import_chalk7.default.gray(` Agent: ${activity.state.replaceAll("_", " ")}${activity.current_step ? ` \xB7 ${activity.current_step}` : ""}`));
|
|
55659
|
+
if (activity.last_agent_message) console.log(import_chalk7.default.gray(` Last message: ${activity.last_agent_message}`));
|
|
55638
55660
|
}
|
|
55639
55661
|
function ensureOrgApiAuthenticated() {
|
|
55640
55662
|
if (!canCallOrgApi()) {
|
|
@@ -55654,7 +55676,7 @@ function parseKeyValuePairs(pairs) {
|
|
|
55654
55676
|
async function confirmAction(message2) {
|
|
55655
55677
|
if (!isInteractive()) throw new Error(`${message2} Pass -f to confirm without a terminal.`);
|
|
55656
55678
|
const { confirm } = await (0, import_prompts10.default)({ type: "confirm", name: "confirm", message: message2, initial: false });
|
|
55657
|
-
if (!confirm) console.log(
|
|
55679
|
+
if (!confirm) console.log(import_chalk7.default.yellow("\nCancelled."));
|
|
55658
55680
|
return Boolean(confirm);
|
|
55659
55681
|
}
|
|
55660
55682
|
function parseRequestTimeout(value) {
|
|
@@ -55665,7 +55687,7 @@ function parseRequestTimeout(value) {
|
|
|
55665
55687
|
}
|
|
55666
55688
|
async function waitForUser(params) {
|
|
55667
55689
|
const { timeoutMs } = params;
|
|
55668
|
-
if (!isJsonMode()) console.log(
|
|
55690
|
+
if (!isJsonMode()) console.log(import_chalk7.default.gray(`
|
|
55669
55691
|
${params.asked} Waiting up to ${timeoutMs >= 6e4 ? `${Math.round(timeoutMs / 6e4)} minute(s)` : `${timeoutMs / 1e3} seconds`}\u2026`));
|
|
55670
55692
|
let value = params.initial;
|
|
55671
55693
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -55695,11 +55717,11 @@ function formatMediaEmbed(name, media2, publicUrl) {
|
|
|
55695
55717
|
if (publicUrl) return `${media2.kind === MEDIA_KIND.IMAGE ? "!" : ""}[${markdownLabel(name)}](${publicUrl})`;
|
|
55696
55718
|
return `Replicas chat embed: `;
|
|
55697
55719
|
}
|
|
55698
|
-
var
|
|
55720
|
+
var import_chalk7, import_fs2, import_path2, import_prompts10, markdownLabel;
|
|
55699
55721
|
var init_command_utils = __esm({
|
|
55700
55722
|
"src/lib/command-utils.ts"() {
|
|
55701
55723
|
"use strict";
|
|
55702
|
-
|
|
55724
|
+
import_chalk7 = __toESM(require("chalk"));
|
|
55703
55725
|
import_fs2 = __toESM(require("fs"));
|
|
55704
55726
|
import_path2 = __toESM(require("path"));
|
|
55705
55727
|
init_src();
|
|
@@ -55718,12 +55740,12 @@ async function billingCommand() {
|
|
|
55718
55740
|
field("Plan", plan);
|
|
55719
55741
|
field("Period", `${formatDate(period_start)} \u2013 ${formatDate(period_end)}`);
|
|
55720
55742
|
if (credit) {
|
|
55721
|
-
field("Balance", `${
|
|
55743
|
+
field("Balance", `${import_chalk8.default.bold(formatCents(credit.remaining_cents))} left, ${formatCents(credit.used_cents)} used of ${formatCents(credit.total_cents)}`);
|
|
55722
55744
|
if (credit.one_time_cents) field("Credit", `${formatCents(credit.plan_cents)} plan + ${formatCents(credit.one_time_cents)} one-time`);
|
|
55723
55745
|
if (credit.overage_cents) field("Overage", formatCents(credit.overage_cents));
|
|
55724
55746
|
}
|
|
55725
55747
|
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",
|
|
55748
|
+
if (blocked) field("Blocked", import_chalk8.default.red(blocked.message));
|
|
55727
55749
|
console.log();
|
|
55728
55750
|
});
|
|
55729
55751
|
}
|
|
@@ -55732,15 +55754,15 @@ async function billingUsageCommand(options) {
|
|
|
55732
55754
|
const usage = await orgAuthenticatedFetch(`/v1/organization/billing/usage${query.size ? `?${query}` : ""}`);
|
|
55733
55755
|
output2(usage, ({ points, sources }) => {
|
|
55734
55756
|
for (const point of points) console.log(`${point.bucket} ${formatCents(point.cents)}`);
|
|
55735
|
-
console.log(
|
|
55757
|
+
console.log(import_chalk8.default.gray(`
|
|
55736
55758
|
${sources.map((source) => `${source.source} ${formatCents(source.cents)}`).join(", ") || "No usage"}`));
|
|
55737
55759
|
});
|
|
55738
55760
|
}
|
|
55739
|
-
var
|
|
55761
|
+
var import_chalk8;
|
|
55740
55762
|
var init_billing2 = __esm({
|
|
55741
55763
|
"src/commands/billing.ts"() {
|
|
55742
55764
|
"use strict";
|
|
55743
|
-
|
|
55765
|
+
import_chalk8 = __toESM(require("chalk"));
|
|
55744
55766
|
init_currency();
|
|
55745
55767
|
init_api2();
|
|
55746
55768
|
init_command_utils();
|
|
@@ -55797,12 +55819,12 @@ async function identityTokenCommand(options) {
|
|
|
55797
55819
|
}
|
|
55798
55820
|
async function identityExecCommand(command, options) {
|
|
55799
55821
|
if (command.length === 0) {
|
|
55800
|
-
console.error(
|
|
55822
|
+
console.error(import_chalk9.default.red("Provide a command to run: replicas identity exec -- <command>"));
|
|
55801
55823
|
process.exit(1);
|
|
55802
55824
|
}
|
|
55803
55825
|
const tokenResult = await fetchToken(options.audience);
|
|
55804
55826
|
if (!tokenResult.ok) {
|
|
55805
|
-
console.error(
|
|
55827
|
+
console.error(import_chalk9.default.red(tokenResult.error.message));
|
|
55806
55828
|
process.exitCode = 1;
|
|
55807
55829
|
return;
|
|
55808
55830
|
}
|
|
@@ -55826,7 +55848,7 @@ async function identityAwsCredentialsCommand(options) {
|
|
|
55826
55848
|
}
|
|
55827
55849
|
const result = await fetchToken(options.audience, options.sourceIdentity);
|
|
55828
55850
|
if (!result.ok) {
|
|
55829
|
-
console.error(
|
|
55851
|
+
console.error(import_chalk9.default.red(result.error.message));
|
|
55830
55852
|
process.exitCode = 1;
|
|
55831
55853
|
return;
|
|
55832
55854
|
}
|
|
@@ -55873,7 +55895,7 @@ async function identityAwsCredentialsCommand(options) {
|
|
|
55873
55895
|
(0, import_node_fs.rmSync)(directory, { recursive: true, force: true });
|
|
55874
55896
|
}
|
|
55875
55897
|
}
|
|
55876
|
-
var import_node_crypto, import_node_fs, import_node_child_process, import_node_os, import_node_path,
|
|
55898
|
+
var import_node_crypto, import_node_fs, import_node_child_process, import_node_os, import_node_path, import_chalk9;
|
|
55877
55899
|
var init_identity = __esm({
|
|
55878
55900
|
"src/commands/identity.ts"() {
|
|
55879
55901
|
"use strict";
|
|
@@ -55882,7 +55904,7 @@ var init_identity = __esm({
|
|
|
55882
55904
|
import_node_child_process = require("child_process");
|
|
55883
55905
|
import_node_os = require("os");
|
|
55884
55906
|
import_node_path = require("path");
|
|
55885
|
-
|
|
55907
|
+
import_chalk9 = __toESM(require("chalk"));
|
|
55886
55908
|
init_output();
|
|
55887
55909
|
init_src();
|
|
55888
55910
|
}
|
|
@@ -55994,7 +56016,7 @@ async function resolveWorkspaceRecord(workspaceName) {
|
|
|
55994
56016
|
const exactWorkspace = await fetchWorkspaceById(workspaceName);
|
|
55995
56017
|
if (exactWorkspace) return exactWorkspace;
|
|
55996
56018
|
}
|
|
55997
|
-
console.log(
|
|
56019
|
+
console.log(import_chalk10.default.blue(workspaceName ? `
|
|
55998
56020
|
Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
|
|
55999
56021
|
const params = new URLSearchParams({ limit: "100" });
|
|
56000
56022
|
if (workspaceName) params.set("name", workspaceName);
|
|
@@ -56013,7 +56035,7 @@ Searching for workspace: ${workspaceName}...` : "\nLoading workspaces..."));
|
|
|
56013
56035
|
selectedWorkspace = workspaces[0];
|
|
56014
56036
|
} else {
|
|
56015
56037
|
if (workspaceName) {
|
|
56016
|
-
console.log(
|
|
56038
|
+
console.log(import_chalk10.default.yellow(`
|
|
56017
56039
|
Found ${workspaces.length} workspaces matching "${workspaceName}":`));
|
|
56018
56040
|
}
|
|
56019
56041
|
const selectResponse = await ask({
|
|
@@ -56035,9 +56057,9 @@ Found ${workspaces.length} workspaces matching "${workspaceName}":`));
|
|
|
56035
56057
|
}
|
|
56036
56058
|
selectedWorkspace = selected;
|
|
56037
56059
|
}
|
|
56038
|
-
console.log(
|
|
56060
|
+
console.log(import_chalk10.default.green(`
|
|
56039
56061
|
\u2713 Selected workspace: ${selectedWorkspace.name}`));
|
|
56040
|
-
console.log(
|
|
56062
|
+
console.log(import_chalk10.default.gray(` Status: ${selectedWorkspace.status || "unknown"}`));
|
|
56041
56063
|
return selectedWorkspace;
|
|
56042
56064
|
}
|
|
56043
56065
|
async function prepareWorkspaceConnection(workspaceName) {
|
|
@@ -56047,12 +56069,12 @@ async function prepareWorkspaceConnection(workspaceName) {
|
|
|
56047
56069
|
`Workspace is currently ${selectedWorkspace.status}. Wake it at ${DEFAULT_WEB_APP_URL}`
|
|
56048
56070
|
);
|
|
56049
56071
|
}
|
|
56050
|
-
console.log(
|
|
56072
|
+
console.log(import_chalk10.default.blue("\nRequesting SSH access token..."));
|
|
56051
56073
|
const tokenResponse = await orgAuthenticatedFetch(
|
|
56052
56074
|
`/v1/workspaces/${selectedWorkspace.id}/ssh-token`,
|
|
56053
56075
|
{ method: "POST" }
|
|
56054
56076
|
);
|
|
56055
|
-
console.log(
|
|
56077
|
+
console.log(import_chalk10.default.green("\u2713 SSH token received"));
|
|
56056
56078
|
let repoName = null;
|
|
56057
56079
|
if (isInsideGitRepo()) {
|
|
56058
56080
|
try {
|
|
@@ -56068,11 +56090,11 @@ async function prepareWorkspaceConnection(workspaceName) {
|
|
|
56068
56090
|
repoName
|
|
56069
56091
|
};
|
|
56070
56092
|
}
|
|
56071
|
-
var
|
|
56093
|
+
var import_chalk10;
|
|
56072
56094
|
var init_workspace_connection = __esm({
|
|
56073
56095
|
"src/lib/workspace-connection.ts"() {
|
|
56074
56096
|
"use strict";
|
|
56075
|
-
|
|
56097
|
+
import_chalk10 = __toESM(require("chalk"));
|
|
56076
56098
|
init_src();
|
|
56077
56099
|
init_config();
|
|
56078
56100
|
init_api2();
|
|
@@ -56086,17 +56108,17 @@ async function connectCommand(workspaceName) {
|
|
|
56086
56108
|
ensureOrgApiAuthenticated();
|
|
56087
56109
|
ensureSSHTransport();
|
|
56088
56110
|
const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
|
|
56089
|
-
console.log(
|
|
56111
|
+
console.log(import_chalk11.default.blue(`
|
|
56090
56112
|
Connecting to ${workspace.name}...`));
|
|
56091
|
-
console.log(
|
|
56113
|
+
console.log(import_chalk11.default.gray("\nPress Ctrl+D to disconnect.\n"));
|
|
56092
56114
|
await connectSSH(sshToken, sshHost, sshProxyCommand);
|
|
56093
|
-
console.log(
|
|
56115
|
+
console.log(import_chalk11.default.green("\n\u2713 Disconnected from workspace.\n"));
|
|
56094
56116
|
}
|
|
56095
|
-
var
|
|
56117
|
+
var import_chalk11;
|
|
56096
56118
|
var init_connect = __esm({
|
|
56097
56119
|
"src/commands/connect.ts"() {
|
|
56098
56120
|
"use strict";
|
|
56099
|
-
|
|
56121
|
+
import_chalk11 = __toESM(require("chalk"));
|
|
56100
56122
|
init_command_utils();
|
|
56101
56123
|
init_ssh();
|
|
56102
56124
|
init_workspace_connection();
|
|
@@ -56205,22 +56227,22 @@ async function codeCommand(workspaceName) {
|
|
|
56205
56227
|
}
|
|
56206
56228
|
const { workspace, sshToken, sshHost, sshProxyCommand, repoName } = await prepareWorkspaceConnection(workspaceName);
|
|
56207
56229
|
const hostAlias = getWorkspaceHostAlias(workspace.name);
|
|
56208
|
-
console.log(
|
|
56230
|
+
console.log(import_chalk12.default.blue("\nConfiguring SSH connection..."));
|
|
56209
56231
|
addOrUpdateSSHConfigEntry({
|
|
56210
56232
|
host: hostAlias,
|
|
56211
56233
|
hostname: sshHost,
|
|
56212
56234
|
user: sshToken,
|
|
56213
56235
|
proxyCommand: sshProxyCommand
|
|
56214
56236
|
});
|
|
56215
|
-
console.log(
|
|
56237
|
+
console.log(import_chalk12.default.green(`\u2713 SSH config entry created: ${hostAlias}`));
|
|
56216
56238
|
const paths = SANDBOX_PATHS;
|
|
56217
56239
|
const remotePath = repoName ? `${paths.WORKSPACES_DIR}/${repoName}` : paths.HOME_DIR;
|
|
56218
56240
|
const ideCommand = getIdeCommand();
|
|
56219
56241
|
const fullCommand = `${ideCommand} --remote ssh-remote+${hostAlias} ${remotePath}`;
|
|
56220
|
-
console.log(
|
|
56242
|
+
console.log(import_chalk12.default.blue(`
|
|
56221
56243
|
Opening ${ideCommand} for workspace ${workspace.name}...`));
|
|
56222
|
-
console.log(
|
|
56223
|
-
console.log(
|
|
56244
|
+
console.log(import_chalk12.default.gray(`Command: ${fullCommand}`));
|
|
56245
|
+
console.log(import_chalk12.default.yellow(`
|
|
56224
56246
|
Note: SSH tokens expire after 3 hours. Run this command again to refresh.`));
|
|
56225
56247
|
const ide = (0, import_child_process3.spawn)(ideCommand, [
|
|
56226
56248
|
"--remote",
|
|
@@ -56231,26 +56253,26 @@ Note: SSH tokens expire after 3 hours. Run this command again to refresh.`));
|
|
|
56231
56253
|
detached: false
|
|
56232
56254
|
});
|
|
56233
56255
|
ide.on("error", (error62) => {
|
|
56234
|
-
console.error(
|
|
56256
|
+
console.error(import_chalk12.default.red(`
|
|
56235
56257
|
Failed to launch ${ideCommand}: ${error62.message}`));
|
|
56236
|
-
console.log(
|
|
56258
|
+
console.log(import_chalk12.default.yellow(`
|
|
56237
56259
|
Make sure ${ideCommand} is installed and available in your PATH.`));
|
|
56238
|
-
console.log(
|
|
56260
|
+
console.log(import_chalk12.default.gray(`You can configure a different IDE with: replicas config set ide <command>`));
|
|
56239
56261
|
process.exit(1);
|
|
56240
56262
|
});
|
|
56241
56263
|
ide.on("close", (code) => {
|
|
56242
56264
|
if (code === 0) {
|
|
56243
|
-
console.log(
|
|
56265
|
+
console.log(import_chalk12.default.green(`
|
|
56244
56266
|
\u2713 ${ideCommand} closed successfully.
|
|
56245
56267
|
`));
|
|
56246
56268
|
}
|
|
56247
56269
|
});
|
|
56248
56270
|
}
|
|
56249
|
-
var
|
|
56271
|
+
var import_chalk12, import_child_process3;
|
|
56250
56272
|
var init_code = __esm({
|
|
56251
56273
|
"src/commands/code.ts"() {
|
|
56252
56274
|
"use strict";
|
|
56253
|
-
|
|
56275
|
+
import_chalk12 = __toESM(require("chalk"));
|
|
56254
56276
|
import_child_process3 = require("child_process");
|
|
56255
56277
|
init_src();
|
|
56256
56278
|
init_config();
|
|
@@ -56267,16 +56289,16 @@ async function tunnelCommand(workspaceName, options) {
|
|
|
56267
56289
|
const remotePort = parsePort(options.port);
|
|
56268
56290
|
const localPort = options.localPort ? parsePort(options.localPort) : remotePort;
|
|
56269
56291
|
const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
|
|
56270
|
-
console.log(
|
|
56292
|
+
console.log(import_chalk13.default.green(`
|
|
56271
56293
|
\u2713 Forwarding localhost:${localPort} to ${workspace.name}:${remotePort}`));
|
|
56272
|
-
console.log(
|
|
56294
|
+
console.log(import_chalk13.default.gray(" Press Ctrl+C to stop.\n"));
|
|
56273
56295
|
await connectSSH(sshToken, sshHost, sshProxyCommand, { localPort, remotePort });
|
|
56274
56296
|
}
|
|
56275
|
-
var
|
|
56297
|
+
var import_chalk13;
|
|
56276
56298
|
var init_tunnel = __esm({
|
|
56277
56299
|
"src/commands/tunnel.ts"() {
|
|
56278
56300
|
"use strict";
|
|
56279
|
-
|
|
56301
|
+
import_chalk13 = __toESM(require("chalk"));
|
|
56280
56302
|
init_command_utils();
|
|
56281
56303
|
init_port();
|
|
56282
56304
|
init_ssh();
|
|
@@ -56290,8 +56312,8 @@ async function orgCommand() {
|
|
|
56290
56312
|
const { organization } = await orgAuthenticatedFetch("/v1/whoami");
|
|
56291
56313
|
output2({ organization }, () => {
|
|
56292
56314
|
console.log(brand.bold("\n Active organization\n"));
|
|
56293
|
-
field("Organization",
|
|
56294
|
-
console.log(
|
|
56315
|
+
field("Organization", import_chalk14.default.bold(organization.name));
|
|
56316
|
+
console.log(import_chalk14.default.gray("\n Fixed by your API key. Use a key from another organization to switch.\n"));
|
|
56295
56317
|
});
|
|
56296
56318
|
return;
|
|
56297
56319
|
}
|
|
@@ -56300,8 +56322,8 @@ async function orgCommand() {
|
|
|
56300
56322
|
const organizations = await fetchOrganizations();
|
|
56301
56323
|
if (!currentOrgId) {
|
|
56302
56324
|
output2({ organization: null }, () => {
|
|
56303
|
-
console.log(
|
|
56304
|
-
console.log(
|
|
56325
|
+
console.log(import_chalk14.default.yellow("\n No organization selected."));
|
|
56326
|
+
console.log(import_chalk14.default.gray(' Run "replicas org switch" to select one.\n'));
|
|
56305
56327
|
});
|
|
56306
56328
|
return;
|
|
56307
56329
|
}
|
|
@@ -56309,8 +56331,8 @@ async function orgCommand() {
|
|
|
56309
56331
|
if (!currentOrg) {
|
|
56310
56332
|
clearOrganizationId();
|
|
56311
56333
|
output2({ organization: null }, () => {
|
|
56312
|
-
console.log(
|
|
56313
|
-
console.log(
|
|
56334
|
+
console.log(import_chalk14.default.yellow("\n The selected organization is no longer available to you."));
|
|
56335
|
+
console.log(import_chalk14.default.gray(' Run "replicas org switch" to select another.\n'));
|
|
56314
56336
|
});
|
|
56315
56337
|
return;
|
|
56316
56338
|
}
|
|
@@ -56323,7 +56345,7 @@ async function orgCommand() {
|
|
|
56323
56345
|
renderIdentity({ account, role, organizationName: currentOrg.name });
|
|
56324
56346
|
if (organizations.length > 1) {
|
|
56325
56347
|
console.log(
|
|
56326
|
-
|
|
56348
|
+
import_chalk14.default.gray(`
|
|
56327
56349
|
${organizations.length} organizations available. "replicas org switch" to change.`)
|
|
56328
56350
|
);
|
|
56329
56351
|
}
|
|
@@ -56346,7 +56368,7 @@ async function orgSwitchCommand() {
|
|
|
56346
56368
|
if (organizations.length > 1) {
|
|
56347
56369
|
const chosen = await promptForOrganization(organizations, currentOrgId);
|
|
56348
56370
|
if (!chosen) {
|
|
56349
|
-
console.log(
|
|
56371
|
+
console.log(import_chalk14.default.yellow("\n Cancelled. The active organization is unchanged.\n"));
|
|
56350
56372
|
return;
|
|
56351
56373
|
}
|
|
56352
56374
|
selectedId = chosen.id;
|
|
@@ -56371,11 +56393,11 @@ async function orgMembersCommand() {
|
|
|
56371
56393
|
}
|
|
56372
56394
|
});
|
|
56373
56395
|
}
|
|
56374
|
-
var
|
|
56396
|
+
var import_chalk14, NOT_LOGGED_IN;
|
|
56375
56397
|
var init_org = __esm({
|
|
56376
56398
|
"src/commands/org.ts"() {
|
|
56377
56399
|
"use strict";
|
|
56378
|
-
|
|
56400
|
+
import_chalk14 = __toESM(require("chalk"));
|
|
56379
56401
|
init_api2();
|
|
56380
56402
|
init_command_utils();
|
|
56381
56403
|
init_oauth_flow_ui();
|
|
@@ -56394,7 +56416,7 @@ function assertKnownKey(key2) {
|
|
|
56394
56416
|
async function configGetCommand(key2) {
|
|
56395
56417
|
ensureOrgApiAuthenticated();
|
|
56396
56418
|
assertKnownKey(key2);
|
|
56397
|
-
output2({ ide: getIdeCommand() }, ({ ide }) => console.log(
|
|
56419
|
+
output2({ ide: getIdeCommand() }, ({ ide }) => console.log(import_chalk15.default.green(`
|
|
56398
56420
|
IDE command: ${ide}
|
|
56399
56421
|
`)));
|
|
56400
56422
|
}
|
|
@@ -56402,7 +56424,7 @@ async function configSetCommand(key2, value) {
|
|
|
56402
56424
|
ensureOrgApiAuthenticated();
|
|
56403
56425
|
assertKnownKey(key2);
|
|
56404
56426
|
setIdeCommand(value);
|
|
56405
|
-
output2({ ide: value }, () => console.log(
|
|
56427
|
+
output2({ ide: value }, () => console.log(import_chalk15.default.green(`
|
|
56406
56428
|
\u2713 IDE command set to: ${value}
|
|
56407
56429
|
`)));
|
|
56408
56430
|
}
|
|
@@ -56411,17 +56433,17 @@ async function configListCommand() {
|
|
|
56411
56433
|
const config3 = readConfig();
|
|
56412
56434
|
if (!config3) throw new Error("No config found. Please login first.");
|
|
56413
56435
|
output2({ organization_id: config3.organization_id ?? null, ide: config3.ide_command ?? null }, () => {
|
|
56414
|
-
console.log(
|
|
56415
|
-
console.log(
|
|
56416
|
-
console.log(
|
|
56436
|
+
console.log(import_chalk15.default.green("\nCurrent configuration:"));
|
|
56437
|
+
console.log(import_chalk15.default.gray(` Organization ID: ${config3.organization_id || (config3.api_key ? "(set by API key)" : "(not set)")}`));
|
|
56438
|
+
console.log(import_chalk15.default.gray(` IDE command: ${config3.ide_command || "code (default)"}`));
|
|
56417
56439
|
console.log();
|
|
56418
56440
|
});
|
|
56419
56441
|
}
|
|
56420
|
-
var
|
|
56442
|
+
var import_chalk15;
|
|
56421
56443
|
var init_config2 = __esm({
|
|
56422
56444
|
"src/commands/config.ts"() {
|
|
56423
56445
|
"use strict";
|
|
56424
|
-
|
|
56446
|
+
import_chalk15 = __toESM(require("chalk"));
|
|
56425
56447
|
init_config();
|
|
56426
56448
|
init_command_utils();
|
|
56427
56449
|
init_output();
|
|
@@ -56607,11 +56629,11 @@ async function withAuthRecovery(operation, afterReauthentication) {
|
|
|
56607
56629
|
throw error62;
|
|
56608
56630
|
}
|
|
56609
56631
|
const message2 = error62 instanceof NotAuthenticatedError ? "You're not signed in to Replicas. Signing in..." : "Your Replicas session expired. Re-authenticating...";
|
|
56610
|
-
console.log(
|
|
56632
|
+
console.log(import_chalk16.default.yellow(`
|
|
56611
56633
|
${message2}`));
|
|
56612
56634
|
await loginCommand();
|
|
56613
56635
|
await afterReauthentication?.();
|
|
56614
|
-
console.log(
|
|
56636
|
+
console.log(import_chalk16.default.gray(" Retrying..."));
|
|
56615
56637
|
return { result: await operation(), reauthenticated: true };
|
|
56616
56638
|
}
|
|
56617
56639
|
}
|
|
@@ -56687,12 +56709,12 @@ async function runCredentialAuthFlow(options, flow) {
|
|
|
56687
56709
|
return completionUrl.toString();
|
|
56688
56710
|
});
|
|
56689
56711
|
}
|
|
56690
|
-
var
|
|
56712
|
+
var import_chalk16, UPLOAD_STEPS;
|
|
56691
56713
|
var init_credential_upload = __esm({
|
|
56692
56714
|
"src/lib/credential-upload.ts"() {
|
|
56693
56715
|
"use strict";
|
|
56694
56716
|
init_urls();
|
|
56695
|
-
|
|
56717
|
+
import_chalk16 = __toESM(require("chalk"));
|
|
56696
56718
|
init_api2();
|
|
56697
56719
|
init_auth();
|
|
56698
56720
|
init_oauth_flow_ui();
|
|
@@ -56760,7 +56782,7 @@ async function promptForAuthorizationCode() {
|
|
|
56760
56782
|
const rl = import_readline.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
56761
56783
|
return new Promise((resolve4) => {
|
|
56762
56784
|
rl.on("close", () => resolve4(""));
|
|
56763
|
-
rl.question(
|
|
56785
|
+
rl.question(import_chalk17.default.gray(" Paste code here: "), (answer) => {
|
|
56764
56786
|
resolve4(answer.trim());
|
|
56765
56787
|
rl.close();
|
|
56766
56788
|
});
|
|
@@ -56836,12 +56858,12 @@ async function runClaudeOAuthFlow(totalSteps) {
|
|
|
56836
56858
|
}
|
|
56837
56859
|
return exchangeCodeForTokens2(code, returnedState, state, pkce.codeVerifier);
|
|
56838
56860
|
}
|
|
56839
|
-
var import_readline,
|
|
56861
|
+
var import_readline, import_chalk17, DEFAULT_CLIENT_ID, CLAUDE_CLIENT_ID, AUTHORIZATION_ENDPOINT2, TOKEN_ENDPOINT2, REDIRECT_URI, SCOPES;
|
|
56840
56862
|
var init_claude_oauth = __esm({
|
|
56841
56863
|
"src/lib/claude-oauth.ts"() {
|
|
56842
56864
|
"use strict";
|
|
56843
56865
|
import_readline = __toESM(require("readline"));
|
|
56844
|
-
|
|
56866
|
+
import_chalk17 = __toESM(require("chalk"));
|
|
56845
56867
|
init_oauth_flow_ui();
|
|
56846
56868
|
init_output();
|
|
56847
56869
|
init_pkce();
|
|
@@ -57077,27 +57099,27 @@ function initCommand(options) {
|
|
|
57077
57099
|
}
|
|
57078
57100
|
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
57101
|
output2({ path: configPath, shadowed_by: higherPriority }, () => {
|
|
57080
|
-
console.log(
|
|
57102
|
+
console.log(import_chalk18.default.green(`\u2713 Created ${targetFilename}`));
|
|
57081
57103
|
for (const filename of higherPriority) {
|
|
57082
57104
|
console.log("");
|
|
57083
|
-
console.log(
|
|
57084
|
-
console.log(
|
|
57105
|
+
console.log(import_chalk18.default.yellow(`Warning: ${filename} already exists and takes priority over ${targetFilename}.`));
|
|
57106
|
+
console.log(import_chalk18.default.gray(`Remove or rename ${filename} for ${targetFilename} to take effect.`));
|
|
57085
57107
|
}
|
|
57086
57108
|
console.log("");
|
|
57087
|
-
console.log(
|
|
57088
|
-
console.log(
|
|
57089
|
-
console.log(
|
|
57109
|
+
console.log(import_chalk18.default.gray("Configuration options:"));
|
|
57110
|
+
console.log(import_chalk18.default.gray(" systemPrompt - Custom instructions for AI coding assistants"));
|
|
57111
|
+
console.log(import_chalk18.default.gray(" startHook - Commands to run on workspace startup"));
|
|
57090
57112
|
if (!isYaml) {
|
|
57091
57113
|
console.log("");
|
|
57092
|
-
console.log(
|
|
57114
|
+
console.log(import_chalk18.default.gray("Tip: Use --yaml for YAML format with multiline system prompt support."));
|
|
57093
57115
|
}
|
|
57094
57116
|
});
|
|
57095
57117
|
}
|
|
57096
|
-
var
|
|
57118
|
+
var import_chalk18, import_fs4, import_path5;
|
|
57097
57119
|
var init_init = __esm({
|
|
57098
57120
|
"src/commands/init.ts"() {
|
|
57099
57121
|
"use strict";
|
|
57100
|
-
|
|
57122
|
+
import_chalk18 = __toESM(require("chalk"));
|
|
57101
57123
|
import_fs4 = __toESM(require("fs"));
|
|
57102
57124
|
import_path5 = __toESM(require("path"));
|
|
57103
57125
|
init_src();
|
|
@@ -57141,10 +57163,10 @@ async function readSecret(service, name) {
|
|
|
57141
57163
|
async function credentialsListCommand(agent) {
|
|
57142
57164
|
const response = await orgAuthenticatedFetch(`/v1/agents/${agent}/credentials`);
|
|
57143
57165
|
output2(response, ({ credentials: credentials2, selected }) => {
|
|
57144
|
-
if (credentials2.length === 0) console.log(
|
|
57166
|
+
if (credentials2.length === 0) console.log(import_chalk19.default.yellow(`No credentials connected for ${agent}.`));
|
|
57145
57167
|
for (const { method, scope } of credentials2) {
|
|
57146
57168
|
const isSelected = selected?.method === method && selected.scope === scope;
|
|
57147
|
-
console.log(`${method} ${scope}${isSelected ?
|
|
57169
|
+
console.log(`${method} ${scope}${isSelected ? import_chalk19.default.green(" (used by new workspaces)") : ""}`);
|
|
57148
57170
|
}
|
|
57149
57171
|
});
|
|
57150
57172
|
}
|
|
@@ -57152,12 +57174,12 @@ async function credentialsGetCommand(service, options) {
|
|
|
57152
57174
|
const status = await orgAuthenticatedFetch(credentialsPath(service, options));
|
|
57153
57175
|
output2(status, ({ hasCredentials, ...fields }) => {
|
|
57154
57176
|
if (!hasCredentials) {
|
|
57155
|
-
console.log(
|
|
57177
|
+
console.log(import_chalk19.default.yellow(`No ${scopeLabel(options)} ${service} credentials.`));
|
|
57156
57178
|
return;
|
|
57157
57179
|
}
|
|
57158
57180
|
const width = Math.max(...Object.keys(fields).map((key2) => key2.length)) + 2;
|
|
57159
57181
|
for (const [key2, value] of Object.entries(fields)) {
|
|
57160
|
-
console.log(`${
|
|
57182
|
+
console.log(`${import_chalk19.default.gray(key2.padEnd(width))}${typeof value === "string" ? value : JSON.stringify(value)}`);
|
|
57161
57183
|
}
|
|
57162
57184
|
});
|
|
57163
57185
|
}
|
|
@@ -57171,35 +57193,35 @@ async function credentialsSetCommand(service, options) {
|
|
|
57171
57193
|
[secretField]: await readSecret(service, secretField === "api_key" ? "API key" : "AWS secret access key")
|
|
57172
57194
|
};
|
|
57173
57195
|
const response = await orgAuthenticatedFetch(path14, { method: "POST", body: body2 });
|
|
57174
|
-
output2(response, () => console.log(
|
|
57196
|
+
output2(response, () => console.log(import_chalk19.default.green(`Saved ${scopeLabel(options)} ${service} credentials.`)));
|
|
57175
57197
|
}
|
|
57176
57198
|
async function credentialsRemoveCommand(service, options) {
|
|
57177
57199
|
const response = await orgAuthenticatedFetch(credentialsPath(service, options), { method: "DELETE" });
|
|
57178
|
-
output2(response, ({ success: success2 }) => console.log(success2 ?
|
|
57200
|
+
output2(response, ({ success: success2 }) => console.log(success2 ? import_chalk19.default.green(`Removed ${scopeLabel(options)} ${service} credentials.`) : `No ${scopeLabel(options)} ${service} credentials to remove.`));
|
|
57179
57201
|
}
|
|
57180
57202
|
async function credentialsUsageCommand({ org: org2, user }) {
|
|
57181
57203
|
const scope = org2 ? "org" : user ? "user" : null;
|
|
57182
57204
|
const response = await orgAuthenticatedFetch(`/v1/agents/subscription-usage${scope ? `?scope=${scope}` : ""}`);
|
|
57183
57205
|
output2(response, ({ accounts }) => {
|
|
57184
|
-
if (accounts.length === 0) console.log(
|
|
57206
|
+
if (accounts.length === 0) console.log(import_chalk19.default.yellow("No Claude or Codex subscriptions connected."));
|
|
57185
57207
|
for (const account of accounts) {
|
|
57186
|
-
const limits = account.reconnectRequired ?
|
|
57208
|
+
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
57209
|
window.kind === "session" ? "5-hour" : "weekly",
|
|
57188
57210
|
window.model,
|
|
57189
57211
|
`${Math.round(window.usedPercent)}%`,
|
|
57190
|
-
window.resetsAt &&
|
|
57212
|
+
window.resetsAt && import_chalk19.default.gray(`(resets ${formatDate(window.resetsAt)})`)
|
|
57191
57213
|
].filter(Boolean).join(" ")).join(", ");
|
|
57192
57214
|
const label = [account.email ?? account.credentialId, account.planType].filter(Boolean).join(" ");
|
|
57193
57215
|
console.log(`${account.provider} ${scopeLabel({ org: account.scope === "org" })} ${label} ${limits}`);
|
|
57194
|
-
if (account.exhaustedUntil) console.log(
|
|
57216
|
+
if (account.exhaustedUntil) console.log(import_chalk19.default.gray(` Workspaces skip this account until ${formatDate(account.exhaustedUntil)}`));
|
|
57195
57217
|
}
|
|
57196
57218
|
});
|
|
57197
57219
|
}
|
|
57198
|
-
var
|
|
57220
|
+
var import_chalk19, OPTIONAL_SECRET_SERVICES, scopeLabel;
|
|
57199
57221
|
var init_credentials2 = __esm({
|
|
57200
57222
|
"src/commands/credentials.ts"() {
|
|
57201
57223
|
"use strict";
|
|
57202
|
-
|
|
57224
|
+
import_chalk19 = __toESM(require("chalk"));
|
|
57203
57225
|
init_src();
|
|
57204
57226
|
init_subscription_usage();
|
|
57205
57227
|
init_api2();
|
|
@@ -57230,7 +57252,7 @@ function startUpdateCheck(currentVersion) {
|
|
|
57230
57252
|
}
|
|
57231
57253
|
const latestVersion = payload.version;
|
|
57232
57254
|
if (compareVersions(latestVersion, currentVersion) > 0) {
|
|
57233
|
-
notice =
|
|
57255
|
+
notice = import_chalk20.default.dim(
|
|
57234
57256
|
`
|
|
57235
57257
|
Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm install -g replicas-cli@latest
|
|
57236
57258
|
`
|
|
@@ -57240,11 +57262,11 @@ Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm in
|
|
|
57240
57262
|
}
|
|
57241
57263
|
})();
|
|
57242
57264
|
}
|
|
57243
|
-
var
|
|
57265
|
+
var import_chalk20, VERSION_CHECK_TIMEOUT;
|
|
57244
57266
|
var init_version_check = __esm({
|
|
57245
57267
|
"src/lib/version-check.ts"() {
|
|
57246
57268
|
"use strict";
|
|
57247
|
-
|
|
57269
|
+
import_chalk20 = __toESM(require("chalk"));
|
|
57248
57270
|
init_src();
|
|
57249
57271
|
init_monolith_url();
|
|
57250
57272
|
init_output();
|
|
@@ -57300,23 +57322,23 @@ async function repositoriesListCommand() {
|
|
|
57300
57322
|
ensureOrgApiAuthenticated();
|
|
57301
57323
|
output2(await orgAuthenticatedFetch("/v1/repositories"), ({ repositories }) => {
|
|
57302
57324
|
if (repositories.length === 0) {
|
|
57303
|
-
console.log(
|
|
57325
|
+
console.log(import_chalk21.default.yellow("\nNo repositories found.\n"));
|
|
57304
57326
|
return;
|
|
57305
57327
|
}
|
|
57306
|
-
console.log(
|
|
57328
|
+
console.log(import_chalk21.default.green(`
|
|
57307
57329
|
Repositories (${repositories.length}):
|
|
57308
57330
|
`));
|
|
57309
57331
|
for (const repo of repositories) {
|
|
57310
|
-
console.log(
|
|
57311
|
-
console.log(
|
|
57312
|
-
console.log(
|
|
57313
|
-
console.log(
|
|
57314
|
-
console.log(
|
|
57332
|
+
console.log(import_chalk21.default.white(` ${repo.name}`));
|
|
57333
|
+
console.log(import_chalk21.default.gray(` ID: ${repo.id}`));
|
|
57334
|
+
console.log(import_chalk21.default.gray(` URL: ${repo.url}`));
|
|
57335
|
+
console.log(import_chalk21.default.gray(` Default Branch: ${repo.default_branch}`));
|
|
57336
|
+
console.log(import_chalk21.default.gray(` Created: ${formatDate(repo.created_at)}`));
|
|
57315
57337
|
if (repo.github_repository_id) {
|
|
57316
|
-
console.log(
|
|
57338
|
+
console.log(import_chalk21.default.gray(` GitHub ID: ${repo.github_repository_id}`));
|
|
57317
57339
|
}
|
|
57318
57340
|
if (repo.gitlab_project_id) {
|
|
57319
|
-
console.log(
|
|
57341
|
+
console.log(import_chalk21.default.gray(` GitLab Project ID: ${repo.gitlab_project_id}`));
|
|
57320
57342
|
}
|
|
57321
57343
|
console.log();
|
|
57322
57344
|
}
|
|
@@ -57403,15 +57425,15 @@ async function repositoriesImportGroupCommand(group, options) {
|
|
|
57403
57425
|
res.already_connected > 0 ? `${res.already_connected} already connected` : null,
|
|
57404
57426
|
res.failed.length > 0 ? `${res.failed.length} failed` : null
|
|
57405
57427
|
].filter(Boolean);
|
|
57406
|
-
console.log(
|
|
57428
|
+
console.log(import_chalk21.default.green(`
|
|
57407
57429
|
Imported GitLab group ${res.group}: ${parts.join(", ")} (${res.total} total).
|
|
57408
57430
|
`));
|
|
57409
57431
|
if (res.has_more) {
|
|
57410
|
-
console.log(
|
|
57432
|
+
console.log(import_chalk21.default.yellow("Warning: GitLab returned more projects than the page limit. Import specific subgroups to connect the rest.\n"));
|
|
57411
57433
|
}
|
|
57412
57434
|
if (res.failed.length > 0) {
|
|
57413
57435
|
for (const failure2 of res.failed) {
|
|
57414
|
-
console.log(
|
|
57436
|
+
console.log(import_chalk21.default.red(` \u2717 ${failure2.path}: ${failure2.error}`));
|
|
57415
57437
|
}
|
|
57416
57438
|
console.log();
|
|
57417
57439
|
}
|
|
@@ -57434,11 +57456,11 @@ async function repositoriesBranchesCommand(repository) {
|
|
|
57434
57456
|
for (const branch of branches) console.log(branch);
|
|
57435
57457
|
});
|
|
57436
57458
|
}
|
|
57437
|
-
var
|
|
57459
|
+
var import_chalk21, splitList;
|
|
57438
57460
|
var init_repositories2 = __esm({
|
|
57439
57461
|
"src/commands/repositories.ts"() {
|
|
57440
57462
|
"use strict";
|
|
57441
|
-
|
|
57463
|
+
import_chalk21 = __toESM(require("chalk"));
|
|
57442
57464
|
init_api2();
|
|
57443
57465
|
init_command_utils();
|
|
57444
57466
|
init_output();
|
|
@@ -57467,23 +57489,23 @@ async function resolveEnvironmentId(input2) {
|
|
|
57467
57489
|
return resolved.id;
|
|
57468
57490
|
}
|
|
57469
57491
|
function printEnvironment(env, repoSkillCount) {
|
|
57470
|
-
console.log(
|
|
57471
|
-
console.log(
|
|
57492
|
+
console.log(import_chalk22.default.white(` ${env.name}${env.user_id ? import_chalk22.default.gray(" (personal)") : ""}`));
|
|
57493
|
+
console.log(import_chalk22.default.gray(` ID: ${env.id}`));
|
|
57472
57494
|
if (env.description) {
|
|
57473
|
-
console.log(
|
|
57495
|
+
console.log(import_chalk22.default.gray(` Description: ${env.description}`));
|
|
57474
57496
|
}
|
|
57475
57497
|
const repositoryIds = env.repository_ids ?? [];
|
|
57476
57498
|
if (repositoryIds.length > 0) {
|
|
57477
|
-
console.log(
|
|
57499
|
+
console.log(import_chalk22.default.gray(` Repositories: ${repositoryIds.join(", ")}`));
|
|
57478
57500
|
}
|
|
57479
|
-
console.log(
|
|
57501
|
+
console.log(import_chalk22.default.gray(` Setup source: ${env.setup_source_mode}`));
|
|
57480
57502
|
if (env.variable_count !== void 0) {
|
|
57481
|
-
console.log(
|
|
57503
|
+
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
57504
|
}
|
|
57483
57505
|
if (repoSkillCount !== void 0) {
|
|
57484
|
-
console.log(
|
|
57506
|
+
console.log(import_chalk22.default.gray(` Repository skills: ${repoSkillCount}`));
|
|
57485
57507
|
}
|
|
57486
|
-
console.log(
|
|
57508
|
+
console.log(import_chalk22.default.gray(` Updated: ${formatDate(env.updated_at)}`));
|
|
57487
57509
|
console.log();
|
|
57488
57510
|
}
|
|
57489
57511
|
async function environmentListCommand() {
|
|
@@ -57491,10 +57513,10 @@ async function environmentListCommand() {
|
|
|
57491
57513
|
const response = await orgAuthenticatedFetch("/v1/environments?scope=all");
|
|
57492
57514
|
output2(response, ({ environments }) => {
|
|
57493
57515
|
if (environments.length === 0) {
|
|
57494
|
-
console.log(
|
|
57516
|
+
console.log(import_chalk22.default.yellow("\nNo environments found.\n"));
|
|
57495
57517
|
return;
|
|
57496
57518
|
}
|
|
57497
|
-
console.log(
|
|
57519
|
+
console.log(import_chalk22.default.green(`
|
|
57498
57520
|
Environments (${environments.length}):
|
|
57499
57521
|
`));
|
|
57500
57522
|
for (const env of environments) printEnvironment(env);
|
|
@@ -57506,13 +57528,13 @@ async function environmentGetCommand(idOrName) {
|
|
|
57506
57528
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}`);
|
|
57507
57529
|
const repoSkills = await orgAuthenticatedFetch(`/v1/environments/${response.environment.id}/repo-skills`);
|
|
57508
57530
|
output2({ ...response, ...repoSkills }, ({ environment: environment2 }) => {
|
|
57509
|
-
console.log(
|
|
57531
|
+
console.log(import_chalk22.default.green(`
|
|
57510
57532
|
Environment: ${environment2.name}
|
|
57511
57533
|
`));
|
|
57512
57534
|
const linkedSkills = repoSkills.repo_skills.filter((skill) => skill.path.startsWith(`.${skill.framework}/skills/`));
|
|
57513
57535
|
printEnvironment(environment2, new Set(linkedSkills.map((skill) => `${skill.repository_id}:${skill.path.split("/")[2]}`)).size);
|
|
57514
57536
|
for (const message2 of [repoSkills.error, ...repoSkills.repo_errors.map((repo) => `${repo.repository_full_name}: ${repo.error}`)]) {
|
|
57515
|
-
if (message2) console.log(
|
|
57537
|
+
if (message2) console.log(import_chalk22.default.yellow(` Could not read repository skills: ${message2}`));
|
|
57516
57538
|
}
|
|
57517
57539
|
});
|
|
57518
57540
|
}
|
|
@@ -57527,7 +57549,7 @@ async function environmentCreateCommand(name, options) {
|
|
|
57527
57549
|
validate: (v2) => v2.trim() ? true : "Name is required"
|
|
57528
57550
|
});
|
|
57529
57551
|
if (!r.name) {
|
|
57530
|
-
console.log(
|
|
57552
|
+
console.log(import_chalk22.default.yellow("\nCancelled."));
|
|
57531
57553
|
return;
|
|
57532
57554
|
}
|
|
57533
57555
|
envName = r.name;
|
|
@@ -57561,9 +57583,9 @@ async function environmentCreateCommand(name, options) {
|
|
|
57561
57583
|
body: body2
|
|
57562
57584
|
});
|
|
57563
57585
|
output2(response, ({ environment: environment2 }) => {
|
|
57564
|
-
console.log(
|
|
57586
|
+
console.log(import_chalk22.default.green(`
|
|
57565
57587
|
Created environment: ${environment2.name}`));
|
|
57566
|
-
console.log(
|
|
57588
|
+
console.log(import_chalk22.default.gray(` ID: ${environment2.id}
|
|
57567
57589
|
`));
|
|
57568
57590
|
});
|
|
57569
57591
|
}
|
|
@@ -57588,7 +57610,7 @@ async function environmentEditCommand(idOrName, options) {
|
|
|
57588
57610
|
method: "PATCH",
|
|
57589
57611
|
body: body2
|
|
57590
57612
|
});
|
|
57591
|
-
output2(response, ({ environment: environment2 }) => console.log(
|
|
57613
|
+
output2(response, ({ environment: environment2 }) => console.log(import_chalk22.default.green(`
|
|
57592
57614
|
Updated environment: ${environment2.name}
|
|
57593
57615
|
`)));
|
|
57594
57616
|
}
|
|
@@ -57602,11 +57624,11 @@ Deleted environment ${idOrName}.
|
|
|
57602
57624
|
`);
|
|
57603
57625
|
}
|
|
57604
57626
|
function printVariable(v2) {
|
|
57605
|
-
console.log(
|
|
57606
|
-
console.log(
|
|
57607
|
-
console.log(
|
|
57608
|
-
if (v2.proxy_hosts.length > 0) console.log(
|
|
57609
|
-
console.log(
|
|
57627
|
+
console.log(import_chalk22.default.white(` ${v2.key}`));
|
|
57628
|
+
console.log(import_chalk22.default.gray(` ID: ${v2.id}`));
|
|
57629
|
+
console.log(import_chalk22.default.gray(` Value: ${v2.value}`));
|
|
57630
|
+
if (v2.proxy_hosts.length > 0) console.log(import_chalk22.default.gray(` Proxied to: ${v2.proxy_hosts.join(", ")}`));
|
|
57631
|
+
console.log(import_chalk22.default.gray(` Updated: ${formatDate(v2.updated_at)}`));
|
|
57610
57632
|
console.log();
|
|
57611
57633
|
}
|
|
57612
57634
|
async function envVarsListCommand(envIdOrName, options) {
|
|
@@ -57618,14 +57640,14 @@ async function envVarsListCommand(envIdOrName, options) {
|
|
|
57618
57640
|
const variables = options.reveal ? response.environment_variables : response.environment_variables.map((v2) => ({ ...v2, value: maskValue(v2.value) }));
|
|
57619
57641
|
output2({ environment_variables: variables }, ({ environment_variables }) => {
|
|
57620
57642
|
if (environment_variables.length === 0) {
|
|
57621
|
-
console.log(
|
|
57643
|
+
console.log(import_chalk22.default.yellow("\nNo variables.\n"));
|
|
57622
57644
|
return;
|
|
57623
57645
|
}
|
|
57624
|
-
console.log(
|
|
57646
|
+
console.log(import_chalk22.default.green(`
|
|
57625
57647
|
Variables (${environment_variables.length}):
|
|
57626
57648
|
`));
|
|
57627
57649
|
if (!options.reveal) {
|
|
57628
|
-
console.log(
|
|
57650
|
+
console.log(import_chalk22.default.gray(" Values are masked. Pass --reveal to show full values.\n"));
|
|
57629
57651
|
}
|
|
57630
57652
|
for (const v2 of environment_variables) printVariable(v2);
|
|
57631
57653
|
});
|
|
@@ -57640,13 +57662,8 @@ async function envVarsProxyCommand(envIdOrName, key2, hosts) {
|
|
|
57640
57662
|
const match = await findVariableByKey(id, key2);
|
|
57641
57663
|
if (!match) throw new Error(`No variable named ${key2} in this environment`);
|
|
57642
57664
|
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(`
|
|
57665
|
+
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/variables/${match.id}`, { method: "PATCH", body: body2 });
|
|
57666
|
+
output2(response, (result) => console.log(import_chalk22.default.green(`
|
|
57650
57667
|
${key2} is ${result.environment_variable.proxy_hosts.length > 0 ? `sent only to ${result.environment_variable.proxy_hosts.join(", ")}` : "no longer proxied"}.
|
|
57651
57668
|
`)));
|
|
57652
57669
|
}
|
|
@@ -57660,7 +57677,7 @@ async function envVarsSetCommand(envIdOrName, key2, value, options) {
|
|
|
57660
57677
|
`/v1/environments/${id}/variables/${match.id}`,
|
|
57661
57678
|
{ method: "PATCH", body: body3 }
|
|
57662
57679
|
);
|
|
57663
|
-
output2({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
57680
|
+
output2({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk22.default.green(`
|
|
57664
57681
|
Updated variable ${environment_variable.key}.
|
|
57665
57682
|
`)));
|
|
57666
57683
|
return;
|
|
@@ -57675,7 +57692,7 @@ Updated variable ${environment_variable.key}.
|
|
|
57675
57692
|
`/v1/environments/${id}/variables`,
|
|
57676
57693
|
{ method: "POST", body: body2 }
|
|
57677
57694
|
);
|
|
57678
|
-
output2({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
57695
|
+
output2({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk22.default.green(`
|
|
57679
57696
|
Created variable ${environment_variable.key}.
|
|
57680
57697
|
`)));
|
|
57681
57698
|
}
|
|
@@ -57710,15 +57727,15 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57710
57727
|
const local = parsePosixEnvFile(readRuntimeEnv());
|
|
57711
57728
|
const available = options.replace ? [] : keys.filter((key2) => Object.hasOwn(local, key2) && local[key2].length > 0);
|
|
57712
57729
|
const wanted = keys.filter((key2) => !available.includes(key2));
|
|
57713
|
-
const loadHint =
|
|
57730
|
+
const loadHint = import_chalk22.default.gray(`
|
|
57714
57731
|
Values are never printed. Load them into a command with: . ~/.replicas/runtime-env.sh && <command>
|
|
57715
57732
|
`);
|
|
57716
57733
|
if (wanted.length === 0) {
|
|
57717
57734
|
output2({ status: "provided", exported: available, missing: [] }, () => {
|
|
57718
57735
|
console.log(`
|
|
57719
|
-
${
|
|
57736
|
+
${import_chalk22.default.green("Already available:")} ${available.join(", ")}`);
|
|
57720
57737
|
console.log(loadHint);
|
|
57721
|
-
console.log(
|
|
57738
|
+
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
57739
|
});
|
|
57723
57740
|
return;
|
|
57724
57741
|
}
|
|
@@ -57754,11 +57771,11 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57754
57771
|
console.log("");
|
|
57755
57772
|
if (exported.length > 0 || available.length > 0) {
|
|
57756
57773
|
const where = request2.destination === "workspace" ? "this workspace only" : "saved to the environment";
|
|
57757
|
-
console.log(` ${
|
|
57774
|
+
console.log(` ${import_chalk22.default.green("Provided:")} ${[...available, ...exported].join(", ")} ${import_chalk22.default.gray(`(${where})`)}`);
|
|
57758
57775
|
}
|
|
57759
57776
|
if (request2.status === "pending") {
|
|
57760
|
-
console.log(` ${
|
|
57761
|
-
console.log(
|
|
57777
|
+
console.log(` ${import_chalk22.default.yellow("Still waiting for:")} ${missing.join(", ")}`);
|
|
57778
|
+
console.log(import_chalk22.default.gray(options.wait === false ? `
|
|
57762
57779
|
Asked above the chat composer (${created2.url}). Keep working, and run this command again when you need the values.
|
|
57763
57780
|
` : created2.wait ? `
|
|
57764
57781
|
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 +57785,21 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57768
57785
|
`));
|
|
57769
57786
|
return;
|
|
57770
57787
|
}
|
|
57771
|
-
if (missing.length > 0) console.log(` ${
|
|
57788
|
+
if (missing.length > 0) console.log(` ${import_chalk22.default.gray(request2.status === "skipped" ? "Skipped by the user:" : "Not provided:")} ${missing.join(", ")}`);
|
|
57772
57789
|
if (exported.length === 0) {
|
|
57773
|
-
console.log(
|
|
57790
|
+
console.log(import_chalk22.default.gray("\n Continue without them, or ask the user how they want to proceed.\n"));
|
|
57774
57791
|
return;
|
|
57775
57792
|
}
|
|
57776
57793
|
console.log(loadHint);
|
|
57777
|
-
if (options.replace) console.log(
|
|
57794
|
+
if (options.replace) console.log(import_chalk22.default.gray(" Leave out --replace from now on; running it again asks the user again.\n"));
|
|
57778
57795
|
});
|
|
57779
57796
|
}
|
|
57780
57797
|
function printFile(f) {
|
|
57781
|
-
console.log(
|
|
57782
|
-
console.log(
|
|
57783
|
-
console.log(
|
|
57784
|
-
console.log(
|
|
57785
|
-
console.log(
|
|
57798
|
+
console.log(import_chalk22.default.white(` ${f.path}`));
|
|
57799
|
+
console.log(import_chalk22.default.gray(` ID: ${f.id}`));
|
|
57800
|
+
console.log(import_chalk22.default.gray(` Name: ${f.name}`));
|
|
57801
|
+
console.log(import_chalk22.default.gray(` Size: ${f.content.length} bytes`));
|
|
57802
|
+
console.log(import_chalk22.default.gray(` Updated: ${formatDate(f.updated_at)}`));
|
|
57786
57803
|
console.log();
|
|
57787
57804
|
}
|
|
57788
57805
|
async function envFilesListCommand(envIdOrName) {
|
|
@@ -57793,10 +57810,10 @@ async function envFilesListCommand(envIdOrName) {
|
|
|
57793
57810
|
);
|
|
57794
57811
|
output2(response, ({ environment_files }) => {
|
|
57795
57812
|
if (environment_files.length === 0) {
|
|
57796
|
-
console.log(
|
|
57813
|
+
console.log(import_chalk22.default.yellow("\nNo files.\n"));
|
|
57797
57814
|
return;
|
|
57798
57815
|
}
|
|
57799
|
-
console.log(
|
|
57816
|
+
console.log(import_chalk22.default.green(`
|
|
57800
57817
|
Files (${environment_files.length}):
|
|
57801
57818
|
`));
|
|
57802
57819
|
for (const f of environment_files) printFile(f);
|
|
@@ -57828,7 +57845,7 @@ async function envFilesSetCommand(envIdOrName, destinationPath, options) {
|
|
|
57828
57845
|
`/v1/environments/${id}/files/${match.id}`,
|
|
57829
57846
|
{ method: "PATCH", body: body3 }
|
|
57830
57847
|
);
|
|
57831
|
-
output2(response2, ({ environment_file }) => console.log(
|
|
57848
|
+
output2(response2, ({ environment_file }) => console.log(import_chalk22.default.green(`
|
|
57832
57849
|
Updated file ${environment_file.path}.
|
|
57833
57850
|
`)));
|
|
57834
57851
|
return;
|
|
@@ -57843,7 +57860,7 @@ Updated file ${environment_file.path}.
|
|
|
57843
57860
|
`/v1/environments/${id}/files`,
|
|
57844
57861
|
{ method: "POST", body: body2 }
|
|
57845
57862
|
);
|
|
57846
|
-
output2(response, ({ environment_file }) => console.log(
|
|
57863
|
+
output2(response, ({ environment_file }) => console.log(import_chalk22.default.green(`
|
|
57847
57864
|
Created file ${environment_file.path}.
|
|
57848
57865
|
`)));
|
|
57849
57866
|
}
|
|
@@ -57873,16 +57890,16 @@ async function envHookGetCommand(envIdOrName, kind) {
|
|
|
57873
57890
|
const hook = kind === "warm" ? (await orgAuthenticatedFetch(`/v1/environments/${id}/warm-hooks`)).warm_hook : (await orgAuthenticatedFetch(`/v1/environments/${id}/start-hooks`)).start_hook;
|
|
57874
57891
|
output2({ hook }, () => {
|
|
57875
57892
|
if (!hook) {
|
|
57876
|
-
console.log(
|
|
57893
|
+
console.log(import_chalk22.default.yellow(`
|
|
57877
57894
|
No ${kind} hook configured.
|
|
57878
57895
|
`));
|
|
57879
57896
|
return;
|
|
57880
57897
|
}
|
|
57881
|
-
console.log(
|
|
57898
|
+
console.log(import_chalk22.default.green(`
|
|
57882
57899
|
${kind === "warm" ? "Warm" : "Start"} hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
57883
57900
|
`));
|
|
57884
|
-
console.log(
|
|
57885
|
-
console.log(
|
|
57901
|
+
console.log(import_chalk22.default.gray(` ID: ${hook.id}`));
|
|
57902
|
+
console.log(import_chalk22.default.gray(` Created: ${formatDate(hook.created_at)}
|
|
57886
57903
|
`));
|
|
57887
57904
|
console.log(hook.content);
|
|
57888
57905
|
console.log();
|
|
@@ -57898,7 +57915,7 @@ async function envHookSaveCommand(envIdOrName, options, kind) {
|
|
|
57898
57915
|
`/v1/environments/${id}/warm-hooks/save`,
|
|
57899
57916
|
{ method: "POST", body: body3 }
|
|
57900
57917
|
);
|
|
57901
|
-
output2(response2, ({ warm_hook }) => console.log(
|
|
57918
|
+
output2(response2, ({ warm_hook }) => console.log(import_chalk22.default.green(warm_hook ? `
|
|
57902
57919
|
Saved warm hook v${warm_hook.version}.
|
|
57903
57920
|
` : "\nCleared warm hook.\n")));
|
|
57904
57921
|
return;
|
|
@@ -57908,7 +57925,7 @@ Saved warm hook v${warm_hook.version}.
|
|
|
57908
57925
|
`/v1/environments/${id}/start-hooks/save`,
|
|
57909
57926
|
{ method: "POST", body: body2 }
|
|
57910
57927
|
);
|
|
57911
|
-
output2(response, ({ start_hook }) => console.log(
|
|
57928
|
+
output2(response, ({ start_hook }) => console.log(import_chalk22.default.green(start_hook ? `
|
|
57912
57929
|
Saved start hook v${start_hook.version}.
|
|
57913
57930
|
` : "\nCleared start hook.\n")));
|
|
57914
57931
|
}
|
|
@@ -57926,7 +57943,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
57926
57943
|
body: kind === "warm" ? { content, mode: options.save ? "save_test" : "test_only" } : { content },
|
|
57927
57944
|
onEvent: (event) => {
|
|
57928
57945
|
if (event.type === "progress" && event.message) {
|
|
57929
|
-
console.log(
|
|
57946
|
+
console.log(import_chalk22.default.gray(event.message));
|
|
57930
57947
|
} else if (event.type === "output" && event.output) {
|
|
57931
57948
|
logs += event.output;
|
|
57932
57949
|
if (!isJsonMode()) process.stdout.write(event.output);
|
|
@@ -57943,7 +57960,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
57943
57960
|
const label = kind === "warm" ? "Warm" : "Start";
|
|
57944
57961
|
const passed = !timedOut && exitCode === 0;
|
|
57945
57962
|
output2({ passed, exit_code: exitCode, timed_out: timedOut, saved: passed && !!options.save, output: logs }, () => {
|
|
57946
|
-
if (passed) console.log(
|
|
57963
|
+
if (passed) console.log(import_chalk22.default.green(`
|
|
57947
57964
|
${label} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
|
|
57948
57965
|
`));
|
|
57949
57966
|
});
|
|
@@ -57960,24 +57977,24 @@ async function envHookRepositoryHooksCommand(envIdOrName, kind) {
|
|
|
57960
57977
|
)).repositories.map((repository) => ({ ...repository, hook: repository.start_hook }));
|
|
57961
57978
|
output2({ repositories }, () => {
|
|
57962
57979
|
if (repositories.length === 0) {
|
|
57963
|
-
console.log(
|
|
57980
|
+
console.log(import_chalk22.default.yellow("\nNo repositories bound to this environment.\n"));
|
|
57964
57981
|
return;
|
|
57965
57982
|
}
|
|
57966
|
-
console.log(
|
|
57983
|
+
console.log(import_chalk22.default.green(`
|
|
57967
57984
|
Repository ${kind} hooks (${repositories.length}):
|
|
57968
57985
|
`));
|
|
57969
57986
|
for (const repo of repositories) {
|
|
57970
|
-
console.log(
|
|
57987
|
+
console.log(import_chalk22.default.white(` ${repo.repository_name} @${repo.default_branch}`));
|
|
57971
57988
|
if (repo.error) {
|
|
57972
|
-
console.log(
|
|
57989
|
+
console.log(import_chalk22.default.red(` Error: ${repo.error}`));
|
|
57973
57990
|
} else if (repo.hook) {
|
|
57974
|
-
console.log(
|
|
57975
|
-
console.log(
|
|
57991
|
+
console.log(import_chalk22.default.gray(` Source: ${repo.filename ?? "(unknown)"}`));
|
|
57992
|
+
console.log(import_chalk22.default.gray(` Commands (${repo.hook.commands.length}):`));
|
|
57976
57993
|
for (const cmd of repo.hook.commands) {
|
|
57977
|
-
console.log(
|
|
57994
|
+
console.log(import_chalk22.default.gray(` ${cmd}`));
|
|
57978
57995
|
}
|
|
57979
57996
|
} else {
|
|
57980
|
-
console.log(
|
|
57997
|
+
console.log(import_chalk22.default.gray(` No ${kind}Hook defined.`));
|
|
57981
57998
|
}
|
|
57982
57999
|
console.log();
|
|
57983
58000
|
}
|
|
@@ -58019,7 +58036,7 @@ async function envSkillsAddCommand(env, source, slug2, options) {
|
|
|
58019
58036
|
const id = await resolveEnvironmentId(env);
|
|
58020
58037
|
const body2 = { environment_id: id, source, slug: slug2, name: options.name ?? slug2 };
|
|
58021
58038
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/skills`, { method: "POST", body: body2 });
|
|
58022
|
-
output2(response, () => console.log(
|
|
58039
|
+
output2(response, () => console.log(import_chalk22.default.green(`Added skill ${slug2} from ${source}`)));
|
|
58023
58040
|
}
|
|
58024
58041
|
async function envSkillsRemoveCommand(env, slugOrId) {
|
|
58025
58042
|
const id = await resolveEnvironmentId(env);
|
|
@@ -58047,7 +58064,7 @@ async function envMcpsAddCommand(env, name, options) {
|
|
|
58047
58064
|
const id = await resolveEnvironmentId(env);
|
|
58048
58065
|
const body2 = { environment_id: id, name, ...server };
|
|
58049
58066
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/mcps`, { method: "POST", body: body2 });
|
|
58050
|
-
output2(response, () => console.log(
|
|
58067
|
+
output2(response, () => console.log(import_chalk22.default.green(`Added MCP server ${name}`)));
|
|
58051
58068
|
}
|
|
58052
58069
|
async function envMcpsRemoveCommand(env, nameOrId) {
|
|
58053
58070
|
const id = await resolveEnvironmentId(env);
|
|
@@ -58063,13 +58080,13 @@ async function envDevicesListCommand(env) {
|
|
|
58063
58080
|
);
|
|
58064
58081
|
output2(response, ({ environment_devices }) => {
|
|
58065
58082
|
if (environment_devices.length === 0) {
|
|
58066
|
-
console.log(
|
|
58083
|
+
console.log(import_chalk22.default.yellow(`
|
|
58067
58084
|
No devices. Add one with: replicas env devices add ${env} <name> --user <user>
|
|
58068
58085
|
`));
|
|
58069
58086
|
return;
|
|
58070
58087
|
}
|
|
58071
58088
|
for (const device of environment_devices) {
|
|
58072
|
-
const status = isDeviceOnline(device.last_seen_at) ?
|
|
58089
|
+
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
58090
|
console.log(`${device.id} ${device.name} ${device.host === null ? `${device.username}, connects from the device ${status}` : `${device.username}@${device.host}:${device.port}`}`);
|
|
58074
58091
|
}
|
|
58075
58092
|
});
|
|
@@ -58080,10 +58097,10 @@ async function envDevicesAddCommand(env, name, options) {
|
|
|
58080
58097
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`, { method: "POST", body: body2 });
|
|
58081
58098
|
const connect2 = options.host === void 0 ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${response.environment_device.id}/connect-token`) : void 0;
|
|
58082
58099
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
58083
|
-
console.log(
|
|
58100
|
+
console.log(import_chalk22.default.green(`Added device ${name}. Allow its key by running this on the device as ${options.user}:`));
|
|
58084
58101
|
console.log(`mkdir -p ~/.ssh && echo '${environment_device.public_key}' >> ~/.ssh/authorized_keys`);
|
|
58085
58102
|
if (connect_token) {
|
|
58086
|
-
console.log(
|
|
58103
|
+
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
58104
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
58088
58105
|
console.log(connect_token);
|
|
58089
58106
|
}
|
|
@@ -58101,9 +58118,9 @@ async function envDevicesEditCommand(env, nameOrId, options) {
|
|
|
58101
58118
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}`, { method: "PATCH", body: body2 });
|
|
58102
58119
|
const connect2 = device.host !== null && response.environment_device.host === null ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`) : void 0;
|
|
58103
58120
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
58104
|
-
console.log(
|
|
58121
|
+
console.log(import_chalk22.default.green(`Updated device ${environment_device.name}. Workspaces started from now on get the change.`));
|
|
58105
58122
|
if (connect_token) {
|
|
58106
|
-
console.log(
|
|
58123
|
+
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
58124
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
58108
58125
|
console.log(connect_token);
|
|
58109
58126
|
}
|
|
@@ -58124,7 +58141,7 @@ async function envDevicesResetCommand(env, nameOrId) {
|
|
|
58124
58141
|
if (!device) throw new Error(`Device not found: ${nameOrId}`);
|
|
58125
58142
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`, { method: "POST" });
|
|
58126
58143
|
output2(response, ({ token }) => {
|
|
58127
|
-
console.log(
|
|
58144
|
+
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
58145
|
console.log(DEVICE_CONNECT_COMMAND);
|
|
58129
58146
|
console.log(token);
|
|
58130
58147
|
});
|
|
@@ -58134,17 +58151,17 @@ function envWarmPoolCommand(enabled) {
|
|
|
58134
58151
|
const id = await resolveEnvironmentId(env);
|
|
58135
58152
|
const body2 = { environment_id: id, enabled };
|
|
58136
58153
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/warm-pools`, { method: "PUT", body: body2 });
|
|
58137
|
-
output2(response, () => console.log(
|
|
58154
|
+
output2(response, () => console.log(import_chalk22.default.green(`Warm pool ${enabled ? "enabled" : "disabled"}`)));
|
|
58138
58155
|
};
|
|
58139
58156
|
}
|
|
58140
|
-
var import_fs5, import_os3, import_path6,
|
|
58157
|
+
var import_fs5, import_os3, import_path6, import_chalk22, RUNTIME_ENV_FILE;
|
|
58141
58158
|
var init_environment3 = __esm({
|
|
58142
58159
|
"src/commands/environment.ts"() {
|
|
58143
58160
|
"use strict";
|
|
58144
58161
|
import_fs5 = __toESM(require("fs"));
|
|
58145
58162
|
import_os3 = __toESM(require("os"));
|
|
58146
58163
|
import_path6 = __toESM(require("path"));
|
|
58147
|
-
|
|
58164
|
+
import_chalk22 = __toESM(require("chalk"));
|
|
58148
58165
|
init_api2();
|
|
58149
58166
|
init_command_utils();
|
|
58150
58167
|
init_output();
|
|
@@ -58164,101 +58181,101 @@ function parseReplicaAgent(value) {
|
|
|
58164
58181
|
throw new Error(`Invalid coding agent: ${value}. Must be one of: ${CLI_CODING_AGENT_LABEL}`);
|
|
58165
58182
|
}
|
|
58166
58183
|
function formatStatus(status) {
|
|
58167
|
-
if (status === "active") return
|
|
58168
|
-
if (isWorkspaceSuspendedStatus(status)) return
|
|
58184
|
+
if (status === "active") return import_chalk23.default.green(status);
|
|
58185
|
+
if (isWorkspaceSuspendedStatus(status)) return import_chalk23.default.gray(status);
|
|
58169
58186
|
return status;
|
|
58170
58187
|
}
|
|
58171
58188
|
function formatDisplayMessage(message2) {
|
|
58172
58189
|
const time3 = new Date(message2.timestamp).toLocaleTimeString();
|
|
58173
58190
|
switch (message2.type) {
|
|
58174
58191
|
case "user":
|
|
58175
|
-
console.log(
|
|
58192
|
+
console.log(import_chalk23.default.blue(`
|
|
58176
58193
|
[${time3}] USER:`));
|
|
58177
|
-
console.log(
|
|
58194
|
+
console.log(import_chalk23.default.white(` ${truncate(userMessageText(message2), 500)}`));
|
|
58178
58195
|
break;
|
|
58179
58196
|
case "agent":
|
|
58180
|
-
console.log(
|
|
58197
|
+
console.log(import_chalk23.default.green(`
|
|
58181
58198
|
[${time3}] ASSISTANT:`));
|
|
58182
|
-
console.log(
|
|
58199
|
+
console.log(import_chalk23.default.white(` ${truncate(message2.content, 500)}`));
|
|
58183
58200
|
break;
|
|
58184
58201
|
case "reasoning":
|
|
58185
|
-
console.log(
|
|
58202
|
+
console.log(import_chalk23.default.gray(`
|
|
58186
58203
|
[${time3}] THINKING:`));
|
|
58187
|
-
console.log(
|
|
58204
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.content, 300)}`));
|
|
58188
58205
|
break;
|
|
58189
58206
|
case "command":
|
|
58190
|
-
console.log(
|
|
58207
|
+
console.log(import_chalk23.default.magenta(`
|
|
58191
58208
|
[${time3}] COMMAND:`));
|
|
58192
|
-
console.log(
|
|
58209
|
+
console.log(import_chalk23.default.white(` $ ${message2.command}`));
|
|
58193
58210
|
if (message2.output) {
|
|
58194
|
-
console.log(
|
|
58211
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.output, 200)}`));
|
|
58195
58212
|
}
|
|
58196
58213
|
if (message2.exitCode !== void 0) {
|
|
58197
|
-
const exitColor = message2.exitCode === 0 ?
|
|
58214
|
+
const exitColor = message2.exitCode === 0 ? import_chalk23.default.green : import_chalk23.default.red;
|
|
58198
58215
|
console.log(exitColor(` Exit code: ${message2.exitCode}`));
|
|
58199
58216
|
}
|
|
58200
58217
|
break;
|
|
58201
58218
|
case "file_change":
|
|
58202
|
-
console.log(
|
|
58219
|
+
console.log(import_chalk23.default.yellow(`
|
|
58203
58220
|
[${time3}] FILE CHANGES:`));
|
|
58204
58221
|
for (const change2 of message2.changes) {
|
|
58205
58222
|
const icon = change2.kind === "add" ? "+" : change2.kind === "delete" ? "-" : "~";
|
|
58206
|
-
const color = change2.kind === "add" ?
|
|
58223
|
+
const color = change2.kind === "add" ? import_chalk23.default.green : change2.kind === "delete" ? import_chalk23.default.red : import_chalk23.default.yellow;
|
|
58207
58224
|
console.log(color(` ${icon} ${change2.path}`));
|
|
58208
58225
|
}
|
|
58209
58226
|
break;
|
|
58210
58227
|
case "patch":
|
|
58211
|
-
console.log(
|
|
58228
|
+
console.log(import_chalk23.default.yellow(`
|
|
58212
58229
|
[${time3}] PATCH:`));
|
|
58213
58230
|
for (const op of message2.operations) {
|
|
58214
58231
|
const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
|
|
58215
|
-
const color = op.action === "add" ?
|
|
58232
|
+
const color = op.action === "add" ? import_chalk23.default.green : op.action === "delete" ? import_chalk23.default.red : import_chalk23.default.yellow;
|
|
58216
58233
|
console.log(color(` ${icon} ${op.path}`));
|
|
58217
58234
|
}
|
|
58218
58235
|
break;
|
|
58219
58236
|
case "tool_call":
|
|
58220
|
-
console.log(
|
|
58237
|
+
console.log(import_chalk23.default.cyan(`
|
|
58221
58238
|
[${time3}] TOOL: ${message2.tool}`));
|
|
58222
58239
|
if (message2.output) {
|
|
58223
|
-
console.log(
|
|
58240
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.output, 200)}`));
|
|
58224
58241
|
}
|
|
58225
58242
|
if (message2.inputRequest?.status === "pending") {
|
|
58226
58243
|
const { requestId, options, questions } = message2.inputRequest;
|
|
58227
|
-
console.log(
|
|
58228
|
-
for (const option of options ?? []) console.log(
|
|
58244
|
+
console.log(import_chalk23.default.yellow(` Awaiting answer, request ID: ${requestId}`));
|
|
58245
|
+
for (const option of options ?? []) console.log(import_chalk23.default.white(` ${option.id}: ${option.label}`));
|
|
58229
58246
|
for (const question of questions ?? []) {
|
|
58230
|
-
console.log(
|
|
58231
|
-
for (const option of question.options) console.log(
|
|
58247
|
+
console.log(import_chalk23.default.white(` Question ${question.id}: ${question.prompt}${question.multiSelect ? " (multi-select)" : ""}`));
|
|
58248
|
+
for (const option of question.options) console.log(import_chalk23.default.gray(` ${option.id}: ${option.label}`));
|
|
58232
58249
|
}
|
|
58233
58250
|
if (questions?.length) {
|
|
58234
|
-
console.log(
|
|
58251
|
+
console.log(import_chalk23.default.gray(` Selection ID: '{"<question>":{"options":["<option>"]}}', '{"<question>":{"custom":"<text>"}}', or declined`));
|
|
58235
58252
|
}
|
|
58236
58253
|
}
|
|
58237
58254
|
break;
|
|
58238
58255
|
case "web_search":
|
|
58239
|
-
console.log(
|
|
58256
|
+
console.log(import_chalk23.default.cyan(`
|
|
58240
58257
|
[${time3}] WEB SEARCH:`));
|
|
58241
|
-
console.log(
|
|
58258
|
+
console.log(import_chalk23.default.white(` "${message2.query}"`));
|
|
58242
58259
|
break;
|
|
58243
58260
|
case "todo_list":
|
|
58244
|
-
console.log(
|
|
58261
|
+
console.log(import_chalk23.default.blue(`
|
|
58245
58262
|
[${time3}] PLAN:`));
|
|
58246
58263
|
for (const item of message2.items) {
|
|
58247
|
-
const icon = item.completed ?
|
|
58264
|
+
const icon = item.completed ? import_chalk23.default.green("[x]") : import_chalk23.default.gray("[ ]");
|
|
58248
58265
|
console.log(` ${icon} ${item.text}`);
|
|
58249
58266
|
}
|
|
58250
58267
|
break;
|
|
58251
58268
|
case "subagent":
|
|
58252
|
-
console.log(
|
|
58269
|
+
console.log(import_chalk23.default.magenta(`
|
|
58253
58270
|
[${time3}] SUBAGENT: ${message2.description}`));
|
|
58254
58271
|
if (message2.output) {
|
|
58255
|
-
console.log(
|
|
58272
|
+
console.log(import_chalk23.default.gray(` ${truncate(message2.output, 200)}`));
|
|
58256
58273
|
}
|
|
58257
58274
|
break;
|
|
58258
58275
|
case "error":
|
|
58259
|
-
console.log(
|
|
58276
|
+
console.log(import_chalk23.default.red(`
|
|
58260
58277
|
[${time3}] ERROR:`));
|
|
58261
|
-
console.log(
|
|
58278
|
+
console.log(import_chalk23.default.red(` ${message2.message}`));
|
|
58262
58279
|
break;
|
|
58263
58280
|
}
|
|
58264
58281
|
}
|
|
@@ -58274,24 +58291,24 @@ async function replicaListCommand(options) {
|
|
|
58274
58291
|
);
|
|
58275
58292
|
output2(response, (response2) => {
|
|
58276
58293
|
if (response2.replicas.length === 0) {
|
|
58277
|
-
console.log(
|
|
58294
|
+
console.log(import_chalk23.default.yellow("\nNo replicas found.\n"));
|
|
58278
58295
|
return;
|
|
58279
58296
|
}
|
|
58280
|
-
console.log(
|
|
58297
|
+
console.log(import_chalk23.default.green(`
|
|
58281
58298
|
Replicas (Page ${response2.page} of ${response2.total_pages}, Total: ${response2.total}):
|
|
58282
58299
|
`));
|
|
58283
58300
|
for (const replica of response2.replicas) {
|
|
58284
|
-
console.log(
|
|
58285
|
-
console.log(
|
|
58301
|
+
console.log(import_chalk23.default.white(` ${replica.name}`) + (replica.kind === "standard" ? "" : import_chalk23.default.magenta(` [${replica.kind}]`)));
|
|
58302
|
+
console.log(import_chalk23.default.gray(` ID: ${replica.id}`));
|
|
58286
58303
|
if (replica.repositories.length > 0) {
|
|
58287
|
-
console.log(
|
|
58304
|
+
console.log(import_chalk23.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
58288
58305
|
}
|
|
58289
|
-
console.log(
|
|
58290
|
-
console.log(
|
|
58306
|
+
console.log(import_chalk23.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
58307
|
+
console.log(import_chalk23.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
58291
58308
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
58292
|
-
console.log(
|
|
58309
|
+
console.log(import_chalk23.default.gray(` Pull Requests:`));
|
|
58293
58310
|
for (const pr2 of replica.pull_requests) {
|
|
58294
|
-
console.log(
|
|
58311
|
+
console.log(import_chalk23.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
58295
58312
|
}
|
|
58296
58313
|
}
|
|
58297
58314
|
console.log();
|
|
@@ -58302,31 +58319,31 @@ async function replicaGetCommand(id) {
|
|
|
58302
58319
|
ensureOrgApiAuthenticated();
|
|
58303
58320
|
const response = await orgAuthenticatedFetch(`/v1/replica/${id}`);
|
|
58304
58321
|
output2(response, ({ replica }) => {
|
|
58305
|
-
console.log(
|
|
58322
|
+
console.log(import_chalk23.default.green(`
|
|
58306
58323
|
Replica: ${replica.name}
|
|
58307
58324
|
`));
|
|
58308
|
-
console.log(
|
|
58309
|
-
console.log(
|
|
58325
|
+
console.log(import_chalk23.default.gray(` ID: ${replica.id}`));
|
|
58326
|
+
console.log(import_chalk23.default.gray(` Kind: ${replica.kind}`));
|
|
58310
58327
|
if (replica.repositories.length > 0) {
|
|
58311
|
-
console.log(
|
|
58328
|
+
console.log(import_chalk23.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
58312
58329
|
}
|
|
58313
|
-
console.log(
|
|
58314
|
-
console.log(
|
|
58330
|
+
console.log(import_chalk23.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
58331
|
+
console.log(import_chalk23.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
58315
58332
|
if (replica.coding_agent) {
|
|
58316
|
-
console.log(
|
|
58333
|
+
console.log(import_chalk23.default.gray(` Coding Agent: ${replica.coding_agent}`));
|
|
58317
58334
|
}
|
|
58318
58335
|
if (replica.activity) printReplicaActivity(replica.activity);
|
|
58319
58336
|
if (replica.repository_statuses && replica.repository_statuses.length > 0) {
|
|
58320
|
-
console.log(
|
|
58337
|
+
console.log(import_chalk23.default.gray(" Repository Statuses:"));
|
|
58321
58338
|
for (const repositoryStatus of replica.repository_statuses) {
|
|
58322
|
-
const changeText = repositoryStatus.git_diff ? ` (${
|
|
58323
|
-
console.log(
|
|
58339
|
+
const changeText = repositoryStatus.git_diff ? ` (${import_chalk23.default.green(`+${repositoryStatus.git_diff.added}`)} / ${import_chalk23.default.red(`-${repositoryStatus.git_diff.removed}`)})` : "";
|
|
58340
|
+
console.log(import_chalk23.default.gray(` - ${repositoryStatus.repository}: ${repositoryStatus.branch || "unknown"}${changeText}`));
|
|
58324
58341
|
}
|
|
58325
58342
|
}
|
|
58326
58343
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
58327
|
-
console.log(
|
|
58344
|
+
console.log(import_chalk23.default.gray(` Pull Requests:`));
|
|
58328
58345
|
for (const pr2 of replica.pull_requests) {
|
|
58329
|
-
console.log(
|
|
58346
|
+
console.log(import_chalk23.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
58330
58347
|
}
|
|
58331
58348
|
}
|
|
58332
58349
|
console.log();
|
|
@@ -58353,7 +58370,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58353
58370
|
});
|
|
58354
58371
|
const answer = response2.name;
|
|
58355
58372
|
if (!answer) {
|
|
58356
|
-
console.log(
|
|
58373
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58357
58374
|
return;
|
|
58358
58375
|
}
|
|
58359
58376
|
replicaName = answer;
|
|
@@ -58371,7 +58388,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58371
58388
|
});
|
|
58372
58389
|
const answer = response2.environment;
|
|
58373
58390
|
if (!answer) {
|
|
58374
|
-
console.log(
|
|
58391
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58375
58392
|
return;
|
|
58376
58393
|
}
|
|
58377
58394
|
selectedEnvironmentId = answer;
|
|
@@ -58385,7 +58402,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58385
58402
|
});
|
|
58386
58403
|
const answer = response2.message;
|
|
58387
58404
|
if (!answer) {
|
|
58388
|
-
console.log(
|
|
58405
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58389
58406
|
return;
|
|
58390
58407
|
}
|
|
58391
58408
|
message2 = answer;
|
|
@@ -58399,7 +58416,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
58399
58416
|
initial: 0
|
|
58400
58417
|
});
|
|
58401
58418
|
if (!response2.agent) {
|
|
58402
|
-
console.log(
|
|
58419
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58403
58420
|
return;
|
|
58404
58421
|
}
|
|
58405
58422
|
codingAgent = parseReplicaAgent(response2.agent);
|
|
@@ -58411,20 +58428,20 @@ async function replicaCreateCommand(name, options) {
|
|
|
58411
58428
|
coding_agent: codingAgent,
|
|
58412
58429
|
lifecycle_policy: "default"
|
|
58413
58430
|
};
|
|
58414
|
-
console.log(
|
|
58431
|
+
console.log(import_chalk23.default.gray("\nCreating replica..."));
|
|
58415
58432
|
const response = await orgAuthenticatedFetch("/v1/replica", {
|
|
58416
58433
|
method: "POST",
|
|
58417
58434
|
body: body2
|
|
58418
58435
|
});
|
|
58419
58436
|
output2(response, ({ replica }) => {
|
|
58420
|
-
console.log(
|
|
58437
|
+
console.log(import_chalk23.default.green(`
|
|
58421
58438
|
Created replica: ${replica.name}`));
|
|
58422
|
-
console.log(
|
|
58423
|
-
console.log(
|
|
58439
|
+
console.log(import_chalk23.default.gray(` ID: ${replica.id}`));
|
|
58440
|
+
console.log(import_chalk23.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
58424
58441
|
if (replica.repositories.length > 0) {
|
|
58425
|
-
console.log(
|
|
58442
|
+
console.log(import_chalk23.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
58426
58443
|
}
|
|
58427
|
-
console.log(
|
|
58444
|
+
console.log(import_chalk23.default.cyan(` Link: ${getWorkspaceDashboardUrl(replica.id, { webAppUrl: process.env.REPLICAS_WEB_URL || DEFAULT_WEB_APP_URL })}`));
|
|
58428
58445
|
console.log();
|
|
58429
58446
|
});
|
|
58430
58447
|
}
|
|
@@ -58440,7 +58457,7 @@ async function replicaSendCommand(id, options) {
|
|
|
58440
58457
|
});
|
|
58441
58458
|
const answer = response2.message;
|
|
58442
58459
|
if (!answer) {
|
|
58443
|
-
console.log(
|
|
58460
|
+
console.log(import_chalk23.default.yellow("\nCancelled."));
|
|
58444
58461
|
return;
|
|
58445
58462
|
}
|
|
58446
58463
|
message2 = answer;
|
|
@@ -58465,14 +58482,14 @@ async function replicaSendCommand(id, options) {
|
|
|
58465
58482
|
}
|
|
58466
58483
|
);
|
|
58467
58484
|
output2(response, (response2) => {
|
|
58468
|
-
const statusColor = response2.status === "sent" ?
|
|
58485
|
+
const statusColor = response2.status === "sent" ? import_chalk23.default.green : import_chalk23.default.yellow;
|
|
58469
58486
|
console.log(statusColor(`
|
|
58470
58487
|
Message ${response2.status}`));
|
|
58471
58488
|
if (response2.chat_id) {
|
|
58472
|
-
console.log(
|
|
58489
|
+
console.log(import_chalk23.default.gray(` Chat: ${response2.chat_id}`));
|
|
58473
58490
|
}
|
|
58474
58491
|
if (response2.position !== void 0 && response2.position > 0) {
|
|
58475
|
-
console.log(
|
|
58492
|
+
console.log(import_chalk23.default.gray(` Queue position: ${response2.position}`));
|
|
58476
58493
|
}
|
|
58477
58494
|
console.log();
|
|
58478
58495
|
});
|
|
@@ -58499,40 +58516,40 @@ async function replicaReadCommand(id, options) {
|
|
|
58499
58516
|
`/v1/replica/${id}/history${query ? "?" + query : ""}`
|
|
58500
58517
|
);
|
|
58501
58518
|
output2(response, (response2) => {
|
|
58502
|
-
console.log(
|
|
58519
|
+
console.log(import_chalk23.default.green(`
|
|
58503
58520
|
Conversation History
|
|
58504
58521
|
`));
|
|
58505
58522
|
if (response2.coding_agent) {
|
|
58506
|
-
console.log(
|
|
58523
|
+
console.log(import_chalk23.default.gray(` Agent: ${response2.coding_agent}`));
|
|
58507
58524
|
}
|
|
58508
58525
|
if (response2.thread_id) {
|
|
58509
|
-
console.log(
|
|
58526
|
+
console.log(import_chalk23.default.gray(` Thread ID: ${response2.thread_id}`));
|
|
58510
58527
|
}
|
|
58511
|
-
console.log(
|
|
58528
|
+
console.log(import_chalk23.default.gray(` Total Events: ${response2.total}`));
|
|
58512
58529
|
if (response2.has_more) {
|
|
58513
58530
|
const previousPage = response2.beforeCursor ? `--before '${response2.beforeCursor}'` : `--before-event ${response2.eventsStartIndex}`;
|
|
58514
|
-
console.log(
|
|
58531
|
+
console.log(import_chalk23.default.gray(` Has More: yes (${previousPage} for the previous page)`));
|
|
58515
58532
|
}
|
|
58516
58533
|
console.log();
|
|
58517
58534
|
if (response2.events.length === 0) {
|
|
58518
|
-
console.log(
|
|
58535
|
+
console.log(import_chalk23.default.yellow(" No events found.\n"));
|
|
58519
58536
|
return;
|
|
58520
58537
|
}
|
|
58521
|
-
console.log(
|
|
58538
|
+
console.log(import_chalk23.default.gray("-".repeat(60)));
|
|
58522
58539
|
const agentType = response2.coding_agent || "claude";
|
|
58523
58540
|
const displayMessages = parseDisplayMessages(response2.events, agentType);
|
|
58524
58541
|
for (const message2 of displayMessages) {
|
|
58525
58542
|
formatDisplayMessage(message2);
|
|
58526
58543
|
}
|
|
58527
|
-
console.log(
|
|
58544
|
+
console.log(import_chalk23.default.gray("\n" + "-".repeat(60)));
|
|
58528
58545
|
console.log();
|
|
58529
58546
|
});
|
|
58530
58547
|
}
|
|
58531
|
-
var
|
|
58548
|
+
var import_chalk23, CLI_CODING_AGENT_LABEL;
|
|
58532
58549
|
var init_replica2 = __esm({
|
|
58533
58550
|
"src/commands/replica.ts"() {
|
|
58534
58551
|
"use strict";
|
|
58535
|
-
|
|
58552
|
+
import_chalk23 = __toESM(require("chalk"));
|
|
58536
58553
|
init_api2();
|
|
58537
58554
|
init_environment3();
|
|
58538
58555
|
init_command_utils();
|
|
@@ -58548,7 +58565,7 @@ async function workspaceRenameCommand(id, name) {
|
|
|
58548
58565
|
method: "PATCH",
|
|
58549
58566
|
body: { name }
|
|
58550
58567
|
});
|
|
58551
|
-
output2(response, ({ workspace }) => console.log(
|
|
58568
|
+
output2(response, ({ workspace }) => console.log(import_chalk24.default.green(`Renamed workspace to ${workspace.name}`)));
|
|
58552
58569
|
}
|
|
58553
58570
|
async function workspaceWakeCommand(id, options) {
|
|
58554
58571
|
await orgAuthenticatedFetch(`/v1/replica/${id}/wake${options.restore ? "?restore=true" : ""}`, { method: "POST" });
|
|
@@ -58558,7 +58575,7 @@ async function workspaceRefreshEnvironmentCommand(id) {
|
|
|
58558
58575
|
const result = await orgAuthenticatedFetch(`/v1/replica/${id}/environment/refresh`, { method: "POST" });
|
|
58559
58576
|
output2(result, ({ status, changes }) => {
|
|
58560
58577
|
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(
|
|
58578
|
+
for (const { kind, name, change: change2 } of changes) console.log(import_chalk24.default.gray(` ${change2} ${WORKSPACE_ENVIRONMENT_CHANGE_LABELS[kind]} ${name}`));
|
|
58562
58579
|
});
|
|
58563
58580
|
}
|
|
58564
58581
|
function workspaceLifecycleCommand(action) {
|
|
@@ -58575,7 +58592,7 @@ async function workspaceWaitCommand(id, options) {
|
|
|
58575
58592
|
if (options.chat) query.set("chat_id", options.chat);
|
|
58576
58593
|
const step2 = result?.activity.current_step;
|
|
58577
58594
|
result = await orgAuthenticatedFetch(`/v1/replica/${id}/wait?${query}`);
|
|
58578
|
-
if (!result.done && result.activity.current_step && result.activity.current_step !== step2) console.error(
|
|
58595
|
+
if (!result.done && result.activity.current_step && result.activity.current_step !== step2) console.error(import_chalk24.default.gray(`\u2026 ${result.activity.current_step}`));
|
|
58579
58596
|
} while (!result.done && result.activity.state !== "waiting_for_input" && Date.now() < deadline);
|
|
58580
58597
|
output2(result, ({ done, status, deleted, activity }) => {
|
|
58581
58598
|
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 +58604,7 @@ async function workspaceStatusCommand(id) {
|
|
|
58587
58604
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/status`), (status) => {
|
|
58588
58605
|
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
58606
|
console.log(`Status: ${status.status}`);
|
|
58590
|
-
if (status.message || status.error) console.log(
|
|
58607
|
+
if (status.message || status.error) console.log(import_chalk24.default.yellow(status.message || status.error));
|
|
58591
58608
|
const working = agentsWith("Processing");
|
|
58592
58609
|
const awaiting = agentsWith("AwaitingInput");
|
|
58593
58610
|
if (working.length > 0) console.log(`Working: ${working.join(", ")}`);
|
|
@@ -58615,8 +58632,8 @@ async function workspaceExecCommand(id, command, options) {
|
|
|
58615
58632
|
output2(result, () => {
|
|
58616
58633
|
process.stdout.write(result.output.endsWith("\n") || !result.output ? result.output : `${result.output}
|
|
58617
58634
|
`);
|
|
58618
|
-
if (result.truncated) console.error(
|
|
58619
|
-
if (result.timed_out) console.error(
|
|
58635
|
+
if (result.truncated) console.error(import_chalk24.default.yellow("Output truncated."));
|
|
58636
|
+
if (result.timed_out) console.error(import_chalk24.default.yellow("Command timed out."));
|
|
58620
58637
|
});
|
|
58621
58638
|
process.exitCode = result.exit_code ?? 1;
|
|
58622
58639
|
}
|
|
@@ -58631,11 +58648,11 @@ async function workspaceHooksCommand(id) {
|
|
|
58631
58648
|
return;
|
|
58632
58649
|
}
|
|
58633
58650
|
for (const entry of entries) {
|
|
58634
|
-
const result = entry.timedOut ?
|
|
58635
|
-
console.log(
|
|
58651
|
+
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}`);
|
|
58652
|
+
console.log(import_chalk24.default.bold(`
|
|
58636
58653
|
[${entry.kind}] ${entry.hookName} (${entry.hookType}) ${result} at ${formatDate(entry.executedAt)}`));
|
|
58637
58654
|
console.log(entry.output.trimEnd());
|
|
58638
|
-
if (entry.outputTruncated) console.log(
|
|
58655
|
+
if (entry.outputTruncated) console.log(import_chalk24.default.gray(`\u2026 truncated (${entry.outputTotalChars} chars total)`));
|
|
58639
58656
|
}
|
|
58640
58657
|
});
|
|
58641
58658
|
}
|
|
@@ -58643,7 +58660,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
58643
58660
|
if (!sessionId) {
|
|
58644
58661
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs`), ({ currentSessionId, sessions }) => {
|
|
58645
58662
|
for (const session of sessions) {
|
|
58646
|
-
const current = session.sessionId === currentSessionId ?
|
|
58663
|
+
const current = session.sessionId === currentSessionId ? import_chalk24.default.green(" (current)") : "";
|
|
58647
58664
|
console.log(`${session.sessionId} ${session.sizeBytes} bytes ${formatDate(session.updatedAt)}${current}`);
|
|
58648
58665
|
}
|
|
58649
58666
|
});
|
|
@@ -58656,7 +58673,7 @@ async function workspaceLogsCommand(id, sessionId, options) {
|
|
|
58656
58673
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/logs/${sessionId}${query ? `?${query}` : ""}`), (log) => {
|
|
58657
58674
|
console.log(log.lines.join("\n"));
|
|
58658
58675
|
if (log.hasMore) {
|
|
58659
|
-
console.error(
|
|
58676
|
+
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
58677
|
}
|
|
58661
58678
|
});
|
|
58662
58679
|
}
|
|
@@ -58696,16 +58713,16 @@ async function prViewCommand(id, prUrls) {
|
|
|
58696
58713
|
);
|
|
58697
58714
|
output2(response, ({ pullRequests }) => {
|
|
58698
58715
|
for (const { url: url2, details, error: error62 } of pullRequests) {
|
|
58699
|
-
console.log(
|
|
58716
|
+
console.log(import_chalk24.default.bold(`
|
|
58700
58717
|
${url2}`));
|
|
58701
58718
|
if (!details) {
|
|
58702
|
-
console.log(
|
|
58719
|
+
console.log(import_chalk24.default.red(` ${error62 ?? "Details unavailable"}`));
|
|
58703
58720
|
continue;
|
|
58704
58721
|
}
|
|
58705
58722
|
console.log(` ${details.title}`);
|
|
58706
58723
|
console.log(` State: ${details.state} Mergeability: ${details.mergeability} CI: ${details.ciStatus}`);
|
|
58707
58724
|
console.log(` ${details.headBranch} \u2192 ${details.baseBranch} +${details.additions ?? 0} -${details.deletions ?? 0} in ${details.changedFiles} files`);
|
|
58708
|
-
if (details.mergeBlockers?.length) console.log(
|
|
58725
|
+
if (details.mergeBlockers?.length) console.log(import_chalk24.default.yellow(` Blocked by: ${details.mergeBlockers.join(", ").replaceAll("_", " ")}`));
|
|
58709
58726
|
}
|
|
58710
58727
|
});
|
|
58711
58728
|
}
|
|
@@ -58745,14 +58762,14 @@ async function canvasPutCommand(id, filename, options) {
|
|
|
58745
58762
|
{ method: "PUT", body: body2 }
|
|
58746
58763
|
);
|
|
58747
58764
|
if (!result.saved) throw new Error(`${filename} changed while saving; retry`);
|
|
58748
|
-
output2(result, () => console.log(
|
|
58765
|
+
output2(result, () => console.log(import_chalk24.default.green(`Saved ${filename}`)));
|
|
58749
58766
|
}
|
|
58750
|
-
var import_fs6,
|
|
58767
|
+
var import_fs6, import_chalk24, getCanvasFile;
|
|
58751
58768
|
var init_workspace = __esm({
|
|
58752
58769
|
"src/commands/workspace.ts"() {
|
|
58753
58770
|
"use strict";
|
|
58754
58771
|
import_fs6 = __toESM(require("fs"));
|
|
58755
|
-
|
|
58772
|
+
import_chalk24 = __toESM(require("chalk"));
|
|
58756
58773
|
init_src();
|
|
58757
58774
|
init_api2();
|
|
58758
58775
|
init_command_utils();
|
|
@@ -58768,7 +58785,7 @@ function printQueue(queue) {
|
|
|
58768
58785
|
return;
|
|
58769
58786
|
}
|
|
58770
58787
|
queue.forEach((message2, index) => {
|
|
58771
|
-
const steered = message2.steeredAt ?
|
|
58788
|
+
const steered = message2.steeredAt ? import_chalk25.default.cyan(" (steered)") : "";
|
|
58772
58789
|
console.log(`${index} ${message2.id}${steered} ${message2.message.replace(/\s+/g, " ").slice(0, 120)}`);
|
|
58773
58790
|
});
|
|
58774
58791
|
}
|
|
@@ -58778,7 +58795,7 @@ function printGoal({ goal }) {
|
|
|
58778
58795
|
async function chatListCommand(id) {
|
|
58779
58796
|
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/chats`), ({ chats }) => {
|
|
58780
58797
|
for (const chat2 of chats) {
|
|
58781
|
-
console.log(`${chat2.id} ${chat2.provider} ${chat2.processing ?
|
|
58798
|
+
console.log(`${chat2.id} ${chat2.provider} ${chat2.processing ? import_chalk25.default.green("working") : "idle"} ${chat2.title}`);
|
|
58782
58799
|
}
|
|
58783
58800
|
});
|
|
58784
58801
|
}
|
|
@@ -58801,7 +58818,7 @@ async function chatRestoreCommand(id, chatId) {
|
|
|
58801
58818
|
outputSuccess(`Restored chat ${chatId}`);
|
|
58802
58819
|
}
|
|
58803
58820
|
async function chatInterruptCommand(id, chatId) {
|
|
58804
|
-
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/interrupt"), { method: "POST" }), ({ interrupted }) => console.log(interrupted ?
|
|
58821
|
+
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/interrupt"), { method: "POST" }), ({ interrupted }) => console.log(interrupted ? import_chalk25.default.green("Interrupted.") : "Nothing to interrupt."));
|
|
58805
58822
|
}
|
|
58806
58823
|
async function chatForkCommand(id, chatId, options) {
|
|
58807
58824
|
const provider2 = parseReplicaAgent(options.agent);
|
|
@@ -58832,7 +58849,7 @@ async function chatAnswerCommand(id, chatId, requestId, selectionId) {
|
|
|
58832
58849
|
method: "POST",
|
|
58833
58850
|
body: { requestId, selectionId }
|
|
58834
58851
|
});
|
|
58835
|
-
output2(response, ({ resolved }) => console.log(resolved ?
|
|
58852
|
+
output2(response, ({ resolved }) => console.log(resolved ? import_chalk25.default.green("Answer sent.") : import_chalk25.default.yellow("That question is no longer pending.")));
|
|
58836
58853
|
}
|
|
58837
58854
|
async function chatCommandsCommand(id, chatId) {
|
|
58838
58855
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/slash-commands")), ({ commands }) => {
|
|
@@ -58843,7 +58860,7 @@ async function chatCommandsCommand(id, chatId) {
|
|
|
58843
58860
|
}
|
|
58844
58861
|
async function chatQueueListCommand(id, chatId) {
|
|
58845
58862
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/queue")), ({ processing, queue }) => {
|
|
58846
|
-
console.log(
|
|
58863
|
+
console.log(import_chalk25.default.gray(processing ? "Agent is working." : "Agent is idle."));
|
|
58847
58864
|
printQueue(queue);
|
|
58848
58865
|
});
|
|
58849
58866
|
}
|
|
@@ -58853,11 +58870,11 @@ async function mutateQueue(path14, method, body2) {
|
|
|
58853
58870
|
else console.log("Done.");
|
|
58854
58871
|
});
|
|
58855
58872
|
}
|
|
58856
|
-
var
|
|
58873
|
+
var import_chalk25, chatPath2, chatQueueClearCommand, chatQueueRemoveCommand, chatQueueEditCommand, chatQueueMoveCommand, chatQueueActionCommand;
|
|
58857
58874
|
var init_chat = __esm({
|
|
58858
58875
|
"src/commands/chat.ts"() {
|
|
58859
58876
|
"use strict";
|
|
58860
|
-
|
|
58877
|
+
import_chalk25 = __toESM(require("chalk"));
|
|
58861
58878
|
init_src();
|
|
58862
58879
|
init_api2();
|
|
58863
58880
|
init_output();
|
|
@@ -58902,13 +58919,13 @@ async function pluginsDisconnectCommand(pluginId, options) {
|
|
|
58902
58919
|
await pluginsPath(options, `/${pluginId}${options.connection ? `/connections/${options.connection}` : ""}`),
|
|
58903
58920
|
{ method: "DELETE" }
|
|
58904
58921
|
);
|
|
58905
|
-
output2(response, ({ success: success2 }) => console.log(success2 ?
|
|
58922
|
+
output2(response, ({ success: success2 }) => console.log(success2 ? import_chalk26.default.green(`Disconnected ${pluginId}`) : `${pluginId} was not connected`));
|
|
58906
58923
|
}
|
|
58907
|
-
var
|
|
58924
|
+
var import_chalk26, pluginsPath;
|
|
58908
58925
|
var init_plugins3 = __esm({
|
|
58909
58926
|
"src/commands/plugins.ts"() {
|
|
58910
58927
|
"use strict";
|
|
58911
|
-
|
|
58928
|
+
import_chalk26 = __toESM(require("chalk"));
|
|
58912
58929
|
init_api2();
|
|
58913
58930
|
init_command_utils();
|
|
58914
58931
|
init_output();
|
|
@@ -58927,20 +58944,20 @@ async function fetchCurrentRun() {
|
|
|
58927
58944
|
}
|
|
58928
58945
|
async function environmentSetupStatusCommand() {
|
|
58929
58946
|
output2(await fetchCurrentRun(), ({ run: run2, environment: environment2, repositories }) => {
|
|
58930
|
-
console.log(
|
|
58947
|
+
console.log(import_chalk27.default.bold(`
|
|
58931
58948
|
Environment setup: ${environment2.name}
|
|
58932
58949
|
`));
|
|
58933
58950
|
console.log(` Run: ${run2.id}`);
|
|
58934
|
-
console.log(` Status: ${run2.status}${run2.error ?
|
|
58951
|
+
console.log(` Status: ${run2.status}${run2.error ? import_chalk27.default.red(` (${run2.error})`) : ""}`);
|
|
58935
58952
|
console.log(` Environment: ${environment2.id}`);
|
|
58936
58953
|
console.log(` Repositories: ${repositories.map((repo) => `${repo.name} (${repo.default_branch})`).join(", ") || "none"}`);
|
|
58937
58954
|
console.log("\n Steps:");
|
|
58938
58955
|
for (const step2 of ENVIRONMENT_SETUP_STEPS) {
|
|
58939
58956
|
const status = run2.steps[step2.key] ?? "pending";
|
|
58940
|
-
const marker = status === "completed" ?
|
|
58941
|
-
console.log(` ${marker} ${step2.key.padEnd(11)} ${
|
|
58957
|
+
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");
|
|
58958
|
+
console.log(` ${marker} ${step2.key.padEnd(11)} ${import_chalk27.default.gray(step2.label)} ${import_chalk27.default.gray(`[${status}]`)}`);
|
|
58942
58959
|
}
|
|
58943
|
-
console.log(run2.proposal ?
|
|
58960
|
+
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
58961
|
});
|
|
58945
58962
|
}
|
|
58946
58963
|
async function environmentSetupStepCommand(key2, status) {
|
|
@@ -58956,7 +58973,7 @@ async function environmentSetupStepCommand(key2, status) {
|
|
|
58956
58973
|
method: "POST",
|
|
58957
58974
|
body: body2
|
|
58958
58975
|
});
|
|
58959
|
-
output2(result, () => console.log(
|
|
58976
|
+
output2(result, () => console.log(import_chalk27.default.green(`
|
|
58960
58977
|
\u2713 ${key2} \u2192 ${status}
|
|
58961
58978
|
`)));
|
|
58962
58979
|
}
|
|
@@ -58975,22 +58992,22 @@ async function environmentSetupProposeCommand(options) {
|
|
|
58975
58992
|
body: { proposal }
|
|
58976
58993
|
});
|
|
58977
58994
|
output2(result, ({ run: { proposal: submitted } }) => {
|
|
58978
|
-
console.log(
|
|
58995
|
+
console.log(import_chalk27.default.green("\n\u2713 Proposal submitted.\n"));
|
|
58979
58996
|
if (submitted) {
|
|
58980
58997
|
console.log(` Automations: ${submitted.automations.length}`);
|
|
58981
58998
|
console.log(` Variables: ${submitted.variables.length}`);
|
|
58982
58999
|
console.log(` Checks: ${submitted.verification.length}`);
|
|
58983
59000
|
console.log(` Media: ${submitted.media.length}`);
|
|
58984
59001
|
}
|
|
58985
|
-
console.log(
|
|
59002
|
+
console.log(import_chalk27.default.gray("\n The user reviews and saves it from the Environment panel; nothing has been applied yet.\n"));
|
|
58986
59003
|
});
|
|
58987
59004
|
}
|
|
58988
|
-
var import_fs7,
|
|
59005
|
+
var import_fs7, import_chalk27, STEP_KEYS;
|
|
58989
59006
|
var init_environment_setup2 = __esm({
|
|
58990
59007
|
"src/commands/environment-setup.ts"() {
|
|
58991
59008
|
"use strict";
|
|
58992
59009
|
import_fs7 = __toESM(require("fs"));
|
|
58993
|
-
|
|
59010
|
+
import_chalk27 = __toESM(require("chalk"));
|
|
58994
59011
|
init_api2();
|
|
58995
59012
|
init_command_utils();
|
|
58996
59013
|
init_config();
|
|
@@ -59241,41 +59258,41 @@ function resolveSelectableEnvironmentId(envInput, selectableEnvs) {
|
|
|
59241
59258
|
return resolved.id;
|
|
59242
59259
|
}
|
|
59243
59260
|
function printAutomation(automation2) {
|
|
59244
|
-
console.log(
|
|
59245
|
-
console.log(
|
|
59246
|
-
console.log(
|
|
59261
|
+
console.log(import_chalk28.default.white(` ${automation2.name}`));
|
|
59262
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59263
|
+
console.log(import_chalk28.default.gray(` Owner: ${automation2.user_id ? "personal" : "organization"}`));
|
|
59247
59264
|
if (automation2.description) {
|
|
59248
|
-
console.log(
|
|
59265
|
+
console.log(import_chalk28.default.gray(` Description: ${automation2.description}`));
|
|
59249
59266
|
}
|
|
59250
|
-
console.log(
|
|
59267
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? import_chalk28.default.green("yes") : import_chalk28.default.red("no")}`));
|
|
59251
59268
|
if (automation2.auto_paused_at) {
|
|
59252
|
-
console.log(
|
|
59269
|
+
console.log(import_chalk28.default.yellow(` ${truncate(formatAutoPause(automation2), 120)}`));
|
|
59253
59270
|
}
|
|
59254
59271
|
if (automation2.triggers.length > 0) {
|
|
59255
|
-
console.log(
|
|
59272
|
+
console.log(import_chalk28.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
59256
59273
|
}
|
|
59257
59274
|
if (automation2.github_check_names.length > 0) {
|
|
59258
|
-
console.log(
|
|
59275
|
+
console.log(import_chalk28.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
59259
59276
|
}
|
|
59260
|
-
console.log(
|
|
59277
|
+
console.log(import_chalk28.default.gray(` Prompt: ${truncate(automation2.prompt, 80)}`));
|
|
59261
59278
|
if (automation2.cron_next_fire_at) {
|
|
59262
|
-
console.log(
|
|
59279
|
+
console.log(import_chalk28.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
59263
59280
|
}
|
|
59264
|
-
console.log(
|
|
59265
|
-
console.log(
|
|
59266
|
-
if (automation2.background) console.log(
|
|
59281
|
+
console.log(import_chalk28.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
59282
|
+
console.log(import_chalk28.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
59283
|
+
if (automation2.background) console.log(import_chalk28.default.gray(" List: background"));
|
|
59267
59284
|
if (automation2.workspace_lifecycle_policy && automation2.workspace_lifecycle_policy !== "default") {
|
|
59268
|
-
console.log(
|
|
59285
|
+
console.log(import_chalk28.default.gray(` Lifecycle: ${automation2.workspace_lifecycle_policy}`));
|
|
59269
59286
|
}
|
|
59270
59287
|
if (automation2.agent_provider || automation2.model || automation2.thinking_level) {
|
|
59271
|
-
console.log(
|
|
59288
|
+
console.log(import_chalk28.default.gray(` Agent: ${formatAgentSummary(automation2)}`));
|
|
59272
59289
|
}
|
|
59273
59290
|
if (automation2.goal_mode || automation2.fast_mode) {
|
|
59274
|
-
console.log(
|
|
59291
|
+
console.log(import_chalk28.default.gray(` Modes: ${formatModeSummary(automation2)}`));
|
|
59275
59292
|
}
|
|
59276
|
-
console.log(
|
|
59277
|
-
console.log(
|
|
59278
|
-
console.log(
|
|
59293
|
+
console.log(import_chalk28.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? import_chalk28.default.green("managed") : "read-only"}`));
|
|
59294
|
+
console.log(import_chalk28.default.gray(` Created: ${formatDate(automation2.created_at)}`));
|
|
59295
|
+
console.log(import_chalk28.default.gray(` Updated: ${formatDate(automation2.updated_at)}`));
|
|
59279
59296
|
console.log();
|
|
59280
59297
|
}
|
|
59281
59298
|
async function resolveCredentialsMember(value) {
|
|
@@ -59305,10 +59322,10 @@ async function automationListCommand(options) {
|
|
|
59305
59322
|
);
|
|
59306
59323
|
output2(response, (response2) => {
|
|
59307
59324
|
if (response2.automations.length === 0) {
|
|
59308
|
-
console.log(
|
|
59325
|
+
console.log(import_chalk28.default.yellow("\nNo automations found.\n"));
|
|
59309
59326
|
return;
|
|
59310
59327
|
}
|
|
59311
|
-
console.log(
|
|
59328
|
+
console.log(import_chalk28.default.green(`
|
|
59312
59329
|
Automations (Page ${response2.page} of ${response2.totalPages}, Total: ${response2.total}):
|
|
59313
59330
|
`));
|
|
59314
59331
|
for (const automation2 of response2.automations) {
|
|
@@ -59320,49 +59337,49 @@ async function automationGetCommand(id) {
|
|
|
59320
59337
|
ensureOrgApiAuthenticated();
|
|
59321
59338
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`);
|
|
59322
59339
|
output2(response.automation, (automation2) => {
|
|
59323
|
-
console.log(
|
|
59340
|
+
console.log(import_chalk28.default.green(`
|
|
59324
59341
|
Automation: ${automation2.name}
|
|
59325
59342
|
`));
|
|
59326
|
-
console.log(
|
|
59343
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59327
59344
|
if (automation2.description) {
|
|
59328
|
-
console.log(
|
|
59345
|
+
console.log(import_chalk28.default.gray(` Description: ${automation2.description}`));
|
|
59329
59346
|
}
|
|
59330
|
-
console.log(
|
|
59347
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? import_chalk28.default.green("yes") : import_chalk28.default.red("no")}`));
|
|
59331
59348
|
if (automation2.auto_paused_at) {
|
|
59332
|
-
console.log(
|
|
59349
|
+
console.log(import_chalk28.default.yellow(` ${formatAutoPause(automation2)}`));
|
|
59333
59350
|
}
|
|
59334
59351
|
if (automation2.triggers.length > 0) {
|
|
59335
|
-
console.log(
|
|
59352
|
+
console.log(import_chalk28.default.gray(` Triggers:`));
|
|
59336
59353
|
for (const trigger of automation2.triggers) {
|
|
59337
|
-
console.log(
|
|
59354
|
+
console.log(import_chalk28.default.gray(` - ${formatTrigger(trigger)}`));
|
|
59338
59355
|
}
|
|
59339
59356
|
}
|
|
59340
59357
|
if (automation2.github_check_names.length > 0) {
|
|
59341
|
-
console.log(
|
|
59358
|
+
console.log(import_chalk28.default.gray(` GitHub checks: ${automation2.github_check_names.join(", ")}`));
|
|
59342
59359
|
}
|
|
59343
|
-
console.log(
|
|
59344
|
-
console.log(
|
|
59360
|
+
console.log(import_chalk28.default.gray(` Prompt: ${automation2.prompt}`));
|
|
59361
|
+
console.log(import_chalk28.default.gray(` Environment: ${automation2.environment_id}`));
|
|
59345
59362
|
if (automation2.cron_next_fire_at) {
|
|
59346
|
-
console.log(
|
|
59363
|
+
console.log(import_chalk28.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)}`));
|
|
59347
59364
|
}
|
|
59348
|
-
console.log(
|
|
59349
|
-
console.log(
|
|
59350
|
-
console.log(
|
|
59351
|
-
if (automation2.credential_user_id) console.log(
|
|
59352
|
-
console.log(
|
|
59365
|
+
console.log(import_chalk28.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
59366
|
+
console.log(import_chalk28.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
59367
|
+
console.log(import_chalk28.default.gray(` List: ${automation2.background ? "background" : "main"}`));
|
|
59368
|
+
if (automation2.credential_user_id) console.log(import_chalk28.default.gray(` Credentials: member ${automation2.credential_user_id}, then the organization's`));
|
|
59369
|
+
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
59370
|
if (automation2.workspace_lifecycle_policy) {
|
|
59354
|
-
console.log(
|
|
59371
|
+
console.log(import_chalk28.default.gray(` Lifecycle Policy: ${automation2.workspace_lifecycle_policy}`));
|
|
59355
59372
|
}
|
|
59356
59373
|
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(
|
|
59374
|
+
console.log(import_chalk28.default.gray(` Auto-stop: ${automation2.workspace_auto_stop_minutes} minutes`));
|
|
59375
|
+
}
|
|
59376
|
+
console.log(import_chalk28.default.gray(` Agent: ${automation2.agent_provider ? getProviderDisplayName(automation2.agent_provider) : "organization default"}`));
|
|
59377
|
+
console.log(import_chalk28.default.gray(` Model: ${automation2.model ? MODEL_LABELS[automation2.model] ?? automation2.model : "agent default"}`));
|
|
59378
|
+
console.log(import_chalk28.default.gray(` Thinking Level: ${automation2.thinking_level ?? "agent default"}`));
|
|
59379
|
+
console.log(import_chalk28.default.gray(` Modes: ${formatModeSummary(automation2)}`));
|
|
59380
|
+
console.log(import_chalk28.default.gray(` PR Follow-ups: ${automation2.config.capabilities?.pr_followups === true ? "managed" : "read-only"}`));
|
|
59381
|
+
console.log(import_chalk28.default.gray(` Created: ${formatDate(automation2.created_at)}`));
|
|
59382
|
+
console.log(import_chalk28.default.gray(` Updated: ${formatDate(automation2.updated_at)}`));
|
|
59366
59383
|
console.log();
|
|
59367
59384
|
});
|
|
59368
59385
|
}
|
|
@@ -59534,7 +59551,7 @@ async function automationCreateCommand(name, options) {
|
|
|
59534
59551
|
});
|
|
59535
59552
|
const answer = response2.name;
|
|
59536
59553
|
if (!answer) {
|
|
59537
|
-
console.log(
|
|
59554
|
+
console.log(import_chalk28.default.yellow("\nCancelled."));
|
|
59538
59555
|
return;
|
|
59539
59556
|
}
|
|
59540
59557
|
automationName = answer;
|
|
@@ -59549,7 +59566,7 @@ async function automationCreateCommand(name, options) {
|
|
|
59549
59566
|
});
|
|
59550
59567
|
const answer = response2.prompt;
|
|
59551
59568
|
if (!answer) {
|
|
59552
|
-
console.log(
|
|
59569
|
+
console.log(import_chalk28.default.yellow("\nCancelled."));
|
|
59553
59570
|
return;
|
|
59554
59571
|
}
|
|
59555
59572
|
automationPrompt = answer;
|
|
@@ -59571,7 +59588,7 @@ async function automationCreateCommand(name, options) {
|
|
|
59571
59588
|
}))
|
|
59572
59589
|
});
|
|
59573
59590
|
if (!envResponse2.env) {
|
|
59574
|
-
console.log(
|
|
59591
|
+
console.log(import_chalk28.default.yellow("\nCancelled."));
|
|
59575
59592
|
return;
|
|
59576
59593
|
}
|
|
59577
59594
|
selectedEnvironmentId = envResponse2.env;
|
|
@@ -59612,25 +59629,25 @@ async function automationCreateCommand(name, options) {
|
|
|
59612
59629
|
...options.fastMode ? { fast_mode: true } : {},
|
|
59613
59630
|
...agentSelection
|
|
59614
59631
|
};
|
|
59615
|
-
console.log(
|
|
59632
|
+
console.log(import_chalk28.default.gray("\nCreating automation..."));
|
|
59616
59633
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
59617
59634
|
method: "POST",
|
|
59618
59635
|
body: body2
|
|
59619
59636
|
});
|
|
59620
59637
|
output2(response.automation, (automation2) => {
|
|
59621
|
-
console.log(
|
|
59638
|
+
console.log(import_chalk28.default.green(`
|
|
59622
59639
|
Created automation: ${automation2.name}`));
|
|
59623
|
-
console.log(
|
|
59624
|
-
console.log(
|
|
59640
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59641
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
59625
59642
|
if (automation2.triggers.length > 0) {
|
|
59626
|
-
console.log(
|
|
59643
|
+
console.log(import_chalk28.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
59627
59644
|
}
|
|
59628
59645
|
if (automation2.cron_next_fire_at) {
|
|
59629
|
-
console.log(
|
|
59646
|
+
console.log(import_chalk28.default.gray(` Next Run: ${formatDate(automation2.cron_next_fire_at)} (${automation2.cron_next_fire_at})`));
|
|
59630
59647
|
}
|
|
59631
|
-
console.log(
|
|
59632
|
-
console.log(
|
|
59633
|
-
console.log(
|
|
59648
|
+
console.log(import_chalk28.default.gray(` Runs: ${formatRuns(automation2)}`));
|
|
59649
|
+
console.log(import_chalk28.default.gray(` Workspace: ${formatDestination(automation2)}`));
|
|
59650
|
+
console.log(import_chalk28.default.gray(` List: ${automation2.background ? "background" : "main"}`));
|
|
59634
59651
|
console.log();
|
|
59635
59652
|
});
|
|
59636
59653
|
}
|
|
@@ -59786,21 +59803,21 @@ async function automationEditCommand(id, options) {
|
|
|
59786
59803
|
Object.assign(body2, agentSelection);
|
|
59787
59804
|
}
|
|
59788
59805
|
if (Object.keys(body2).length === 0) {
|
|
59789
|
-
output2(existing.automation, () => console.log(
|
|
59806
|
+
output2(existing.automation, () => console.log(import_chalk28.default.yellow("\nNo changes made.\n")));
|
|
59790
59807
|
return;
|
|
59791
59808
|
}
|
|
59792
|
-
console.log(
|
|
59809
|
+
console.log(import_chalk28.default.gray("\nUpdating automation..."));
|
|
59793
59810
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`, {
|
|
59794
59811
|
method: "PATCH",
|
|
59795
59812
|
body: body2
|
|
59796
59813
|
});
|
|
59797
59814
|
output2(response.automation, (automation2) => {
|
|
59798
|
-
console.log(
|
|
59815
|
+
console.log(import_chalk28.default.green(`
|
|
59799
59816
|
Updated automation: ${automation2.name}`));
|
|
59800
|
-
console.log(
|
|
59801
|
-
console.log(
|
|
59817
|
+
console.log(import_chalk28.default.gray(` ID: ${automation2.id}`));
|
|
59818
|
+
console.log(import_chalk28.default.gray(` Enabled: ${automation2.enabled ? "yes" : "no"}`));
|
|
59802
59819
|
if (automation2.triggers.length > 0) {
|
|
59803
|
-
console.log(
|
|
59820
|
+
console.log(import_chalk28.default.gray(` Triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`));
|
|
59804
59821
|
}
|
|
59805
59822
|
console.log();
|
|
59806
59823
|
});
|
|
@@ -59812,7 +59829,7 @@ async function automationRunCommand(id) {
|
|
|
59812
59829
|
if (!hasCronTrigger(automation2.triggers)) {
|
|
59813
59830
|
throw new Error(`Manual run is only allowed for automations with a cron trigger. This automation has triggers: ${automation2.triggers.map(formatTrigger).join(", ")}`);
|
|
59814
59831
|
}
|
|
59815
|
-
console.log(
|
|
59832
|
+
console.log(import_chalk28.default.gray(`
|
|
59816
59833
|
Triggering automation "${automation2.name}"...`));
|
|
59817
59834
|
const response = await orgAuthenticatedFetch(
|
|
59818
59835
|
`/v1/automations/${id}/trigger`,
|
|
@@ -59823,11 +59840,11 @@ Triggering automation "${automation2.name}"...`));
|
|
|
59823
59840
|
);
|
|
59824
59841
|
if (!response.execution_id) throw new Error("Automation trigger returned no execution ID. The automation may not have started.");
|
|
59825
59842
|
output2(response, (response2) => {
|
|
59826
|
-
console.log(
|
|
59843
|
+
console.log(import_chalk28.default.green(`
|
|
59827
59844
|
Automation triggered successfully.`));
|
|
59828
|
-
console.log(
|
|
59845
|
+
console.log(import_chalk28.default.gray(` Execution ID: ${response2.execution_id}`));
|
|
59829
59846
|
if (response2.workspace_id) {
|
|
59830
|
-
console.log(
|
|
59847
|
+
console.log(import_chalk28.default.gray(` Workspace ID: ${response2.workspace_id}`));
|
|
59831
59848
|
}
|
|
59832
59849
|
console.log();
|
|
59833
59850
|
});
|
|
@@ -59861,9 +59878,9 @@ async function automationCheckCommand(checkRunId, options) {
|
|
|
59861
59878
|
`/v1/automations/checks/${id}`,
|
|
59862
59879
|
{ method: "POST", body: body2 }
|
|
59863
59880
|
);
|
|
59864
|
-
output2(response, (response2) => console.log(response2.reported ?
|
|
59881
|
+
output2(response, (response2) => console.log(response2.reported ? import_chalk28.default.green(`
|
|
59865
59882
|
Reported ${conclusion} for "${response2.name}".
|
|
59866
|
-
`) :
|
|
59883
|
+
`) : import_chalk28.default.yellow(`
|
|
59867
59884
|
Skipped "${response2.name}" \u2014 a newer run of this automation owns it and will report the verdict.
|
|
59868
59885
|
`)));
|
|
59869
59886
|
}
|
|
@@ -59879,7 +59896,7 @@ async function automationExecutionsCommand(id, options) {
|
|
|
59879
59896
|
for (const execution of response2.executions) {
|
|
59880
59897
|
console.log(`${execution.id} ${execution.status} ${formatDate(execution.triggered_at)} ${execution.workspace_id ?? "-"}${execution.error ? ` ${execution.error}` : ""}`);
|
|
59881
59898
|
}
|
|
59882
|
-
console.log(
|
|
59899
|
+
console.log(import_chalk28.default.gray(`Page ${response2.page} of ${response2.totalPages} (${response2.total} runs)`));
|
|
59883
59900
|
});
|
|
59884
59901
|
}
|
|
59885
59902
|
async function automationRetryCommand(id, executionId) {
|
|
@@ -59887,13 +59904,13 @@ async function automationRetryCommand(id, executionId) {
|
|
|
59887
59904
|
`/v1/automations/${id}/executions/${executionId}/retry`,
|
|
59888
59905
|
{ method: "POST" }
|
|
59889
59906
|
);
|
|
59890
|
-
output2(response, (response2) => console.log(
|
|
59907
|
+
output2(response, (response2) => console.log(import_chalk28.default.green(`Retried as execution ${response2.execution_id}${response2.workspace_id ? ` in workspace ${response2.workspace_id}` : ""}`)));
|
|
59891
59908
|
}
|
|
59892
|
-
var
|
|
59909
|
+
var import_chalk28, DURATION_UNIT_MS;
|
|
59893
59910
|
var init_automation = __esm({
|
|
59894
59911
|
"src/commands/automation.ts"() {
|
|
59895
59912
|
"use strict";
|
|
59896
|
-
|
|
59913
|
+
import_chalk28 = __toESM(require("chalk"));
|
|
59897
59914
|
init_output();
|
|
59898
59915
|
init_api2();
|
|
59899
59916
|
init_config();
|
|
@@ -60013,9 +60030,9 @@ async function previewListCommand(workspaceId) {
|
|
|
60013
60030
|
`/v1/replica/${workspaceId}/previews`
|
|
60014
60031
|
);
|
|
60015
60032
|
output2(result, ({ previews }) => {
|
|
60016
|
-
if (previews.length === 0) console.log(
|
|
60033
|
+
if (previews.length === 0) console.log(import_chalk29.default.dim("No active previews"));
|
|
60017
60034
|
for (const preview2 of previews) {
|
|
60018
|
-
console.log(` ${
|
|
60035
|
+
console.log(` ${import_chalk29.default.cyan(String(preview2.port))} \u2192 ${import_chalk29.default.underline(preview2.publicUrl)}`);
|
|
60019
60036
|
}
|
|
60020
60037
|
});
|
|
60021
60038
|
}
|
|
@@ -60029,7 +60046,7 @@ async function previewAddCommand(workspaceId, options) {
|
|
|
60029
60046
|
body: { port: portNum, authenticated: options.authenticated ?? false }
|
|
60030
60047
|
}
|
|
60031
60048
|
);
|
|
60032
|
-
output2(result, ({ preview: preview2 }) => console.log(
|
|
60049
|
+
output2(result, ({ preview: preview2 }) => console.log(import_chalk29.default.green(`Preview created: ${preview2.publicUrl}`)));
|
|
60033
60050
|
}
|
|
60034
60051
|
async function previewDeleteCommand(port2) {
|
|
60035
60052
|
const portNum = parsePreviewPort(port2);
|
|
@@ -60044,11 +60061,11 @@ async function previewRemoveCommand(workspaceId, options) {
|
|
|
60044
60061
|
);
|
|
60045
60062
|
outputSuccess(`Preview deleted on port ${portNum}`);
|
|
60046
60063
|
}
|
|
60047
|
-
var
|
|
60064
|
+
var import_chalk29, parsePreviewPort;
|
|
60048
60065
|
var init_preview = __esm({
|
|
60049
60066
|
"src/commands/preview.ts"() {
|
|
60050
60067
|
"use strict";
|
|
60051
|
-
|
|
60068
|
+
import_chalk29 = __toESM(require("chalk"));
|
|
60052
60069
|
init_config();
|
|
60053
60070
|
init_agent_api();
|
|
60054
60071
|
init_api2();
|
|
@@ -60539,7 +60556,7 @@ async function callIssueTool(name, args, schema, printHuman) {
|
|
|
60539
60556
|
const report = createIssueContractReport();
|
|
60540
60557
|
const parsed = parseIssueContractResponse(schema, isRecord(response) ? body2 : response, report);
|
|
60541
60558
|
if (parsed === void 0) throw new Error(`Unexpected response from the server: ${[...report.problems].join("; ")}`);
|
|
60542
|
-
if (report.dropped) console.error(
|
|
60559
|
+
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
60560
|
const actors = issueActorDirectorySchema.catch({}).parse(directory);
|
|
60544
60561
|
output2(mapIssueActors(parsed, { actor: (who) => issueActorHandle(who, actors), text: (text5) => renderIssueMentions(text5, actors) }), () => printHuman(parsed, actors));
|
|
60545
60562
|
}
|
|
@@ -60579,14 +60596,14 @@ async function issueUpdateCommand(issue3, options) {
|
|
|
60579
60596
|
async function issueViewCommand(issue3) {
|
|
60580
60597
|
await callIssueTool(ISSUE_COMMANDS.get, { issue: issue3 }, issueDetailResponseSchema, (detail, actors) => {
|
|
60581
60598
|
const name = (actor) => formatIssueActor(actor, actors);
|
|
60582
|
-
console.log(`${
|
|
60583
|
-
console.log(
|
|
60599
|
+
console.log(`${import_chalk30.default.bold.cyan(detail.issue.identifier)} ${import_chalk30.default.bold(detail.issue.title)}`);
|
|
60600
|
+
console.log(import_chalk30.default.dim(`${detail.issue.status} \xB7 priority ${detail.issue.priority}`));
|
|
60584
60601
|
const assignees = detail.subscribers.filter((subscriber) => subscriber.role === "assignee");
|
|
60585
|
-
if (assignees.length) console.log(
|
|
60602
|
+
if (assignees.length) console.log(import_chalk30.default.dim(`Assignees: ${assignees.map((a) => name(a.subscriber)).join(", ")}`));
|
|
60586
60603
|
if (detail.issue.description) console.log(`
|
|
60587
60604
|
${renderIssueMentions(detail.issue.description, actors)}`);
|
|
60588
60605
|
for (const pr2 of detail.pull_requests) console.log(`
|
|
60589
|
-
${
|
|
60606
|
+
${import_chalk30.default.magenta("PR")} ${pr2.url} (${pr2.state})`);
|
|
60590
60607
|
const issueById = new Map([detail.issue, ...detail.sub_issues, ...detail.related_issues ?? []].map((related) => [related.id, related]));
|
|
60591
60608
|
const identifierOf = (id) => issueById.get(id)?.identifier ?? (detail.related_issues ? "a deleted issue" : id);
|
|
60592
60609
|
const links = [
|
|
@@ -60599,21 +60616,21 @@ ${import_chalk29.default.magenta("PR")} ${pr2.url} (${pr2.state})`);
|
|
|
60599
60616
|
];
|
|
60600
60617
|
const linkLines = links.map(({ label, id }) => {
|
|
60601
60618
|
const related = issueById.get(id);
|
|
60602
|
-
return `${
|
|
60619
|
+
return `${import_chalk30.default.dim(label.padEnd(13))} ${related ? issueLine(related) : import_chalk30.default.dim(identifierOf(id))}`;
|
|
60603
60620
|
});
|
|
60604
60621
|
if (linkLines.length) console.log(`
|
|
60605
60622
|
${linkLines.join("\n")}`);
|
|
60606
60623
|
for (const comment of detail.comments) {
|
|
60607
60624
|
console.log(`
|
|
60608
|
-
${
|
|
60625
|
+
${import_chalk30.default.dim(`\u2014 ${name(comment.author)}, ${comment.created_at}`)}
|
|
60609
60626
|
${renderIssueMentions(comment.body, actors)}`);
|
|
60610
60627
|
}
|
|
60611
60628
|
const activity = detail.events.flatMap((event) => {
|
|
60612
60629
|
const change2 = describeIssueEvent(event, name, identifierOf);
|
|
60613
|
-
return change2 ? [`${
|
|
60630
|
+
return change2 ? [`${import_chalk30.default.dim(event.created_at)} ${name(event.actor)} ${change2}`] : [];
|
|
60614
60631
|
});
|
|
60615
60632
|
if (activity.length) console.log(`
|
|
60616
|
-
${
|
|
60633
|
+
${import_chalk30.default.bold("Activity")}
|
|
60617
60634
|
${activity.join("\n")}`);
|
|
60618
60635
|
});
|
|
60619
60636
|
}
|
|
@@ -60628,38 +60645,38 @@ async function issueListCommand(options) {
|
|
|
60628
60645
|
include_archived: options.archived,
|
|
60629
60646
|
limit: options.limit ? Number(options.limit) : void 0
|
|
60630
60647
|
}, listIssuesResponseSchema, ({ issues, next_cursor }) => {
|
|
60631
|
-
if (issues.length === 0) console.log(
|
|
60648
|
+
if (issues.length === 0) console.log(import_chalk30.default.dim("No issues"));
|
|
60632
60649
|
issues.forEach((issue3) => console.log(issueLine(issue3)));
|
|
60633
|
-
if (next_cursor !== null) console.log(
|
|
60650
|
+
if (next_cursor !== null) console.log(import_chalk30.default.dim("More issues exist; narrow the filters or raise --limit."));
|
|
60634
60651
|
});
|
|
60635
60652
|
}
|
|
60636
60653
|
async function issueCommentCommand(issue3, body2, options) {
|
|
60637
60654
|
const text5 = readText2(body2, options.file, "file") ?? "";
|
|
60638
60655
|
const media_ids = await uploadAttachments(options.attach);
|
|
60639
60656
|
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(`${
|
|
60657
|
+
await callIssueTool(ISSUE_COMMANDS.comment, { issue: issue3, body: text5, media_ids }, noData, () => console.log(`${import_chalk30.default.green("\u2713")} Commented on ${issue3}`));
|
|
60641
60658
|
}
|
|
60642
60659
|
function issueActorCommand(tool, done) {
|
|
60643
60660
|
return async (issue3, who) => {
|
|
60644
|
-
await callIssueTool(tool, { issue: issue3, who }, external_exports.looseObject({ subscriber: external_exports.looseObject({ subscriber: issueActorSchema }) }), ({ subscriber }, actors) => console.log(`${
|
|
60661
|
+
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
60662
|
};
|
|
60646
60663
|
}
|
|
60647
60664
|
async function issueLinkPrCommand(issue3, url2) {
|
|
60648
|
-
await callIssueTool(ISSUE_COMMANDS.linkPr, { issue: issue3, url: url2 }, noData, () => console.log(`${
|
|
60665
|
+
await callIssueTool(ISSUE_COMMANDS.linkPr, { issue: issue3, url: url2 }, noData, () => console.log(`${import_chalk30.default.green("\u2713")} Linked ${url2} to ${issue3}`));
|
|
60649
60666
|
}
|
|
60650
60667
|
async function issueUnlinkPrCommand(issue3, url2) {
|
|
60651
|
-
await callIssueTool(ISSUE_COMMANDS.unlinkPr, { issue: issue3, url: url2 }, noData, () => console.log(`${
|
|
60668
|
+
await callIssueTool(ISSUE_COMMANDS.unlinkPr, { issue: issue3, url: url2 }, noData, () => console.log(`${import_chalk30.default.green("\u2713")} Unlinked ${url2} from ${issue3}`));
|
|
60652
60669
|
}
|
|
60653
60670
|
async function issueRelateCommand(issue3, type, related) {
|
|
60654
|
-
await callIssueTool(ISSUE_COMMANDS.relate, { issue: issue3, type, related_issue: related }, noData, () => console.log(`${
|
|
60671
|
+
await callIssueTool(ISSUE_COMMANDS.relate, { issue: issue3, type, related_issue: related }, noData, () => console.log(`${import_chalk30.default.green("\u2713")} ${issue3} ${type.replace("_", " ")} ${related}`));
|
|
60655
60672
|
}
|
|
60656
|
-
var import_node_fs2, import_node_path2,
|
|
60673
|
+
var import_node_fs2, import_node_path2, import_chalk30, mutationSchema, noData, csv, issueLine, printMutation;
|
|
60657
60674
|
var init_issue = __esm({
|
|
60658
60675
|
"src/commands/issue.ts"() {
|
|
60659
60676
|
"use strict";
|
|
60660
60677
|
import_node_fs2 = __toESM(require("fs"));
|
|
60661
60678
|
import_node_path2 = __toESM(require("path"));
|
|
60662
|
-
|
|
60679
|
+
import_chalk30 = __toESM(require("chalk"));
|
|
60663
60680
|
init_zod();
|
|
60664
60681
|
init_src();
|
|
60665
60682
|
init_api2();
|
|
@@ -60669,8 +60686,8 @@ var init_issue = __esm({
|
|
|
60669
60686
|
mutationSchema = external_exports.object({ issue: issueSchema });
|
|
60670
60687
|
noData = external_exports.looseObject({});
|
|
60671
60688
|
csv = (value) => value?.split(",").map((entry) => entry.trim()).filter(Boolean).join(",");
|
|
60672
|
-
issueLine = (issue3) => `${
|
|
60673
|
-
printMutation = ({ issue: issue3 }) => console.log(`${
|
|
60689
|
+
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)") : ""}`;
|
|
60690
|
+
printMutation = ({ issue: issue3 }) => console.log(`${import_chalk30.default.green("\u2713")} ${import_chalk30.default.cyan(issue3.identifier)} ${issue3.title} (${issue3.status})`);
|
|
60674
60691
|
}
|
|
60675
60692
|
});
|
|
60676
60693
|
|
|
@@ -61028,10 +61045,10 @@ function parseEnv(values) {
|
|
|
61028
61045
|
return values?.length ? parseKeyValuePairs(values) : void 0;
|
|
61029
61046
|
}
|
|
61030
61047
|
function describe3(sandbox) {
|
|
61031
|
-
console.log(`${
|
|
61032
|
-
console.log(
|
|
61048
|
+
console.log(`${import_chalk31.default.bold(sandbox.id)} ${sandbox.status} ${sandbox.kind === "gpu" ? `${sandbox.gpu} ${sandbox.image}` : "macOS"}`);
|
|
61049
|
+
console.log(import_chalk31.default.gray(` expires ${new Date(sandbox.expiresAt).toLocaleString()}`));
|
|
61033
61050
|
for (const tunnel of sandbox.tunnels) console.log(` port ${tunnel.port}: ${tunnel.url}`);
|
|
61034
|
-
if (sandbox.error) console.log(
|
|
61051
|
+
if (sandbox.error) console.log(import_chalk31.default.red(` ${sandbox.error}`));
|
|
61035
61052
|
}
|
|
61036
61053
|
async function listSandboxes(kind) {
|
|
61037
61054
|
const { sandboxes } = await agentFetch(BASE);
|
|
@@ -61058,7 +61075,7 @@ async function createSandbox(kind, options) {
|
|
|
61058
61075
|
let { sandbox } = await agentFetch(BASE, { method: "POST", body: request2 });
|
|
61059
61076
|
if (options.wait === false) return sandbox;
|
|
61060
61077
|
const label = COMPUTE_SANDBOX_LABELS[kind];
|
|
61061
|
-
process.stderr.write(
|
|
61078
|
+
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
61079
|
` : `Starting ${label} ${sandbox.id}...
|
|
61063
61080
|
`));
|
|
61064
61081
|
const deadline = Date.now() + CREATE_WAIT_TIMEOUT_MS;
|
|
@@ -61125,8 +61142,8 @@ function computeExecCommand(kind) {
|
|
|
61125
61142
|
if (options.detach) {
|
|
61126
61143
|
const { jobId } = await agentFetch(path14, execRequest(command.join(" "), options));
|
|
61127
61144
|
output2({ jobId, sandboxId }, () => {
|
|
61128
|
-
console.log(`Started job ${
|
|
61129
|
-
console.log(
|
|
61145
|
+
console.log(`Started job ${import_chalk31.default.bold(jobId)} in ${sandboxId}`);
|
|
61146
|
+
console.log(import_chalk31.default.gray(`Follow it with: replicas ${kind} logs ${jobId} -f`));
|
|
61130
61147
|
});
|
|
61131
61148
|
return;
|
|
61132
61149
|
}
|
|
@@ -61147,13 +61164,13 @@ async function gpuLogsCommand(jobId, options) {
|
|
|
61147
61164
|
return;
|
|
61148
61165
|
}
|
|
61149
61166
|
if (exitCode === null) {
|
|
61150
|
-
process.stderr.write(
|
|
61167
|
+
process.stderr.write(import_chalk31.default.gray(`
|
|
61151
61168
|
Job ${jobId} is still running.
|
|
61152
61169
|
`));
|
|
61153
61170
|
return;
|
|
61154
61171
|
}
|
|
61155
61172
|
if (options.follow) process.exitCode = exitCode;
|
|
61156
|
-
process.stderr.write(
|
|
61173
|
+
process.stderr.write(import_chalk31.default.gray(`
|
|
61157
61174
|
Job ${jobId} exited with code ${exitCode}.
|
|
61158
61175
|
`));
|
|
61159
61176
|
}
|
|
@@ -61267,7 +61284,7 @@ function computeRunCommand(kind) {
|
|
|
61267
61284
|
const sandbox = await createSandbox(kind, { ...createOptions, wait: true });
|
|
61268
61285
|
const workdir = COMPUTE_SANDBOX_WORKDIRS[kind];
|
|
61269
61286
|
try {
|
|
61270
|
-
process.stderr.write(
|
|
61287
|
+
process.stderr.write(import_chalk31.default.gray(`Copying ${process.cwd()} to ${workdir}...
|
|
61271
61288
|
`));
|
|
61272
61289
|
await push(sandbox.id, ".", workdir);
|
|
61273
61290
|
const exitCode = await streamOutput(await agentRequest(`${BASE}/${sandbox.id}/exec`, execRequest(command.join(" "), { env })));
|
|
@@ -61278,17 +61295,17 @@ function computeRunCommand(kind) {
|
|
|
61278
61295
|
if (isJsonMode()) output2({ sandboxId: sandbox.id, exitCode }, () => {
|
|
61279
61296
|
});
|
|
61280
61297
|
} finally {
|
|
61281
|
-
if (options.keep) process.stderr.write(
|
|
61298
|
+
if (options.keep) process.stderr.write(import_chalk31.default.gray(`Kept ${COMPUTE_SANDBOX_LABELS[kind]} ${sandbox.id} running.
|
|
61282
61299
|
`));
|
|
61283
61300
|
else await agentRequest(`${BASE}/${sandbox.id}`, { method: "DELETE" });
|
|
61284
61301
|
}
|
|
61285
61302
|
};
|
|
61286
61303
|
}
|
|
61287
|
-
var
|
|
61304
|
+
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
61305
|
var init_compute2 = __esm({
|
|
61289
61306
|
"src/commands/compute.ts"() {
|
|
61290
61307
|
"use strict";
|
|
61291
|
-
|
|
61308
|
+
import_chalk31 = __toESM(require("chalk"));
|
|
61292
61309
|
import_node_child_process2 = require("child_process");
|
|
61293
61310
|
import_node_crypto2 = require("crypto");
|
|
61294
61311
|
import_node_fs3 = require("fs");
|
|
@@ -61323,8 +61340,8 @@ function printSource({ source }) {
|
|
|
61323
61340
|
console.log(`Managed skills: ${source.managed.skills?.join(", ") || "(none)"}`);
|
|
61324
61341
|
if (source.required_plugins?.length) console.log(`Required plugins: ${source.required_plugins.join(", ")}`);
|
|
61325
61342
|
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(
|
|
61343
|
+
if (source.pending_rebuild) console.log(import_chalk32.default.yellow("Configuration saved; environment rebuild pending."));
|
|
61344
|
+
if (source.last_error) console.log(import_chalk32.default.red(source.last_error));
|
|
61328
61345
|
}
|
|
61329
61346
|
function printPreview({ preview: preview2 }) {
|
|
61330
61347
|
console.log(preview2.kind === "file" ? `${preview2.filename} @ ${preview2.file_sha}` : `${preview2.repository_name}/${preview2.filename} @ ${preview2.commit_sha}`);
|
|
@@ -61333,14 +61350,14 @@ function printPreview({ preview: preview2 }) {
|
|
|
61333
61350
|
const requiredAfter = preview2.required_secrets?.after ?? [];
|
|
61334
61351
|
const addedSecrets = requiredAfter.filter((key2) => !requiredBefore.includes(key2));
|
|
61335
61352
|
const removedSecrets = requiredBefore.filter((key2) => !requiredAfter.includes(key2));
|
|
61336
|
-
if (preview2.blockers.length || preview2.missing_secrets.length) console.log(
|
|
61353
|
+
if (preview2.blockers.length || preview2.missing_secrets.length) console.log(import_chalk32.default.yellow("Cannot apply this configuration. No changes have been made."));
|
|
61337
61354
|
if (!preview2.changes.length && !addedSecrets.length && !removedSecrets.length) console.log("No setting changes. Applying records this configuration.");
|
|
61338
61355
|
else console.log("Proposed changes (not applied):");
|
|
61339
61356
|
for (const change2 of preview2.changes) console.log(` ${change2.kind === "plugin" ? change2.operation === "remove" ? "stop requiring" : "require" : change2.operation}: ${change2.kind} ${change2.key}`);
|
|
61340
61357
|
for (const key2 of addedSecrets) console.log(` require: secret ${key2}`);
|
|
61341
61358
|
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(
|
|
61359
|
+
if (preview2.missing_secrets.length) console.log(import_chalk32.default.yellow(`Missing required secrets: ${preview2.missing_secrets.join(", ")}`));
|
|
61360
|
+
for (const blocker of preview2.blockers) console.log(import_chalk32.default.red(` Cannot apply: ${blocker}`));
|
|
61344
61361
|
}
|
|
61345
61362
|
async function readConfigFile(filename) {
|
|
61346
61363
|
let content;
|
|
@@ -61418,11 +61435,11 @@ async function environmentConfigDisconnectCommand(environment2, options) {
|
|
|
61418
61435
|
console.log("Configuration source disconnected. Current settings preserved.");
|
|
61419
61436
|
});
|
|
61420
61437
|
}
|
|
61421
|
-
var
|
|
61438
|
+
var import_chalk32, import_promises2, import_node_path4;
|
|
61422
61439
|
var init_environment_config2 = __esm({
|
|
61423
61440
|
"src/commands/environment-config.ts"() {
|
|
61424
61441
|
"use strict";
|
|
61425
|
-
|
|
61442
|
+
import_chalk32 = __toESM(require("chalk"));
|
|
61426
61443
|
import_promises2 = require("fs/promises");
|
|
61427
61444
|
import_node_path4 = require("path");
|
|
61428
61445
|
init_src();
|
|
@@ -61477,12 +61494,12 @@ async function skillsSuggestCommand(file2, options) {
|
|
|
61477
61494
|
async function skillsListCommand() {
|
|
61478
61495
|
output2(await orgAuthenticatedFetch("/v1/learned-skills"), ({ skills: skills2, suggestions }) => {
|
|
61479
61496
|
for (const skill of skills2) console.log(`${skill.id} ${skill.name} ${skill.title}`);
|
|
61480
|
-
if (suggestions.length > 0) console.log(
|
|
61497
|
+
if (suggestions.length > 0) console.log(import_chalk33.default.gray(`${suggestions.length} pending suggestion(s) to review in the dashboard.`));
|
|
61481
61498
|
});
|
|
61482
61499
|
}
|
|
61483
61500
|
async function skillsCreateCommand(file2, options) {
|
|
61484
61501
|
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(
|
|
61502
|
+
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body: body2 }), ({ id, name }) => console.log(import_chalk33.default.green(`Saved learning '${name}' (${id})`)));
|
|
61486
61503
|
}
|
|
61487
61504
|
async function skillsUpdateCommand(id, options) {
|
|
61488
61505
|
const { skills: skills2 } = await orgAuthenticatedFetch("/v1/learned-skills");
|
|
@@ -61492,18 +61509,18 @@ async function skillsUpdateCommand(id, options) {
|
|
|
61492
61509
|
title: options.title ?? existing.title,
|
|
61493
61510
|
content: options.file ? (0, import_node_fs5.readFileSync)(options.file, "utf-8") : existing.content
|
|
61494
61511
|
};
|
|
61495
|
-
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body: body2 }), ({ name }) => console.log(
|
|
61512
|
+
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body: body2 }), ({ name }) => console.log(import_chalk33.default.green(`Updated learning '${name}'`)));
|
|
61496
61513
|
}
|
|
61497
61514
|
async function skillsDeleteCommand(id) {
|
|
61498
61515
|
await orgAuthenticatedFetch(`/v1/learned-skills/${id}`, { method: "DELETE" });
|
|
61499
61516
|
outputSuccess(`Deleted learning ${id}`);
|
|
61500
61517
|
}
|
|
61501
|
-
var import_node_fs5,
|
|
61518
|
+
var import_node_fs5, import_chalk33;
|
|
61502
61519
|
var init_skills = __esm({
|
|
61503
61520
|
"src/commands/skills.ts"() {
|
|
61504
61521
|
"use strict";
|
|
61505
61522
|
import_node_fs5 = require("fs");
|
|
61506
|
-
|
|
61523
|
+
import_chalk33 = __toESM(require("chalk"));
|
|
61507
61524
|
init_agent_api();
|
|
61508
61525
|
init_api2();
|
|
61509
61526
|
init_monolith_url();
|
|
@@ -61529,10 +61546,10 @@ async function attachThread(request2) {
|
|
|
61529
61546
|
body: request2
|
|
61530
61547
|
});
|
|
61531
61548
|
output2(response, ({ thread, workspace }) => {
|
|
61532
|
-
console.log(
|
|
61533
|
-
console.log(
|
|
61534
|
-
console.log(
|
|
61535
|
-
console.log(
|
|
61549
|
+
console.log(import_chalk34.default.green("Slack thread attached."));
|
|
61550
|
+
console.log(import_chalk34.default.gray(` Channel: ${thread.channel_id}`));
|
|
61551
|
+
console.log(import_chalk34.default.gray(` Thread: ${thread.thread_ts}`));
|
|
61552
|
+
console.log(import_chalk34.default.gray(` Workspace: ${workspace.name} (${workspace.id})`));
|
|
61536
61553
|
});
|
|
61537
61554
|
}
|
|
61538
61555
|
async function slackThreadAttachCommand(options) {
|
|
@@ -61560,11 +61577,11 @@ async function slackThreadSwitchCommand(workspace, options) {
|
|
|
61560
61577
|
workspace_id: workspaceId
|
|
61561
61578
|
});
|
|
61562
61579
|
}
|
|
61563
|
-
var
|
|
61580
|
+
var import_chalk34;
|
|
61564
61581
|
var init_slack4 = __esm({
|
|
61565
61582
|
"src/commands/slack.ts"() {
|
|
61566
61583
|
"use strict";
|
|
61567
|
-
|
|
61584
|
+
import_chalk34 = __toESM(require("chalk"));
|
|
61568
61585
|
init_api2();
|
|
61569
61586
|
init_config();
|
|
61570
61587
|
init_output();
|
|
@@ -61728,7 +61745,7 @@ async function serviceListCommand() {
|
|
|
61728
61745
|
return;
|
|
61729
61746
|
}
|
|
61730
61747
|
for (const service of services) {
|
|
61731
|
-
const status = service.running ?
|
|
61748
|
+
const status = service.running ? import_chalk35.default.green("running") : import_chalk35.default.red("stopped");
|
|
61732
61749
|
console.log(`${service.name} ${status} pid ${service.pid} started ${service.startedAt}`);
|
|
61733
61750
|
console.log(` command: ${service.command} (cwd: ${service.cwd})`);
|
|
61734
61751
|
console.log(` logs: ${service.logFile}`);
|
|
@@ -61748,11 +61765,11 @@ async function serviceLogsCommand(name, options) {
|
|
|
61748
61765
|
console.log(logs || "(no log output yet)");
|
|
61749
61766
|
});
|
|
61750
61767
|
}
|
|
61751
|
-
var
|
|
61768
|
+
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
61769
|
var init_service = __esm({
|
|
61753
61770
|
"src/commands/service.ts"() {
|
|
61754
61771
|
"use strict";
|
|
61755
|
-
|
|
61772
|
+
import_chalk35 = __toESM(require("chalk"));
|
|
61756
61773
|
import_node_child_process3 = require("child_process");
|
|
61757
61774
|
import_node_fs6 = require("fs");
|
|
61758
61775
|
import_node_os3 = require("os");
|
|
@@ -61810,7 +61827,7 @@ async function deviceConnectCommand() {
|
|
|
61810
61827
|
stream.destroy();
|
|
61811
61828
|
};
|
|
61812
61829
|
sshd.once("error", (error62) => {
|
|
61813
|
-
console.log(
|
|
61830
|
+
console.log(import_chalk36.default.yellow(`A workspace couldn't reach SSH on port ${port2} here (${error62.message}). ${REMOTE_LOGIN_HINT}`));
|
|
61814
61831
|
});
|
|
61815
61832
|
sshd.on("error", close).on("close", close);
|
|
61816
61833
|
stream.on("error", close).on("close", close);
|
|
@@ -61854,16 +61871,16 @@ async function deviceConnectCommand() {
|
|
|
61854
61871
|
}
|
|
61855
61872
|
}
|
|
61856
61873
|
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 ?
|
|
61874
|
+
if (next !== summary) console.log(problem ? import_chalk36.default.yellow(next) : import_chalk36.default.green(next));
|
|
61858
61875
|
summary = next;
|
|
61859
61876
|
await (0, import_promises3.setTimeout)(POLL_INTERVAL_MS);
|
|
61860
61877
|
}
|
|
61861
61878
|
}
|
|
61862
|
-
var
|
|
61879
|
+
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
61880
|
var init_device = __esm({
|
|
61864
61881
|
"src/commands/device.ts"() {
|
|
61865
61882
|
"use strict";
|
|
61866
|
-
|
|
61883
|
+
import_chalk36 = __toESM(require("chalk"));
|
|
61867
61884
|
import_node_child_process4 = require("child_process");
|
|
61868
61885
|
import_node_net = require("net");
|
|
61869
61886
|
import_promises3 = require("timers/promises");
|
|
@@ -61965,8 +61982,8 @@ async function localControlRequestCommand(options) {
|
|
|
61965
61982
|
await orgAuthenticatedFetch("/v1/local-control-request", { method: "DELETE" });
|
|
61966
61983
|
output2({ status: "connected", computers: computers2 }, () => {
|
|
61967
61984
|
console.log(`
|
|
61968
|
-
${
|
|
61969
|
-
console.log(
|
|
61985
|
+
${import_chalk37.default.green("Connected:")} ${computers2.join(", ")}`);
|
|
61986
|
+
console.log(import_chalk37.default.gray(` Run commands there with: ssh ${computers2[0]} '<command>'
|
|
61970
61987
|
`));
|
|
61971
61988
|
});
|
|
61972
61989
|
};
|
|
@@ -61988,7 +62005,7 @@ async function localControlRequestCommand(options) {
|
|
|
61988
62005
|
});
|
|
61989
62006
|
if (found.length > 0) return connected(found);
|
|
61990
62007
|
output2({ status: "not_connected", computers: [], url: created2.url }, () => {
|
|
61991
|
-
console.log(
|
|
62008
|
+
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
62009
|
});
|
|
61993
62010
|
return;
|
|
61994
62011
|
}
|
|
@@ -62011,10 +62028,10 @@ async function localControlRequestCommand(options) {
|
|
|
62011
62028
|
}
|
|
62012
62029
|
output2({ status: pending ? "pending" : "declined", computers: [], url: created2.url }, () => {
|
|
62013
62030
|
if (!pending) {
|
|
62014
|
-
console.log(
|
|
62031
|
+
console.log(import_chalk37.default.yellow("\n The user declined. Continue without their computer, or ask how they want to proceed.\n"));
|
|
62015
62032
|
return;
|
|
62016
62033
|
}
|
|
62017
|
-
console.log(
|
|
62034
|
+
console.log(import_chalk37.default.gray(options.wait === false ? `
|
|
62018
62035
|
Asked above the chat composer (${created2.url}). Keep working, and run this command again when you need the computer.
|
|
62019
62036
|
` : created2.wait ? `
|
|
62020
62037
|
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 +62041,7 @@ async function localControlRequestCommand(options) {
|
|
|
62024
62041
|
`));
|
|
62025
62042
|
});
|
|
62026
62043
|
}
|
|
62027
|
-
var import_child_process6, import_fs11, import_os5, import_path11, import_util10,
|
|
62044
|
+
var import_child_process6, import_fs11, import_os5, import_path11, import_util10, import_chalk37, execFileAsync2;
|
|
62028
62045
|
var init_local_control = __esm({
|
|
62029
62046
|
"src/commands/local-control.ts"() {
|
|
62030
62047
|
"use strict";
|
|
@@ -62033,7 +62050,7 @@ var init_local_control = __esm({
|
|
|
62033
62050
|
import_os5 = __toESM(require("os"));
|
|
62034
62051
|
import_path11 = __toESM(require("path"));
|
|
62035
62052
|
import_util10 = require("util");
|
|
62036
|
-
|
|
62053
|
+
import_chalk37 = __toESM(require("chalk"));
|
|
62037
62054
|
init_src();
|
|
62038
62055
|
init_api2();
|
|
62039
62056
|
init_command_utils();
|
|
@@ -62123,7 +62140,7 @@ function printRun({ run: run2 }) {
|
|
|
62123
62140
|
const units = Object.values(run2.coverage);
|
|
62124
62141
|
const done = units.filter((unit) => unit.status === "covered" || unit.status === "skipped").length;
|
|
62125
62142
|
console.log(`
|
|
62126
|
-
Run ${run2.id} (${run2.type}): ${
|
|
62143
|
+
Run ${run2.id} (${run2.type}): ${import_chalk38.default.bold(run2.status)}`);
|
|
62127
62144
|
console.log(` Coverage: ${done}/${units.length} units recorded`);
|
|
62128
62145
|
console.log(` Effort: ${run2.budget.effort} (${run2.budget.minutes} min, ${run2.budget.agent_calls} agent calls${run2.budget.cents ? `, $${run2.budget.cents / 100}` : ""})
|
|
62129
62146
|
`);
|
|
@@ -62136,7 +62153,7 @@ async function securityStatusCommand() {
|
|
|
62136
62153
|
if (run2.agents) console.log(` Agents: finder ${run2.agents.finder.model}, checker ${run2.agents.checker.model} (${run2.agents.checker_mode})
|
|
62137
62154
|
`);
|
|
62138
62155
|
const threatModel = run2.threat_model ?? profile?.threat_model;
|
|
62139
|
-
console.log(
|
|
62156
|
+
console.log(import_chalk38.default.bold(" Threat model"));
|
|
62140
62157
|
if (!threatModel) console.log(" None yet. Write one in your plan.");
|
|
62141
62158
|
else {
|
|
62142
62159
|
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 +62162,17 @@ async function securityStatusCommand() {
|
|
|
62145
62162
|
}
|
|
62146
62163
|
}
|
|
62147
62164
|
if (profile?.settings.custom_direction) console.log(`
|
|
62148
|
-
${
|
|
62165
|
+
${import_chalk38.default.bold(" Direction from the admin")}
|
|
62149
62166
|
${profile.settings.custom_direction}`);
|
|
62150
62167
|
if (environment2) {
|
|
62151
62168
|
console.log(`
|
|
62152
|
-
${
|
|
62169
|
+
${import_chalk38.default.bold(" Environment")} (names only)`);
|
|
62153
62170
|
console.log(` Variables: ${environment2.variable_names.join(", ") || "none"}`);
|
|
62154
62171
|
console.log(` Files: ${environment2.file_paths.join(", ") || "none"}`);
|
|
62155
62172
|
}
|
|
62156
62173
|
console.log("");
|
|
62157
62174
|
if (dismissed.length) {
|
|
62158
|
-
console.log(
|
|
62175
|
+
console.log(import_chalk38.default.bold(` Dismissed before (${dismissed.length}); don't raise these again unless something changed:`));
|
|
62159
62176
|
for (const finding2 of dismissed) {
|
|
62160
62177
|
console.log(` - ${finding2.title} [${finding2.kind}/${finding2.weakness}] ${finding2.dismissal_reason}${finding2.dismissal_note ? `: ${finding2.dismissal_note}` : ""}`);
|
|
62161
62178
|
}
|
|
@@ -62166,7 +62183,7 @@ ${import_chalk37.default.bold(" Environment")} (names only)`);
|
|
|
62166
62183
|
async function securityPlanCommand(options) {
|
|
62167
62184
|
output2(await request("/plan", { method: "POST", body: await measurePlan(readJson(options.file)) }), (result) => {
|
|
62168
62185
|
printRun(result);
|
|
62169
|
-
console.log(result.run.status === "awaiting_approval" ?
|
|
62186
|
+
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
62187
|
});
|
|
62171
62188
|
}
|
|
62172
62189
|
async function securityUnitCommand(key2, status, options) {
|
|
@@ -62269,7 +62286,7 @@ async function checkLocation(body2) {
|
|
|
62269
62286
|
}
|
|
62270
62287
|
function printUpsertedFinding({ finding, created: created2 }) {
|
|
62271
62288
|
console.log(`
|
|
62272
|
-
${created2 ?
|
|
62289
|
+
${created2 ? import_chalk38.default.green("New finding") : "Matched an existing finding"} ${finding.id} (${finding.status}, ${finding.proof_level})
|
|
62273
62290
|
`);
|
|
62274
62291
|
}
|
|
62275
62292
|
async function securityCandidateCommand(options) {
|
|
@@ -62353,7 +62370,7 @@ async function securityProofCommand(findingId, options) {
|
|
|
62353
62370
|
async function securityPolicyBlockCommand(provider2, code) {
|
|
62354
62371
|
const body2 = { provider: provider2, code };
|
|
62355
62372
|
output2(await request("/policy-blocks", { method: "POST", body: body2 }), () => {
|
|
62356
|
-
console.log(
|
|
62373
|
+
console.log(import_chalk38.default.gray(`
|
|
62357
62374
|
Recorded a ${code} block from ${provider2}.
|
|
62358
62375
|
`));
|
|
62359
62376
|
});
|
|
@@ -62362,7 +62379,7 @@ async function securityAppSetupCommand(options) {
|
|
|
62362
62379
|
const result = options.file ? await request("/app-setup", { method: "PUT", body: readJson(options.file) }) : await request("/app-setup");
|
|
62363
62380
|
output2(result, ({ app_setup }) => {
|
|
62364
62381
|
console.log(app_setup ? `
|
|
62365
|
-
App setup: ${
|
|
62382
|
+
App setup: ${import_chalk38.default.bold(app_setup.status)}${app_setup.reason ? ` (${app_setup.reason})` : ""}
|
|
62366
62383
|
` : "\n No app setup yet.\n");
|
|
62367
62384
|
});
|
|
62368
62385
|
}
|
|
@@ -62433,14 +62450,14 @@ async function securityReviewCommand(options) {
|
|
|
62433
62450
|
` : "\n Recorded. No pull request was opened.\n");
|
|
62434
62451
|
});
|
|
62435
62452
|
}
|
|
62436
|
-
var import_child_process7, import_fs12, import_path12,
|
|
62453
|
+
var import_child_process7, import_fs12, import_path12, import_chalk38, CHUNK_LINES, CHUNK_FILES, TRACE_BRIEF;
|
|
62437
62454
|
var init_security2 = __esm({
|
|
62438
62455
|
"src/commands/security.ts"() {
|
|
62439
62456
|
"use strict";
|
|
62440
62457
|
import_child_process7 = require("child_process");
|
|
62441
62458
|
import_fs12 = __toESM(require("fs"));
|
|
62442
62459
|
import_path12 = require("path");
|
|
62443
|
-
|
|
62460
|
+
import_chalk38 = __toESM(require("chalk"));
|
|
62444
62461
|
init_src();
|
|
62445
62462
|
init_security_checkout();
|
|
62446
62463
|
init_api2();
|
|
@@ -62944,11 +62961,11 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
62944
62961
|
|
|
62945
62962
|
// src/bin.ts
|
|
62946
62963
|
var import_node_child_process6 = require("child_process");
|
|
62947
|
-
var
|
|
62964
|
+
var import_chalk39 = __toESM(require("chalk"));
|
|
62948
62965
|
init_config();
|
|
62949
62966
|
if (process.argv[2] === "computer" && isAgentMode()) {
|
|
62950
62967
|
const result = (0, import_node_child_process6.spawnSync)("replicas-computer", process.argv.slice(3), { stdio: "inherit" });
|
|
62951
|
-
if (result.error) console.error(
|
|
62968
|
+
if (result.error) console.error(import_chalk39.default.red(`
|
|
62952
62969
|
\u2717 replicas-computer is unavailable in this workspace image
|
|
62953
62970
|
`));
|
|
62954
62971
|
process.exitCode = result.error ? 1 : result.status ?? 1;
|