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