replicas-cli 0.3.74 → 0.3.76
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 +212 -274
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23126,8 +23126,7 @@ var sendChatMessageRequestSchema = external_exports.object({
|
|
|
23126
23126
|
senderDisplayName: external_exports.string().optional(),
|
|
23127
23127
|
senderAvatarUrl: external_exports.string().optional(),
|
|
23128
23128
|
errorNotificationTarget: integrationErrorNotificationTargetSchema.optional(),
|
|
23129
|
-
errorNotificationTargets: external_exports.array(integrationErrorNotificationTargetSchema).optional()
|
|
23130
|
-
streamSlackActivity: external_exports.boolean().optional()
|
|
23129
|
+
errorNotificationTargets: external_exports.array(integrationErrorNotificationTargetSchema).optional()
|
|
23131
23130
|
}).passthrough();
|
|
23132
23131
|
function normalizeCodexAspTranscriptStatus(status, failed = false) {
|
|
23133
23132
|
if (failed || status === "failed" || status === "declined") return "failed";
|
|
@@ -28646,7 +28645,7 @@ var headlessAgentRequestSchema = external_exports.object({
|
|
|
28646
28645
|
});
|
|
28647
28646
|
|
|
28648
28647
|
// ../shared/src/cli-version.ts
|
|
28649
|
-
var CLI_VERSION = "0.3.
|
|
28648
|
+
var CLI_VERSION = "0.3.76";
|
|
28650
28649
|
|
|
28651
28650
|
// ../shared/src/version.ts
|
|
28652
28651
|
function compareVersions(v1, v2) {
|
|
@@ -31392,11 +31391,89 @@ Replicas CLI ${currentVersion} \u2192 ${latestVersion} available. Update: npm in
|
|
|
31392
31391
|
}
|
|
31393
31392
|
|
|
31394
31393
|
// src/commands/replica.ts
|
|
31395
|
-
var
|
|
31394
|
+
var import_chalk21 = __toESM(require("chalk"));
|
|
31396
31395
|
|
|
31397
31396
|
// src/commands/environment.ts
|
|
31398
31397
|
var import_fs4 = __toESM(require("fs"));
|
|
31398
|
+
var import_chalk20 = __toESM(require("chalk"));
|
|
31399
|
+
|
|
31400
|
+
// src/commands/repositories.ts
|
|
31399
31401
|
var import_chalk19 = __toESM(require("chalk"));
|
|
31402
|
+
async function repositoriesListCommand() {
|
|
31403
|
+
ensureOrgApiAuthenticated();
|
|
31404
|
+
output(await orgAuthenticatedFetch("/v1/repositories"), ({ repositories }) => {
|
|
31405
|
+
if (repositories.length === 0) {
|
|
31406
|
+
console.log(import_chalk19.default.yellow("\nNo repositories found.\n"));
|
|
31407
|
+
return;
|
|
31408
|
+
}
|
|
31409
|
+
console.log(import_chalk19.default.green(`
|
|
31410
|
+
Repositories (${repositories.length}):
|
|
31411
|
+
`));
|
|
31412
|
+
for (const repo of repositories) {
|
|
31413
|
+
console.log(import_chalk19.default.white(` ${repo.name}`));
|
|
31414
|
+
console.log(import_chalk19.default.gray(` ID: ${repo.id}`));
|
|
31415
|
+
console.log(import_chalk19.default.gray(` URL: ${repo.url}`));
|
|
31416
|
+
console.log(import_chalk19.default.gray(` Default Branch: ${repo.default_branch}`));
|
|
31417
|
+
console.log(import_chalk19.default.gray(` Created: ${formatDate(repo.created_at)}`));
|
|
31418
|
+
if (repo.github_repository_id) {
|
|
31419
|
+
console.log(import_chalk19.default.gray(` GitHub ID: ${repo.github_repository_id}`));
|
|
31420
|
+
}
|
|
31421
|
+
console.log();
|
|
31422
|
+
}
|
|
31423
|
+
});
|
|
31424
|
+
}
|
|
31425
|
+
async function resolveRepositoryIds(inputs) {
|
|
31426
|
+
const { repositories } = await orgAuthenticatedFetch("/v1/repositories");
|
|
31427
|
+
return inputs.map((input) => {
|
|
31428
|
+
const repository = resolveByNameOrId(input, repositories);
|
|
31429
|
+
if (!repository) throw new Error(`Repository not found: ${input}`);
|
|
31430
|
+
return repository.id;
|
|
31431
|
+
});
|
|
31432
|
+
}
|
|
31433
|
+
var splitList = (value) => value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
31434
|
+
async function repositoriesAvailableCommand() {
|
|
31435
|
+
output(await orgAuthenticatedFetch("/v1/github/repositories"), ({ repositories, hasInstallations, installUrl }) => {
|
|
31436
|
+
if (!hasInstallations) {
|
|
31437
|
+
console.log(`The GitHub app is not installed. Install it: ${installUrl}`);
|
|
31438
|
+
return;
|
|
31439
|
+
}
|
|
31440
|
+
for (const repository of repositories) console.log(`${repository.fullName} ${repository.defaultBranch ?? ""}`);
|
|
31441
|
+
});
|
|
31442
|
+
}
|
|
31443
|
+
async function repositoriesAddCommand(fullName, options) {
|
|
31444
|
+
const { repositories } = await orgAuthenticatedFetch("/v1/github/repositories");
|
|
31445
|
+
const repository = repositories.find((item) => item.fullName.toLowerCase() === fullName.toLowerCase());
|
|
31446
|
+
if (!repository) throw new Error(`${fullName} is not reachable by the GitHub app. List options with: replicas repos available`);
|
|
31447
|
+
const body = {
|
|
31448
|
+
provider: "github",
|
|
31449
|
+
name: repository.name,
|
|
31450
|
+
url: repository.cloneUrl,
|
|
31451
|
+
default_branch: options.defaultBranch ?? repository.defaultBranch,
|
|
31452
|
+
github_installation_id: repository.installationId,
|
|
31453
|
+
github_repository_id: repository.id
|
|
31454
|
+
};
|
|
31455
|
+
await orgAuthenticatedFetch("/v1/repositories", { method: "POST", body });
|
|
31456
|
+
outputSuccess(`Added ${repository.fullName}`);
|
|
31457
|
+
}
|
|
31458
|
+
async function repositoriesUpdateCommand(repository, options) {
|
|
31459
|
+
const [id] = await resolveRepositoryIds([repository]);
|
|
31460
|
+
const body = { default_branch: options.defaultBranch };
|
|
31461
|
+
await orgAuthenticatedFetch(`/v1/repositories/${id}`, { method: "PATCH", body });
|
|
31462
|
+
outputSuccess(`Default branch set to ${options.defaultBranch}`);
|
|
31463
|
+
}
|
|
31464
|
+
async function repositoriesDeleteCommand(repository) {
|
|
31465
|
+
const [id] = await resolveRepositoryIds([repository]);
|
|
31466
|
+
await orgAuthenticatedFetch(`/v1/repositories/${id}`, { method: "DELETE" });
|
|
31467
|
+
outputSuccess(`Removed repository ${repository}`);
|
|
31468
|
+
}
|
|
31469
|
+
async function repositoriesBranchesCommand(repository) {
|
|
31470
|
+
const [id] = await resolveRepositoryIds([repository]);
|
|
31471
|
+
output(await orgAuthenticatedFetch(`/v1/repositories/${id}/branches`), ({ branches }) => {
|
|
31472
|
+
for (const branch of branches) console.log(branch);
|
|
31473
|
+
});
|
|
31474
|
+
}
|
|
31475
|
+
|
|
31476
|
+
// src/commands/environment.ts
|
|
31400
31477
|
function maskValue(value) {
|
|
31401
31478
|
if (value.length <= 4) return "\u2022\u2022\u2022\u2022";
|
|
31402
31479
|
return `${value.slice(0, 2)}${"\u2022".repeat(Math.min(value.length - 4, 12))}${value.slice(-2)} (${value.length} chars)`;
|
|
@@ -31412,19 +31489,19 @@ async function resolveEnvironmentId(input) {
|
|
|
31412
31489
|
return resolved.id;
|
|
31413
31490
|
}
|
|
31414
31491
|
function printEnvironment(env) {
|
|
31415
|
-
console.log(
|
|
31416
|
-
console.log(
|
|
31492
|
+
console.log(import_chalk20.default.white(` ${env.name}${env.is_global ? import_chalk20.default.gray(" (global)") : ""}`));
|
|
31493
|
+
console.log(import_chalk20.default.gray(` ID: ${env.id}`));
|
|
31417
31494
|
if (env.description) {
|
|
31418
|
-
console.log(
|
|
31495
|
+
console.log(import_chalk20.default.gray(` Description: ${env.description}`));
|
|
31419
31496
|
}
|
|
31420
31497
|
const repositoryIds = env.repository_ids ?? [];
|
|
31421
31498
|
if (repositoryIds.length > 0) {
|
|
31422
|
-
console.log(
|
|
31499
|
+
console.log(import_chalk20.default.gray(` Repositories: ${repositoryIds.join(", ")}`));
|
|
31423
31500
|
}
|
|
31424
31501
|
if (env.variable_count !== void 0) {
|
|
31425
|
-
console.log(
|
|
31502
|
+
console.log(import_chalk20.default.gray(` Variables: ${env.variable_count}, Files: ${env.file_count ?? 0}, Skills: ${env.skill_count ?? 0}, MCPs: ${env.mcp_count ?? 0}`));
|
|
31426
31503
|
}
|
|
31427
|
-
console.log(
|
|
31504
|
+
console.log(import_chalk20.default.gray(` Updated: ${formatDate(env.updated_at)}`));
|
|
31428
31505
|
console.log();
|
|
31429
31506
|
}
|
|
31430
31507
|
async function environmentListCommand() {
|
|
@@ -31432,10 +31509,10 @@ async function environmentListCommand() {
|
|
|
31432
31509
|
const response = await orgAuthenticatedFetch("/v1/environments");
|
|
31433
31510
|
output(response, ({ environments }) => {
|
|
31434
31511
|
if (environments.length === 0) {
|
|
31435
|
-
console.log(
|
|
31512
|
+
console.log(import_chalk20.default.yellow("\nNo environments found.\n"));
|
|
31436
31513
|
return;
|
|
31437
31514
|
}
|
|
31438
|
-
console.log(
|
|
31515
|
+
console.log(import_chalk20.default.green(`
|
|
31439
31516
|
Environments (${environments.length}):
|
|
31440
31517
|
`));
|
|
31441
31518
|
for (const env of environments) printEnvironment(env);
|
|
@@ -31446,7 +31523,7 @@ async function environmentGetCommand(idOrName) {
|
|
|
31446
31523
|
const id = await resolveEnvironmentId(idOrName);
|
|
31447
31524
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}`);
|
|
31448
31525
|
output(response, ({ environment: environment2 }) => {
|
|
31449
|
-
console.log(
|
|
31526
|
+
console.log(import_chalk20.default.green(`
|
|
31450
31527
|
Environment: ${environment2.name}
|
|
31451
31528
|
`));
|
|
31452
31529
|
printEnvironment(environment2);
|
|
@@ -31463,42 +31540,33 @@ async function environmentCreateCommand(name, options) {
|
|
|
31463
31540
|
validate: (v) => v.trim() ? true : "Name is required"
|
|
31464
31541
|
});
|
|
31465
31542
|
if (!r.name) {
|
|
31466
|
-
console.log(
|
|
31543
|
+
console.log(import_chalk20.default.yellow("\nCancelled."));
|
|
31467
31544
|
return;
|
|
31468
31545
|
}
|
|
31469
31546
|
envName = r.name;
|
|
31470
31547
|
}
|
|
31471
|
-
let
|
|
31548
|
+
let repositoryIds = [];
|
|
31472
31549
|
if (options.repository) {
|
|
31473
|
-
|
|
31474
|
-
repositoryId = options.repository;
|
|
31475
|
-
} else {
|
|
31476
|
-
const repos2 = await orgAuthenticatedFetch("/v1/repositories");
|
|
31477
|
-
const repo = repos2.repositories.find((r) => r.name === options.repository);
|
|
31478
|
-
if (!repo) {
|
|
31479
|
-
throw new Error(`Repository not found: ${options.repository}. Available: ${repos2.repositories.map((r) => r.name).join(", ")}`);
|
|
31480
|
-
}
|
|
31481
|
-
repositoryId = repo.id;
|
|
31482
|
-
}
|
|
31550
|
+
repositoryIds = await resolveRepositoryIds(splitList(options.repository));
|
|
31483
31551
|
} else {
|
|
31484
31552
|
const repos2 = await orgAuthenticatedFetch("/v1/repositories");
|
|
31485
31553
|
if (repos2.repositories.length > 0 && isInteractive()) {
|
|
31486
31554
|
const r = await ask({
|
|
31487
31555
|
type: "select",
|
|
31488
31556
|
name: "repo",
|
|
31489
|
-
message: "
|
|
31557
|
+
message: "Add a repository (esc to skip):",
|
|
31490
31558
|
choices: [
|
|
31491
31559
|
...repos2.repositories.map((repo) => ({ title: repo.name, value: repo.id })),
|
|
31492
|
-
{ title: "(no
|
|
31560
|
+
{ title: "(no repository)", value: "" }
|
|
31493
31561
|
]
|
|
31494
31562
|
});
|
|
31495
|
-
if (r.repo)
|
|
31563
|
+
if (r.repo) repositoryIds = [r.repo];
|
|
31496
31564
|
}
|
|
31497
31565
|
}
|
|
31498
31566
|
const body = {
|
|
31499
31567
|
name: envName,
|
|
31500
31568
|
description: options.description ?? null,
|
|
31501
|
-
|
|
31569
|
+
repository_ids: repositoryIds,
|
|
31502
31570
|
system_prompt: options.systemPrompt ?? null
|
|
31503
31571
|
};
|
|
31504
31572
|
const response = await orgAuthenticatedFetch("/v1/environments", {
|
|
@@ -31506,9 +31574,9 @@ async function environmentCreateCommand(name, options) {
|
|
|
31506
31574
|
body
|
|
31507
31575
|
});
|
|
31508
31576
|
output(response, ({ environment: environment2 }) => {
|
|
31509
|
-
console.log(
|
|
31577
|
+
console.log(import_chalk20.default.green(`
|
|
31510
31578
|
Created environment: ${environment2.name}`));
|
|
31511
|
-
console.log(
|
|
31579
|
+
console.log(import_chalk20.default.gray(` ID: ${environment2.id}
|
|
31512
31580
|
`));
|
|
31513
31581
|
});
|
|
31514
31582
|
}
|
|
@@ -31520,16 +31588,7 @@ async function environmentEditCommand(idOrName, options) {
|
|
|
31520
31588
|
if (options.description !== void 0) body.description = options.description;
|
|
31521
31589
|
if (options.systemPrompt !== void 0) body.system_prompt = options.systemPrompt;
|
|
31522
31590
|
if (options.repository !== void 0) {
|
|
31523
|
-
|
|
31524
|
-
body.repository_id = null;
|
|
31525
|
-
} else if (UUID_RE.test(options.repository)) {
|
|
31526
|
-
body.repository_id = options.repository;
|
|
31527
|
-
} else {
|
|
31528
|
-
const repos2 = await orgAuthenticatedFetch("/v1/repositories");
|
|
31529
|
-
const repo = repos2.repositories.find((r) => r.name === options.repository);
|
|
31530
|
-
if (!repo) throw new Error(`Repository not found: ${options.repository}`);
|
|
31531
|
-
body.repository_id = repo.id;
|
|
31532
|
-
}
|
|
31591
|
+
body.repository_ids = options.repository === "" || options.repository === "null" ? [] : await resolveRepositoryIds(splitList(options.repository));
|
|
31533
31592
|
}
|
|
31534
31593
|
if (Object.keys(body).length === 0) {
|
|
31535
31594
|
throw new Error("No changes specified. Pass --name, --description, --repository, or --system-prompt.");
|
|
@@ -31538,7 +31597,7 @@ async function environmentEditCommand(idOrName, options) {
|
|
|
31538
31597
|
method: "PATCH",
|
|
31539
31598
|
body
|
|
31540
31599
|
});
|
|
31541
|
-
output(response, ({ environment: environment2 }) => console.log(
|
|
31600
|
+
output(response, ({ environment: environment2 }) => console.log(import_chalk20.default.green(`
|
|
31542
31601
|
Updated environment: ${environment2.name}
|
|
31543
31602
|
`)));
|
|
31544
31603
|
}
|
|
@@ -31552,10 +31611,10 @@ Deleted environment ${idOrName}.
|
|
|
31552
31611
|
`);
|
|
31553
31612
|
}
|
|
31554
31613
|
function printVariable(v) {
|
|
31555
|
-
console.log(
|
|
31556
|
-
console.log(
|
|
31557
|
-
console.log(
|
|
31558
|
-
console.log(
|
|
31614
|
+
console.log(import_chalk20.default.white(` ${v.key}`));
|
|
31615
|
+
console.log(import_chalk20.default.gray(` ID: ${v.id}`));
|
|
31616
|
+
console.log(import_chalk20.default.gray(` Value: ${v.value}`));
|
|
31617
|
+
console.log(import_chalk20.default.gray(` Updated: ${formatDate(v.updated_at)}`));
|
|
31559
31618
|
console.log();
|
|
31560
31619
|
}
|
|
31561
31620
|
async function envVarsListCommand(envIdOrName, options) {
|
|
@@ -31567,14 +31626,14 @@ async function envVarsListCommand(envIdOrName, options) {
|
|
|
31567
31626
|
const variables = options.reveal ? response.environment_variables : response.environment_variables.map((v) => ({ ...v, value: maskValue(v.value) }));
|
|
31568
31627
|
output({ environment_variables: variables }, ({ environment_variables }) => {
|
|
31569
31628
|
if (environment_variables.length === 0) {
|
|
31570
|
-
console.log(
|
|
31629
|
+
console.log(import_chalk20.default.yellow("\nNo variables.\n"));
|
|
31571
31630
|
return;
|
|
31572
31631
|
}
|
|
31573
|
-
console.log(
|
|
31632
|
+
console.log(import_chalk20.default.green(`
|
|
31574
31633
|
Variables (${environment_variables.length}):
|
|
31575
31634
|
`));
|
|
31576
31635
|
if (!options.reveal) {
|
|
31577
|
-
console.log(
|
|
31636
|
+
console.log(import_chalk20.default.gray(" Values are masked. Pass --reveal to show full values.\n"));
|
|
31578
31637
|
}
|
|
31579
31638
|
for (const v of environment_variables) printVariable(v);
|
|
31580
31639
|
});
|
|
@@ -31592,7 +31651,7 @@ async function envVarsSetCommand(envIdOrName, key, value) {
|
|
|
31592
31651
|
`/v1/environments/${id}/variables/${match.id}`,
|
|
31593
31652
|
{ method: "PATCH", body: body2 }
|
|
31594
31653
|
);
|
|
31595
|
-
output({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
31654
|
+
output({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk20.default.green(`
|
|
31596
31655
|
Updated variable ${environment_variable.key}.
|
|
31597
31656
|
`)));
|
|
31598
31657
|
return;
|
|
@@ -31606,7 +31665,7 @@ Updated variable ${environment_variable.key}.
|
|
|
31606
31665
|
`/v1/environments/${id}/variables`,
|
|
31607
31666
|
{ method: "POST", body }
|
|
31608
31667
|
);
|
|
31609
|
-
output({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(
|
|
31668
|
+
output({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk20.default.green(`
|
|
31610
31669
|
Created variable ${environment_variable.key}.
|
|
31611
31670
|
`)));
|
|
31612
31671
|
}
|
|
@@ -31631,11 +31690,11 @@ Deleted variable ${keyOrId}.
|
|
|
31631
31690
|
`);
|
|
31632
31691
|
}
|
|
31633
31692
|
function printFile(f) {
|
|
31634
|
-
console.log(
|
|
31635
|
-
console.log(
|
|
31636
|
-
console.log(
|
|
31637
|
-
console.log(
|
|
31638
|
-
console.log(
|
|
31693
|
+
console.log(import_chalk20.default.white(` ${f.path}`));
|
|
31694
|
+
console.log(import_chalk20.default.gray(` ID: ${f.id}`));
|
|
31695
|
+
console.log(import_chalk20.default.gray(` Name: ${f.name}`));
|
|
31696
|
+
console.log(import_chalk20.default.gray(` Size: ${f.content.length} bytes`));
|
|
31697
|
+
console.log(import_chalk20.default.gray(` Updated: ${formatDate(f.updated_at)}`));
|
|
31639
31698
|
console.log();
|
|
31640
31699
|
}
|
|
31641
31700
|
async function envFilesListCommand(envIdOrName) {
|
|
@@ -31646,10 +31705,10 @@ async function envFilesListCommand(envIdOrName) {
|
|
|
31646
31705
|
);
|
|
31647
31706
|
output(response, ({ environment_files }) => {
|
|
31648
31707
|
if (environment_files.length === 0) {
|
|
31649
|
-
console.log(
|
|
31708
|
+
console.log(import_chalk20.default.yellow("\nNo files.\n"));
|
|
31650
31709
|
return;
|
|
31651
31710
|
}
|
|
31652
|
-
console.log(
|
|
31711
|
+
console.log(import_chalk20.default.green(`
|
|
31653
31712
|
Files (${environment_files.length}):
|
|
31654
31713
|
`));
|
|
31655
31714
|
for (const f of environment_files) printFile(f);
|
|
@@ -31681,7 +31740,7 @@ async function envFilesSetCommand(envIdOrName, destinationPath, options) {
|
|
|
31681
31740
|
`/v1/environments/${id}/files/${match.id}`,
|
|
31682
31741
|
{ method: "PATCH", body: body2 }
|
|
31683
31742
|
);
|
|
31684
|
-
output(response2, ({ environment_file }) => console.log(
|
|
31743
|
+
output(response2, ({ environment_file }) => console.log(import_chalk20.default.green(`
|
|
31685
31744
|
Updated file ${environment_file.path}.
|
|
31686
31745
|
`)));
|
|
31687
31746
|
return;
|
|
@@ -31696,7 +31755,7 @@ Updated file ${environment_file.path}.
|
|
|
31696
31755
|
`/v1/environments/${id}/files`,
|
|
31697
31756
|
{ method: "POST", body }
|
|
31698
31757
|
);
|
|
31699
|
-
output(response, ({ environment_file }) => console.log(
|
|
31758
|
+
output(response, ({ environment_file }) => console.log(import_chalk20.default.green(`
|
|
31700
31759
|
Created file ${environment_file.path}.
|
|
31701
31760
|
`)));
|
|
31702
31761
|
}
|
|
@@ -31726,16 +31785,16 @@ async function envHookGetCommand(envIdOrName, kind) {
|
|
|
31726
31785
|
const hook = kind === "warm" ? (await orgAuthenticatedFetch(`/v1/environments/${id}/warm-hooks`)).warm_hook : (await orgAuthenticatedFetch(`/v1/environments/${id}/start-hooks`)).start_hook;
|
|
31727
31786
|
output({ hook }, () => {
|
|
31728
31787
|
if (!hook) {
|
|
31729
|
-
console.log(
|
|
31788
|
+
console.log(import_chalk20.default.yellow(`
|
|
31730
31789
|
No ${kind} hook configured.
|
|
31731
31790
|
`));
|
|
31732
31791
|
return;
|
|
31733
31792
|
}
|
|
31734
|
-
console.log(
|
|
31793
|
+
console.log(import_chalk20.default.green(`
|
|
31735
31794
|
${kind === "warm" ? "Warm" : "Start"} hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
31736
31795
|
`));
|
|
31737
|
-
console.log(
|
|
31738
|
-
console.log(
|
|
31796
|
+
console.log(import_chalk20.default.gray(` ID: ${hook.id}`));
|
|
31797
|
+
console.log(import_chalk20.default.gray(` Created: ${formatDate(hook.created_at)}
|
|
31739
31798
|
`));
|
|
31740
31799
|
console.log(hook.content);
|
|
31741
31800
|
console.log();
|
|
@@ -31751,7 +31810,7 @@ async function envHookSaveCommand(envIdOrName, options, kind) {
|
|
|
31751
31810
|
`/v1/environments/${id}/warm-hooks/save`,
|
|
31752
31811
|
{ method: "POST", body: body2 }
|
|
31753
31812
|
);
|
|
31754
|
-
output(response2, ({ warm_hook }) => console.log(
|
|
31813
|
+
output(response2, ({ warm_hook }) => console.log(import_chalk20.default.green(warm_hook ? `
|
|
31755
31814
|
Saved warm hook v${warm_hook.version}.
|
|
31756
31815
|
` : "\nCleared warm hook.\n")));
|
|
31757
31816
|
return;
|
|
@@ -31761,7 +31820,7 @@ Saved warm hook v${warm_hook.version}.
|
|
|
31761
31820
|
`/v1/environments/${id}/start-hooks/save`,
|
|
31762
31821
|
{ method: "POST", body }
|
|
31763
31822
|
);
|
|
31764
|
-
output(response, ({ start_hook }) => console.log(
|
|
31823
|
+
output(response, ({ start_hook }) => console.log(import_chalk20.default.green(start_hook ? `
|
|
31765
31824
|
Saved start hook v${start_hook.version}.
|
|
31766
31825
|
` : "\nCleared start hook.\n")));
|
|
31767
31826
|
}
|
|
@@ -31779,7 +31838,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
31779
31838
|
body: kind === "warm" ? { content, mode: options.save ? "save_test" : "test_only" } : { content },
|
|
31780
31839
|
onEvent: (event) => {
|
|
31781
31840
|
if (event.type === "progress" && event.message) {
|
|
31782
|
-
console.log(
|
|
31841
|
+
console.log(import_chalk20.default.gray(event.message));
|
|
31783
31842
|
} else if (event.type === "output" && event.output) {
|
|
31784
31843
|
logs += event.output;
|
|
31785
31844
|
if (!isJsonMode()) process.stdout.write(event.output);
|
|
@@ -31796,7 +31855,7 @@ async function envHookTestCommand(envIdOrName, options, kind) {
|
|
|
31796
31855
|
const label = kind === "warm" ? "Warm" : "Start";
|
|
31797
31856
|
const passed = !timedOut && exitCode === 0;
|
|
31798
31857
|
output({ passed, exit_code: exitCode, timed_out: timedOut, saved: passed && !!options.save, output: logs }, () => {
|
|
31799
|
-
if (passed) console.log(
|
|
31858
|
+
if (passed) console.log(import_chalk20.default.green(`
|
|
31800
31859
|
${label} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
|
|
31801
31860
|
`));
|
|
31802
31861
|
});
|
|
@@ -31813,24 +31872,24 @@ async function envHookRepositoryHooksCommand(envIdOrName, kind) {
|
|
|
31813
31872
|
)).repositories.map((repository) => ({ ...repository, hook: repository.start_hook }));
|
|
31814
31873
|
output({ repositories }, () => {
|
|
31815
31874
|
if (repositories.length === 0) {
|
|
31816
|
-
console.log(
|
|
31875
|
+
console.log(import_chalk20.default.yellow("\nNo repositories bound to this environment.\n"));
|
|
31817
31876
|
return;
|
|
31818
31877
|
}
|
|
31819
|
-
console.log(
|
|
31878
|
+
console.log(import_chalk20.default.green(`
|
|
31820
31879
|
Repository ${kind} hooks (${repositories.length}):
|
|
31821
31880
|
`));
|
|
31822
31881
|
for (const repo of repositories) {
|
|
31823
|
-
console.log(
|
|
31882
|
+
console.log(import_chalk20.default.white(` ${repo.repository_name} @${repo.default_branch}`));
|
|
31824
31883
|
if (repo.error) {
|
|
31825
|
-
console.log(
|
|
31884
|
+
console.log(import_chalk20.default.red(` Error: ${repo.error}`));
|
|
31826
31885
|
} else if (repo.hook) {
|
|
31827
|
-
console.log(
|
|
31828
|
-
console.log(
|
|
31886
|
+
console.log(import_chalk20.default.gray(` Source: ${repo.filename ?? "(unknown)"}`));
|
|
31887
|
+
console.log(import_chalk20.default.gray(` Commands (${repo.hook.commands.length}):`));
|
|
31829
31888
|
for (const cmd of repo.hook.commands) {
|
|
31830
|
-
console.log(
|
|
31889
|
+
console.log(import_chalk20.default.gray(` ${cmd}`));
|
|
31831
31890
|
}
|
|
31832
31891
|
} else {
|
|
31833
|
-
console.log(
|
|
31892
|
+
console.log(import_chalk20.default.gray(` No ${kind}Hook defined.`));
|
|
31834
31893
|
}
|
|
31835
31894
|
console.log();
|
|
31836
31895
|
}
|
|
@@ -31872,7 +31931,7 @@ async function envSkillsAddCommand(env, source, slug, options) {
|
|
|
31872
31931
|
const id = await resolveEnvironmentId(env);
|
|
31873
31932
|
const body = { environment_id: id, source, slug, name: options.name ?? slug };
|
|
31874
31933
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/skills`, { method: "POST", body });
|
|
31875
|
-
output(response, () => console.log(
|
|
31934
|
+
output(response, () => console.log(import_chalk20.default.green(`Added skill ${slug} from ${source}`)));
|
|
31876
31935
|
}
|
|
31877
31936
|
async function envSkillsRemoveCommand(env, slugOrId) {
|
|
31878
31937
|
const id = await resolveEnvironmentId(env);
|
|
@@ -31900,7 +31959,7 @@ async function envMcpsAddCommand(env, name, options) {
|
|
|
31900
31959
|
const id = await resolveEnvironmentId(env);
|
|
31901
31960
|
const body = { environment_id: id, name, ...server };
|
|
31902
31961
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/mcps`, { method: "POST", body });
|
|
31903
|
-
output(response, () => console.log(
|
|
31962
|
+
output(response, () => console.log(import_chalk20.default.green(`Added MCP server ${name}`)));
|
|
31904
31963
|
}
|
|
31905
31964
|
async function envMcpsRemoveCommand(env, nameOrId) {
|
|
31906
31965
|
const id = await resolveEnvironmentId(env);
|
|
@@ -31915,7 +31974,7 @@ function envWarmPoolCommand(enabled) {
|
|
|
31915
31974
|
const id = await resolveEnvironmentId(env);
|
|
31916
31975
|
const body = { environment_id: id, enabled };
|
|
31917
31976
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/warm-pools`, { method: "PUT", body });
|
|
31918
|
-
output(response, () => console.log(
|
|
31977
|
+
output(response, () => console.log(import_chalk20.default.green(`Warm pool ${enabled ? "enabled" : "disabled"}`)));
|
|
31919
31978
|
};
|
|
31920
31979
|
}
|
|
31921
31980
|
|
|
@@ -31930,8 +31989,8 @@ function parseReplicaAgent(value) {
|
|
|
31930
31989
|
throw new Error(`Invalid coding agent: ${value}. Must be one of: ${CLI_CODING_AGENT_LABEL}`);
|
|
31931
31990
|
}
|
|
31932
31991
|
function formatStatus(status) {
|
|
31933
|
-
if (status === "active") return
|
|
31934
|
-
if (isWorkspaceSuspendedStatus(status)) return
|
|
31992
|
+
if (status === "active") return import_chalk21.default.green(status);
|
|
31993
|
+
if (isWorkspaceSuspendedStatus(status)) return import_chalk21.default.gray(status);
|
|
31935
31994
|
return status;
|
|
31936
31995
|
}
|
|
31937
31996
|
function truncate(text3, maxLength) {
|
|
@@ -31942,93 +32001,93 @@ function formatDisplayMessage(message2) {
|
|
|
31942
32001
|
const time3 = new Date(message2.timestamp).toLocaleTimeString();
|
|
31943
32002
|
switch (message2.type) {
|
|
31944
32003
|
case "user":
|
|
31945
|
-
console.log(
|
|
32004
|
+
console.log(import_chalk21.default.blue(`
|
|
31946
32005
|
[${time3}] USER:`));
|
|
31947
|
-
console.log(
|
|
32006
|
+
console.log(import_chalk21.default.white(` ${truncate(message2.content, 500)}`));
|
|
31948
32007
|
break;
|
|
31949
32008
|
case "agent":
|
|
31950
|
-
console.log(
|
|
32009
|
+
console.log(import_chalk21.default.green(`
|
|
31951
32010
|
[${time3}] ASSISTANT:`));
|
|
31952
|
-
console.log(
|
|
32011
|
+
console.log(import_chalk21.default.white(` ${truncate(message2.content, 500)}`));
|
|
31953
32012
|
break;
|
|
31954
32013
|
case "reasoning":
|
|
31955
|
-
console.log(
|
|
32014
|
+
console.log(import_chalk21.default.gray(`
|
|
31956
32015
|
[${time3}] THINKING:`));
|
|
31957
|
-
console.log(
|
|
32016
|
+
console.log(import_chalk21.default.gray(` ${truncate(message2.content, 300)}`));
|
|
31958
32017
|
break;
|
|
31959
32018
|
case "command":
|
|
31960
|
-
console.log(
|
|
32019
|
+
console.log(import_chalk21.default.magenta(`
|
|
31961
32020
|
[${time3}] COMMAND:`));
|
|
31962
|
-
console.log(
|
|
32021
|
+
console.log(import_chalk21.default.white(` $ ${message2.command}`));
|
|
31963
32022
|
if (message2.output) {
|
|
31964
|
-
console.log(
|
|
32023
|
+
console.log(import_chalk21.default.gray(` ${truncate(message2.output, 200)}`));
|
|
31965
32024
|
}
|
|
31966
32025
|
if (message2.exitCode !== void 0) {
|
|
31967
|
-
const exitColor = message2.exitCode === 0 ?
|
|
32026
|
+
const exitColor = message2.exitCode === 0 ? import_chalk21.default.green : import_chalk21.default.red;
|
|
31968
32027
|
console.log(exitColor(` Exit code: ${message2.exitCode}`));
|
|
31969
32028
|
}
|
|
31970
32029
|
break;
|
|
31971
32030
|
case "file_change":
|
|
31972
|
-
console.log(
|
|
32031
|
+
console.log(import_chalk21.default.yellow(`
|
|
31973
32032
|
[${time3}] FILE CHANGES:`));
|
|
31974
32033
|
for (const change of message2.changes) {
|
|
31975
32034
|
const icon = change.kind === "add" ? "+" : change.kind === "delete" ? "-" : "~";
|
|
31976
|
-
const color = change.kind === "add" ?
|
|
32035
|
+
const color = change.kind === "add" ? import_chalk21.default.green : change.kind === "delete" ? import_chalk21.default.red : import_chalk21.default.yellow;
|
|
31977
32036
|
console.log(color(` ${icon} ${change.path}`));
|
|
31978
32037
|
}
|
|
31979
32038
|
break;
|
|
31980
32039
|
case "patch":
|
|
31981
|
-
console.log(
|
|
32040
|
+
console.log(import_chalk21.default.yellow(`
|
|
31982
32041
|
[${time3}] PATCH:`));
|
|
31983
32042
|
for (const op of message2.operations) {
|
|
31984
32043
|
const icon = op.action === "add" ? "+" : op.action === "delete" ? "-" : "~";
|
|
31985
|
-
const color = op.action === "add" ?
|
|
32044
|
+
const color = op.action === "add" ? import_chalk21.default.green : op.action === "delete" ? import_chalk21.default.red : import_chalk21.default.yellow;
|
|
31986
32045
|
console.log(color(` ${icon} ${op.path}`));
|
|
31987
32046
|
}
|
|
31988
32047
|
break;
|
|
31989
32048
|
case "tool_call":
|
|
31990
|
-
console.log(
|
|
32049
|
+
console.log(import_chalk21.default.cyan(`
|
|
31991
32050
|
[${time3}] TOOL: ${message2.tool}`));
|
|
31992
32051
|
if (message2.output) {
|
|
31993
|
-
console.log(
|
|
32052
|
+
console.log(import_chalk21.default.gray(` ${truncate(message2.output, 200)}`));
|
|
31994
32053
|
}
|
|
31995
32054
|
if (message2.inputRequest?.status === "pending") {
|
|
31996
32055
|
const { requestId, options, questions } = message2.inputRequest;
|
|
31997
|
-
console.log(
|
|
31998
|
-
for (const option of options ?? []) console.log(
|
|
32056
|
+
console.log(import_chalk21.default.yellow(` Awaiting answer, request ID: ${requestId}`));
|
|
32057
|
+
for (const option of options ?? []) console.log(import_chalk21.default.white(` ${option.id}: ${option.label}`));
|
|
31999
32058
|
for (const question of questions ?? []) {
|
|
32000
|
-
console.log(
|
|
32001
|
-
for (const option of question.options) console.log(
|
|
32059
|
+
console.log(import_chalk21.default.white(` Question ${question.id}: ${question.prompt}${question.multiSelect ? " (multi-select)" : ""}`));
|
|
32060
|
+
for (const option of question.options) console.log(import_chalk21.default.gray(` ${option.id}: ${option.label}`));
|
|
32002
32061
|
}
|
|
32003
32062
|
if (questions?.length) {
|
|
32004
|
-
console.log(
|
|
32063
|
+
console.log(import_chalk21.default.gray(` Selection ID: '{"<question>":{"options":["<option>"]}}', '{"<question>":{"custom":"<text>"}}', or declined`));
|
|
32005
32064
|
}
|
|
32006
32065
|
}
|
|
32007
32066
|
break;
|
|
32008
32067
|
case "web_search":
|
|
32009
|
-
console.log(
|
|
32068
|
+
console.log(import_chalk21.default.cyan(`
|
|
32010
32069
|
[${time3}] WEB SEARCH:`));
|
|
32011
|
-
console.log(
|
|
32070
|
+
console.log(import_chalk21.default.white(` "${message2.query}"`));
|
|
32012
32071
|
break;
|
|
32013
32072
|
case "todo_list":
|
|
32014
|
-
console.log(
|
|
32073
|
+
console.log(import_chalk21.default.blue(`
|
|
32015
32074
|
[${time3}] PLAN:`));
|
|
32016
32075
|
for (const item of message2.items) {
|
|
32017
|
-
const icon = item.completed ?
|
|
32076
|
+
const icon = item.completed ? import_chalk21.default.green("[x]") : import_chalk21.default.gray("[ ]");
|
|
32018
32077
|
console.log(` ${icon} ${item.text}`);
|
|
32019
32078
|
}
|
|
32020
32079
|
break;
|
|
32021
32080
|
case "subagent":
|
|
32022
|
-
console.log(
|
|
32081
|
+
console.log(import_chalk21.default.magenta(`
|
|
32023
32082
|
[${time3}] SUBAGENT: ${message2.description}`));
|
|
32024
32083
|
if (message2.output) {
|
|
32025
|
-
console.log(
|
|
32084
|
+
console.log(import_chalk21.default.gray(` ${truncate(message2.output, 200)}`));
|
|
32026
32085
|
}
|
|
32027
32086
|
break;
|
|
32028
32087
|
case "error":
|
|
32029
|
-
console.log(
|
|
32088
|
+
console.log(import_chalk21.default.red(`
|
|
32030
32089
|
[${time3}] ERROR:`));
|
|
32031
|
-
console.log(
|
|
32090
|
+
console.log(import_chalk21.default.red(` ${message2.message}`));
|
|
32032
32091
|
break;
|
|
32033
32092
|
}
|
|
32034
32093
|
}
|
|
@@ -32043,24 +32102,24 @@ async function replicaListCommand(options) {
|
|
|
32043
32102
|
);
|
|
32044
32103
|
output(response, (response2) => {
|
|
32045
32104
|
if (response2.replicas.length === 0) {
|
|
32046
|
-
console.log(
|
|
32105
|
+
console.log(import_chalk21.default.yellow("\nNo replicas found.\n"));
|
|
32047
32106
|
return;
|
|
32048
32107
|
}
|
|
32049
|
-
console.log(
|
|
32108
|
+
console.log(import_chalk21.default.green(`
|
|
32050
32109
|
Replicas (Page ${response2.page} of ${response2.total_pages}, Total: ${response2.total}):
|
|
32051
32110
|
`));
|
|
32052
32111
|
for (const replica of response2.replicas) {
|
|
32053
|
-
console.log(
|
|
32054
|
-
console.log(
|
|
32112
|
+
console.log(import_chalk21.default.white(` ${replica.name}`));
|
|
32113
|
+
console.log(import_chalk21.default.gray(` ID: ${replica.id}`));
|
|
32055
32114
|
if (replica.repositories.length > 0) {
|
|
32056
|
-
console.log(
|
|
32115
|
+
console.log(import_chalk21.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
32057
32116
|
}
|
|
32058
|
-
console.log(
|
|
32059
|
-
console.log(
|
|
32117
|
+
console.log(import_chalk21.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
32118
|
+
console.log(import_chalk21.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
32060
32119
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
32061
|
-
console.log(
|
|
32120
|
+
console.log(import_chalk21.default.gray(` Pull Requests:`));
|
|
32062
32121
|
for (const pr2 of replica.pull_requests) {
|
|
32063
|
-
console.log(
|
|
32122
|
+
console.log(import_chalk21.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
32064
32123
|
}
|
|
32065
32124
|
}
|
|
32066
32125
|
console.log();
|
|
@@ -32071,29 +32130,29 @@ async function replicaGetCommand(id) {
|
|
|
32071
32130
|
ensureOrgApiAuthenticated();
|
|
32072
32131
|
const response = await orgAuthenticatedFetch(`/v1/replica/${id}`);
|
|
32073
32132
|
output(response, ({ replica }) => {
|
|
32074
|
-
console.log(
|
|
32133
|
+
console.log(import_chalk21.default.green(`
|
|
32075
32134
|
Replica: ${replica.name}
|
|
32076
32135
|
`));
|
|
32077
|
-
console.log(
|
|
32136
|
+
console.log(import_chalk21.default.gray(` ID: ${replica.id}`));
|
|
32078
32137
|
if (replica.repositories.length > 0) {
|
|
32079
|
-
console.log(
|
|
32138
|
+
console.log(import_chalk21.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
32080
32139
|
}
|
|
32081
|
-
console.log(
|
|
32082
|
-
console.log(
|
|
32140
|
+
console.log(import_chalk21.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
32141
|
+
console.log(import_chalk21.default.gray(` Created: ${formatDate(replica.created_at)}`));
|
|
32083
32142
|
if (replica.coding_agent) {
|
|
32084
|
-
console.log(
|
|
32143
|
+
console.log(import_chalk21.default.gray(` Coding Agent: ${replica.coding_agent}`));
|
|
32085
32144
|
}
|
|
32086
32145
|
if (replica.repository_statuses && replica.repository_statuses.length > 0) {
|
|
32087
|
-
console.log(
|
|
32146
|
+
console.log(import_chalk21.default.gray(" Repository Statuses:"));
|
|
32088
32147
|
for (const repositoryStatus of replica.repository_statuses) {
|
|
32089
|
-
const changeText = repositoryStatus.git_diff ? ` (${
|
|
32090
|
-
console.log(
|
|
32148
|
+
const changeText = repositoryStatus.git_diff ? ` (${import_chalk21.default.green(`+${repositoryStatus.git_diff.added}`)} / ${import_chalk21.default.red(`-${repositoryStatus.git_diff.removed}`)})` : "";
|
|
32149
|
+
console.log(import_chalk21.default.gray(` - ${repositoryStatus.repository}: ${repositoryStatus.branch || "unknown"}${changeText}`));
|
|
32091
32150
|
}
|
|
32092
32151
|
}
|
|
32093
32152
|
if (replica.pull_requests && replica.pull_requests.length > 0) {
|
|
32094
|
-
console.log(
|
|
32153
|
+
console.log(import_chalk21.default.gray(` Pull Requests:`));
|
|
32095
32154
|
for (const pr2 of replica.pull_requests) {
|
|
32096
|
-
console.log(
|
|
32155
|
+
console.log(import_chalk21.default.cyan(` - ${pr2.repository} #${pr2.number}: ${pr2.url}`));
|
|
32097
32156
|
}
|
|
32098
32157
|
}
|
|
32099
32158
|
console.log();
|
|
@@ -32127,7 +32186,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
32127
32186
|
});
|
|
32128
32187
|
const answer = response2.name;
|
|
32129
32188
|
if (!answer) {
|
|
32130
|
-
console.log(
|
|
32189
|
+
console.log(import_chalk21.default.yellow("\nCancelled."));
|
|
32131
32190
|
return;
|
|
32132
32191
|
}
|
|
32133
32192
|
replicaName = answer;
|
|
@@ -32145,7 +32204,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
32145
32204
|
});
|
|
32146
32205
|
const answer = response2.environment;
|
|
32147
32206
|
if (!answer) {
|
|
32148
|
-
console.log(
|
|
32207
|
+
console.log(import_chalk21.default.yellow("\nCancelled."));
|
|
32149
32208
|
return;
|
|
32150
32209
|
}
|
|
32151
32210
|
selectedEnvironmentId = answer;
|
|
@@ -32159,7 +32218,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
32159
32218
|
});
|
|
32160
32219
|
const answer = response2.message;
|
|
32161
32220
|
if (!answer) {
|
|
32162
|
-
console.log(
|
|
32221
|
+
console.log(import_chalk21.default.yellow("\nCancelled."));
|
|
32163
32222
|
return;
|
|
32164
32223
|
}
|
|
32165
32224
|
message2 = answer;
|
|
@@ -32173,7 +32232,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
32173
32232
|
initial: 0
|
|
32174
32233
|
});
|
|
32175
32234
|
if (!response2.agent) {
|
|
32176
|
-
console.log(
|
|
32235
|
+
console.log(import_chalk21.default.yellow("\nCancelled."));
|
|
32177
32236
|
return;
|
|
32178
32237
|
}
|
|
32179
32238
|
codingAgent = parseReplicaAgent(response2.agent);
|
|
@@ -32185,18 +32244,18 @@ async function replicaCreateCommand(name, options) {
|
|
|
32185
32244
|
coding_agent: codingAgent,
|
|
32186
32245
|
lifecycle_policy: "default"
|
|
32187
32246
|
};
|
|
32188
|
-
console.log(
|
|
32247
|
+
console.log(import_chalk21.default.gray("\nCreating replica..."));
|
|
32189
32248
|
const response = await orgAuthenticatedFetch("/v1/replica", {
|
|
32190
32249
|
method: "POST",
|
|
32191
32250
|
body
|
|
32192
32251
|
});
|
|
32193
32252
|
output(response, ({ replica }) => {
|
|
32194
|
-
console.log(
|
|
32253
|
+
console.log(import_chalk21.default.green(`
|
|
32195
32254
|
Created replica: ${replica.name}`));
|
|
32196
|
-
console.log(
|
|
32197
|
-
console.log(
|
|
32255
|
+
console.log(import_chalk21.default.gray(` ID: ${replica.id}`));
|
|
32256
|
+
console.log(import_chalk21.default.gray(` Status: ${formatStatus(replica.status)}`));
|
|
32198
32257
|
if (replica.repositories.length > 0) {
|
|
32199
|
-
console.log(
|
|
32258
|
+
console.log(import_chalk21.default.gray(` Repositories: ${replica.repositories.map((repository) => repository.name).join(", ")}`));
|
|
32200
32259
|
}
|
|
32201
32260
|
console.log();
|
|
32202
32261
|
});
|
|
@@ -32213,7 +32272,7 @@ async function replicaSendCommand(id, options) {
|
|
|
32213
32272
|
});
|
|
32214
32273
|
const answer = response2.message;
|
|
32215
32274
|
if (!answer) {
|
|
32216
|
-
console.log(
|
|
32275
|
+
console.log(import_chalk21.default.yellow("\nCancelled."));
|
|
32217
32276
|
return;
|
|
32218
32277
|
}
|
|
32219
32278
|
message2 = answer;
|
|
@@ -32238,14 +32297,14 @@ async function replicaSendCommand(id, options) {
|
|
|
32238
32297
|
}
|
|
32239
32298
|
);
|
|
32240
32299
|
output(response, (response2) => {
|
|
32241
|
-
const statusColor = response2.status === "sent" ?
|
|
32300
|
+
const statusColor = response2.status === "sent" ? import_chalk21.default.green : import_chalk21.default.yellow;
|
|
32242
32301
|
console.log(statusColor(`
|
|
32243
32302
|
Message ${response2.status}`));
|
|
32244
32303
|
if (response2.chat_id) {
|
|
32245
|
-
console.log(
|
|
32304
|
+
console.log(import_chalk21.default.gray(` Chat: ${response2.chat_id}`));
|
|
32246
32305
|
}
|
|
32247
32306
|
if (response2.position !== void 0 && response2.position > 0) {
|
|
32248
|
-
console.log(
|
|
32307
|
+
console.log(import_chalk21.default.gray(` Queue position: ${response2.position}`));
|
|
32249
32308
|
}
|
|
32250
32309
|
console.log();
|
|
32251
32310
|
});
|
|
@@ -32272,151 +32331,36 @@ async function replicaReadCommand(id, options) {
|
|
|
32272
32331
|
`/v1/replica/${id}/history${query ? "?" + query : ""}`
|
|
32273
32332
|
);
|
|
32274
32333
|
output(response, (response2) => {
|
|
32275
|
-
console.log(
|
|
32334
|
+
console.log(import_chalk21.default.green(`
|
|
32276
32335
|
Conversation History
|
|
32277
32336
|
`));
|
|
32278
32337
|
if (response2.coding_agent) {
|
|
32279
|
-
console.log(
|
|
32338
|
+
console.log(import_chalk21.default.gray(` Agent: ${response2.coding_agent}`));
|
|
32280
32339
|
}
|
|
32281
32340
|
if (response2.thread_id) {
|
|
32282
|
-
console.log(
|
|
32341
|
+
console.log(import_chalk21.default.gray(` Thread ID: ${response2.thread_id}`));
|
|
32283
32342
|
}
|
|
32284
|
-
console.log(
|
|
32343
|
+
console.log(import_chalk21.default.gray(` Total Events: ${response2.total}`));
|
|
32285
32344
|
if (response2.has_more) {
|
|
32286
32345
|
const previousPage = response2.beforeCursor ? `--before '${response2.beforeCursor}'` : `--before-event ${response2.eventsStartIndex}`;
|
|
32287
|
-
console.log(
|
|
32346
|
+
console.log(import_chalk21.default.gray(` Has More: yes (${previousPage} for the previous page)`));
|
|
32288
32347
|
}
|
|
32289
32348
|
console.log();
|
|
32290
32349
|
if (response2.events.length === 0) {
|
|
32291
|
-
console.log(
|
|
32350
|
+
console.log(import_chalk21.default.yellow(" No events found.\n"));
|
|
32292
32351
|
return;
|
|
32293
32352
|
}
|
|
32294
|
-
console.log(
|
|
32353
|
+
console.log(import_chalk21.default.gray("-".repeat(60)));
|
|
32295
32354
|
const agentType = response2.coding_agent || "claude";
|
|
32296
32355
|
const displayMessages = parseDisplayMessages(response2.events, agentType);
|
|
32297
32356
|
for (const message2 of displayMessages) {
|
|
32298
32357
|
formatDisplayMessage(message2);
|
|
32299
32358
|
}
|
|
32300
|
-
console.log(
|
|
32359
|
+
console.log(import_chalk21.default.gray("\n" + "-".repeat(60)));
|
|
32301
32360
|
console.log();
|
|
32302
32361
|
});
|
|
32303
32362
|
}
|
|
32304
32363
|
|
|
32305
|
-
// src/commands/repositories.ts
|
|
32306
|
-
var import_chalk21 = __toESM(require("chalk"));
|
|
32307
|
-
async function repositoriesListCommand() {
|
|
32308
|
-
ensureOrgApiAuthenticated();
|
|
32309
|
-
output(await orgAuthenticatedFetch("/v1/repositories"), ({ repositories }) => {
|
|
32310
|
-
if (repositories.length === 0) {
|
|
32311
|
-
console.log(import_chalk21.default.yellow("\nNo repositories found.\n"));
|
|
32312
|
-
return;
|
|
32313
|
-
}
|
|
32314
|
-
console.log(import_chalk21.default.green(`
|
|
32315
|
-
Repositories (${repositories.length}):
|
|
32316
|
-
`));
|
|
32317
|
-
for (const repo of repositories) {
|
|
32318
|
-
console.log(import_chalk21.default.white(` ${repo.name}`));
|
|
32319
|
-
console.log(import_chalk21.default.gray(` ID: ${repo.id}`));
|
|
32320
|
-
console.log(import_chalk21.default.gray(` URL: ${repo.url}`));
|
|
32321
|
-
console.log(import_chalk21.default.gray(` Default Branch: ${repo.default_branch}`));
|
|
32322
|
-
console.log(import_chalk21.default.gray(` Created: ${formatDate(repo.created_at)}`));
|
|
32323
|
-
if (repo.github_repository_id) {
|
|
32324
|
-
console.log(import_chalk21.default.gray(` GitHub ID: ${repo.github_repository_id}`));
|
|
32325
|
-
}
|
|
32326
|
-
console.log();
|
|
32327
|
-
}
|
|
32328
|
-
});
|
|
32329
|
-
}
|
|
32330
|
-
async function resolveRepositoryIds(inputs) {
|
|
32331
|
-
const { repositories } = await orgAuthenticatedFetch("/v1/repositories");
|
|
32332
|
-
return inputs.map((input) => {
|
|
32333
|
-
const repository = resolveByNameOrId(input, repositories);
|
|
32334
|
-
if (!repository) throw new Error(`Repository not found: ${input}`);
|
|
32335
|
-
return repository.id;
|
|
32336
|
-
});
|
|
32337
|
-
}
|
|
32338
|
-
var splitList = (value) => value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
32339
|
-
async function repositoriesAvailableCommand() {
|
|
32340
|
-
output(await orgAuthenticatedFetch("/v1/github/repositories"), ({ repositories, hasInstallations, installUrl }) => {
|
|
32341
|
-
if (!hasInstallations) {
|
|
32342
|
-
console.log(`The GitHub app is not installed. Install it: ${installUrl}`);
|
|
32343
|
-
return;
|
|
32344
|
-
}
|
|
32345
|
-
for (const repository of repositories) console.log(`${repository.fullName} ${repository.defaultBranch ?? ""}`);
|
|
32346
|
-
});
|
|
32347
|
-
}
|
|
32348
|
-
async function repositoriesAddCommand(fullName, options) {
|
|
32349
|
-
const { repositories } = await orgAuthenticatedFetch("/v1/github/repositories");
|
|
32350
|
-
const repository = repositories.find((item) => item.fullName.toLowerCase() === fullName.toLowerCase());
|
|
32351
|
-
if (!repository) throw new Error(`${fullName} is not reachable by the GitHub app. List options with: replicas repos available`);
|
|
32352
|
-
const body = {
|
|
32353
|
-
provider: "github",
|
|
32354
|
-
name: repository.name,
|
|
32355
|
-
url: repository.cloneUrl,
|
|
32356
|
-
default_branch: options.defaultBranch ?? repository.defaultBranch,
|
|
32357
|
-
github_installation_id: repository.installationId,
|
|
32358
|
-
github_repository_id: repository.id
|
|
32359
|
-
};
|
|
32360
|
-
await orgAuthenticatedFetch("/v1/repositories", { method: "POST", body });
|
|
32361
|
-
outputSuccess(`Added ${repository.fullName}`);
|
|
32362
|
-
}
|
|
32363
|
-
async function repositoriesUpdateCommand(repository, options) {
|
|
32364
|
-
const [id] = await resolveRepositoryIds([repository]);
|
|
32365
|
-
const body = { default_branch: options.defaultBranch };
|
|
32366
|
-
await orgAuthenticatedFetch(`/v1/repositories/${id}`, { method: "PATCH", body });
|
|
32367
|
-
outputSuccess(`Default branch set to ${options.defaultBranch}`);
|
|
32368
|
-
}
|
|
32369
|
-
async function repositoriesDeleteCommand(repository) {
|
|
32370
|
-
const [id] = await resolveRepositoryIds([repository]);
|
|
32371
|
-
await orgAuthenticatedFetch(`/v1/repositories/${id}`, { method: "DELETE" });
|
|
32372
|
-
outputSuccess(`Removed repository ${repository}`);
|
|
32373
|
-
}
|
|
32374
|
-
async function repositoriesBranchesCommand(repository) {
|
|
32375
|
-
const [id] = await resolveRepositoryIds([repository]);
|
|
32376
|
-
output(await orgAuthenticatedFetch(`/v1/repositories/${id}/branches`), ({ branches }) => {
|
|
32377
|
-
for (const branch of branches) console.log(branch);
|
|
32378
|
-
});
|
|
32379
|
-
}
|
|
32380
|
-
function printRepositorySet(set2) {
|
|
32381
|
-
console.log(`${set2.id} ${set2.name} ${set2.repositories.map((repository) => repository.name).join(", ")}`);
|
|
32382
|
-
}
|
|
32383
|
-
async function resolveRepositorySetId(input) {
|
|
32384
|
-
const { repository_sets } = await orgAuthenticatedFetch("/v1/repository-sets");
|
|
32385
|
-
const set2 = resolveByNameOrId(input, repository_sets);
|
|
32386
|
-
if (!set2) throw new Error(`Repository set not found: ${input}`);
|
|
32387
|
-
return set2.id;
|
|
32388
|
-
}
|
|
32389
|
-
async function repositorySetsListCommand() {
|
|
32390
|
-
output(await orgAuthenticatedFetch("/v1/repository-sets"), ({ repository_sets }) => {
|
|
32391
|
-
if (repository_sets.length === 0) console.log("No repository sets.");
|
|
32392
|
-
repository_sets.forEach(printRepositorySet);
|
|
32393
|
-
});
|
|
32394
|
-
}
|
|
32395
|
-
async function repositorySetsCreateCommand(name, options) {
|
|
32396
|
-
const body = {
|
|
32397
|
-
name,
|
|
32398
|
-
description: options.description,
|
|
32399
|
-
repository_ids: await resolveRepositoryIds(splitList(options.repos))
|
|
32400
|
-
};
|
|
32401
|
-
output(await orgAuthenticatedFetch("/v1/repository-sets", { method: "POST", body }), ({ repository_set }) => printRepositorySet(repository_set));
|
|
32402
|
-
}
|
|
32403
|
-
async function repositorySetsUpdateCommand(set2, options) {
|
|
32404
|
-
const body = {
|
|
32405
|
-
name: options.name,
|
|
32406
|
-
description: options.description,
|
|
32407
|
-
repository_ids: options.repos === void 0 ? void 0 : await resolveRepositoryIds(splitList(options.repos))
|
|
32408
|
-
};
|
|
32409
|
-
const response = await orgAuthenticatedFetch(
|
|
32410
|
-
`/v1/repository-sets/${await resolveRepositorySetId(set2)}`,
|
|
32411
|
-
{ method: "PATCH", body }
|
|
32412
|
-
);
|
|
32413
|
-
output(response, ({ repository_set }) => printRepositorySet(repository_set));
|
|
32414
|
-
}
|
|
32415
|
-
async function repositorySetsDeleteCommand(set2) {
|
|
32416
|
-
await orgAuthenticatedFetch(`/v1/repository-sets/${await resolveRepositorySetId(set2)}`, { method: "DELETE" });
|
|
32417
|
-
outputSuccess(`Deleted repository set ${set2}`);
|
|
32418
|
-
}
|
|
32419
|
-
|
|
32420
32364
|
// src/commands/workspace.ts
|
|
32421
32365
|
var import_fs5 = __toESM(require("fs"));
|
|
32422
32366
|
var import_chalk22 = __toESM(require("chalk"));
|
|
@@ -34593,11 +34537,6 @@ repos.command("update <name-or-id>").description("Change the default branch of a
|
|
|
34593
34537
|
repos.command("delete <name-or-id>").description("Remove a repository (admins only)").action(run(repositoriesDeleteCommand));
|
|
34594
34538
|
repos.command("branches <name-or-id>").description("List branches of a repository").action(run(repositoriesBranchesCommand));
|
|
34595
34539
|
repos.action(run(repositoriesListCommand));
|
|
34596
|
-
var repoSets = program.command("repo-sets").description("Manage repository sets");
|
|
34597
|
-
repoSets.command("list").description("List repository sets").action(run(repositorySetsListCommand));
|
|
34598
|
-
repoSets.command("create <name>").description("Create a repository set (admins only)").requiredOption("-r, --repos <names>", "Comma-separated repository names or IDs").option("-d, --description <description>", "Description").action(run(repositorySetsCreateCommand));
|
|
34599
|
-
repoSets.command("update <name-or-id>").description("Update a repository set (admins only)").option("-n, --name <name>", "New name").option("-d, --description <description>", "New description").option("-r, --repos <names>", "Replace the repositories (comma-separated names or IDs)").action(run(repositorySetsUpdateCommand));
|
|
34600
|
-
repoSets.command("delete <name-or-id>").description("Delete a repository set (admins only)").action(run(repositorySetsDeleteCommand));
|
|
34601
34540
|
var plugins = program.command("plugins").description("Connect plugins (organization-wide, or to one environment with --env)");
|
|
34602
34541
|
plugins.command("list").description("List connected plugins").option("-e, --env <env>", "Environment name or ID").option("-a, --all", "Include plugins that are not connected").action(run(pluginsListCommand));
|
|
34603
34542
|
plugins.command("oauth <pluginId>").description("Start an OAuth connection and print the URL to open").option("-e, --env <env>", "Environment name or ID").action(run(pluginsOAuthCommand));
|
|
@@ -34614,8 +34553,8 @@ media.command("url <mediaId>").description("Print a short-lived download URL for
|
|
|
34614
34553
|
var environment = program.command("environment").alias("env").description("Manage environments (org-scoped templates that back workspaces)");
|
|
34615
34554
|
environment.command("list").description("List all environments").action(run(environmentListCommand));
|
|
34616
34555
|
environment.command("get <id-or-name>").description('Get an environment by ID or name (use "global" for the global env)').action(run(environmentGetCommand));
|
|
34617
|
-
environment.command("create [name]").description("Create a new environment").option("-d, --description <description>", "Environment description").option("-r, --repository <
|
|
34618
|
-
environment.command("edit <id-or-name>").description("Edit an environment").option("-n, --name <name>", "New name").option("-d, --description <description>", "New description").option("-r, --repository <
|
|
34556
|
+
environment.command("create [name]").description("Create a new environment").option("-d, --description <description>", "Environment description").option("-r, --repository <names>", "Repositories to clone (comma-separated names or IDs)").option("--system-prompt <prompt>", "System prompt for agents started in this environment").action(run(environmentCreateCommand));
|
|
34557
|
+
environment.command("edit <id-or-name>").description("Edit an environment").option("-n, --name <name>", "New name").option("-d, --description <description>", "New description").option("-r, --repository <names>", "Replace the repositories (comma-separated names or IDs; empty string for none)").option("--system-prompt <prompt>", "System prompt").action(run(environmentEditCommand));
|
|
34619
34558
|
environment.command("delete <id-or-name>").description("Delete an environment").option("-f, --force", "Skip confirmation prompt").action(run(environmentDeleteCommand));
|
|
34620
34559
|
var envVars = environment.command("vars").description("Manage environment variables");
|
|
34621
34560
|
envVars.command("list <env>").description("List variables in an environment (values masked by default)").option("--reveal", "Show full variable values instead of masking them").action(run(envVarsListCommand));
|
|
@@ -34740,7 +34679,6 @@ if (isAgentMode()) {
|
|
|
34740
34679
|
"share",
|
|
34741
34680
|
"pr",
|
|
34742
34681
|
"canvas",
|
|
34743
|
-
"repo-sets",
|
|
34744
34682
|
"plugins"
|
|
34745
34683
|
]);
|
|
34746
34684
|
const kept = program.commands.filter((cmd) => allowed.has(cmd.name()));
|