replicas-cli 0.2.536 → 0.2.537
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 +110 -81
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22385,6 +22385,8 @@ var DEFAULT_CODEX_MODEL = GPT_5_6_SOL_MODEL;
|
|
|
22385
22385
|
var DEFAULT_OPENCODE_MODEL = "z-ai/glm-5.2";
|
|
22386
22386
|
var OPENROUTER_MODELS = [
|
|
22387
22387
|
DEFAULT_OPENCODE_MODEL,
|
|
22388
|
+
"deepseek/deepseek-v4-pro",
|
|
22389
|
+
"deepseek/deepseek-v4-flash",
|
|
22388
22390
|
"minimax/minimax-m3",
|
|
22389
22391
|
"xiaomi/mimo-v2.5-pro",
|
|
22390
22392
|
"moonshotai/kimi-k2.6"
|
|
@@ -22479,6 +22481,8 @@ var MODEL_LABELS = {
|
|
|
22479
22481
|
[GPT_5_6_LUNA_MODEL]: "GPT-5.6 Luna",
|
|
22480
22482
|
"gpt-5.5": "GPT-5.5",
|
|
22481
22483
|
[DEFAULT_OPENCODE_MODEL]: "GLM 5.2 via OpenRouter",
|
|
22484
|
+
"deepseek/deepseek-v4-pro": "DeepSeek V4 Pro via OpenRouter",
|
|
22485
|
+
"deepseek/deepseek-v4-flash": "DeepSeek V4 Flash via OpenRouter",
|
|
22482
22486
|
"minimax/minimax-m3": "MiniMax M3 via OpenRouter",
|
|
22483
22487
|
"xiaomi/mimo-v2.5-pro": "MiMo V2.5 Pro via OpenRouter",
|
|
22484
22488
|
"moonshotai/kimi-k2.6": "Kimi K2.6 via OpenRouter",
|
|
@@ -24349,7 +24353,7 @@ var headlessFilesystemAgentResultSchema = external_exports.object({
|
|
|
24349
24353
|
});
|
|
24350
24354
|
|
|
24351
24355
|
// ../shared/src/cli-version.ts
|
|
24352
|
-
var CLI_VERSION = "0.2.
|
|
24356
|
+
var CLI_VERSION = "0.2.537";
|
|
24353
24357
|
|
|
24354
24358
|
// ../shared/src/version.ts
|
|
24355
24359
|
function compareVersions(v1, v2) {
|
|
@@ -25429,11 +25433,14 @@ function parseDeepseekEvents(events) {
|
|
|
25429
25433
|
continue;
|
|
25430
25434
|
}
|
|
25431
25435
|
if (event.type === "tool/result") {
|
|
25432
|
-
const
|
|
25433
|
-
const
|
|
25436
|
+
const message = isRecord(data.message) ? data.message : {};
|
|
25437
|
+
const messageSource = isRecord(message.source) ? message.source : {};
|
|
25438
|
+
const result = Array.isArray(message.content) && isRecord(message.content[0]) ? message.content[0] : {};
|
|
25439
|
+
const callId = typeof messageSource.callId === "string" ? messageSource.callId : typeof data.callId === "string" ? data.callId : String(seq);
|
|
25440
|
+
const existing = messages.find((message2) => message2.id === `deepseek-tool-${callId}` && message2.type === "tool_call");
|
|
25434
25441
|
if (existing?.type === "tool_call") {
|
|
25435
|
-
existing.output = stringifyDisplayValue(
|
|
25436
|
-
existing.status = data.isError === true ? "failed" : "completed";
|
|
25442
|
+
existing.output = stringifyDisplayValue(result.content ?? data.result);
|
|
25443
|
+
existing.status = result.isError === true || data.isError === true ? "failed" : "completed";
|
|
25437
25444
|
}
|
|
25438
25445
|
continue;
|
|
25439
25446
|
}
|
|
@@ -30572,19 +30579,18 @@ async function envFilesDeleteCommand(envIdOrName, pathOrId, options) {
|
|
|
30572
30579
|
Deleted file ${pathOrId}.
|
|
30573
30580
|
`));
|
|
30574
30581
|
}
|
|
30575
|
-
async function
|
|
30582
|
+
async function envHookGetCommand(envIdOrName, kind) {
|
|
30576
30583
|
ensureOrgApiAuthenticated();
|
|
30577
30584
|
const id = await resolveEnvironmentId(envIdOrName);
|
|
30578
|
-
const
|
|
30579
|
-
|
|
30580
|
-
|
|
30581
|
-
|
|
30582
|
-
|
|
30585
|
+
const hook = kind === "warm" ? (await orgAuthenticatedFetch(`/v1/environments/${id}/warm-hooks`)).warm_hook : (await orgAuthenticatedFetch(`/v1/environments/${id}/start-hooks`)).start_hook;
|
|
30586
|
+
if (!hook) {
|
|
30587
|
+
console.log(import_chalk21.default.yellow(`
|
|
30588
|
+
No ${kind} hook configured.
|
|
30589
|
+
`));
|
|
30583
30590
|
return;
|
|
30584
30591
|
}
|
|
30585
|
-
const hook = response.start_hook;
|
|
30586
30592
|
console.log(import_chalk21.default.green(`
|
|
30587
|
-
Start hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
30593
|
+
${kind === "warm" ? "Warm" : "Start"} hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
30588
30594
|
`));
|
|
30589
30595
|
console.log(import_chalk21.default.gray(` ID: ${hook.id}`));
|
|
30590
30596
|
console.log(import_chalk21.default.gray(` Created: ${formatDate2(hook.created_at)}
|
|
@@ -30592,24 +30598,31 @@ Start hook (v${hook.version}, ${hook.is_active ? "active" : "inactive"}):
|
|
|
30592
30598
|
console.log(hook.content);
|
|
30593
30599
|
console.log();
|
|
30594
30600
|
}
|
|
30595
|
-
async function
|
|
30601
|
+
async function envHookSaveCommand(envIdOrName, options, kind) {
|
|
30596
30602
|
ensureOrgApiAuthenticated();
|
|
30597
30603
|
const id = await resolveEnvironmentId(envIdOrName);
|
|
30598
30604
|
const content = readFileContent(options);
|
|
30605
|
+
if (kind === "warm") {
|
|
30606
|
+
const body2 = { environment_id: id, content };
|
|
30607
|
+
const response2 = await orgAuthenticatedFetch(
|
|
30608
|
+
`/v1/environments/${id}/warm-hooks/save`,
|
|
30609
|
+
{ method: "POST", body: body2 }
|
|
30610
|
+
);
|
|
30611
|
+
console.log(import_chalk21.default.green(`
|
|
30612
|
+
Saved warm hook v${response2.warm_hook.version}.
|
|
30613
|
+
`));
|
|
30614
|
+
return;
|
|
30615
|
+
}
|
|
30599
30616
|
const body = { content };
|
|
30600
30617
|
const response = await orgAuthenticatedFetch(
|
|
30601
30618
|
`/v1/environments/${id}/start-hooks/save`,
|
|
30602
30619
|
{ method: "POST", body }
|
|
30603
30620
|
);
|
|
30604
|
-
|
|
30605
|
-
console.log(import_chalk21.default.green("\nCleared start hook.\n"));
|
|
30606
|
-
return;
|
|
30607
|
-
}
|
|
30608
|
-
console.log(import_chalk21.default.green(`
|
|
30621
|
+
console.log(import_chalk21.default.green(response.start_hook ? `
|
|
30609
30622
|
Saved start hook v${response.start_hook.version}.
|
|
30610
|
-
`));
|
|
30623
|
+
` : "\nCleared start hook.\n"));
|
|
30611
30624
|
}
|
|
30612
|
-
async function
|
|
30625
|
+
async function envHookTestCommand(envIdOrName, options, kind) {
|
|
30613
30626
|
ensureOrgApiAuthenticated();
|
|
30614
30627
|
const id = await resolveEnvironmentId(envIdOrName);
|
|
30615
30628
|
const content = readFileContent(options);
|
|
@@ -30617,9 +30630,9 @@ async function envStartHookTestCommand(envIdOrName, options) {
|
|
|
30617
30630
|
let timedOut = false;
|
|
30618
30631
|
let errorMessage = null;
|
|
30619
30632
|
await orgAuthenticatedSseStream(
|
|
30620
|
-
`/v1/environments/${id}
|
|
30633
|
+
`/v1/environments/${id}/${kind}-hooks/${kind === "warm" ? "save-test/stream" : "test/stream"}`,
|
|
30621
30634
|
{
|
|
30622
|
-
body: { content },
|
|
30635
|
+
body: kind === "warm" ? { content, mode: options.save ? "save_test" : "test_only" } : { content },
|
|
30623
30636
|
onEvent: (event) => {
|
|
30624
30637
|
if (event.type === "progress" && event.message) {
|
|
30625
30638
|
console.log(import_chalk21.default.gray(event.message));
|
|
@@ -30641,49 +30654,77 @@ ${errorMessage}
|
|
|
30641
30654
|
process.exit(1);
|
|
30642
30655
|
}
|
|
30643
30656
|
if (timedOut) {
|
|
30644
|
-
console.log(import_chalk21.default.yellow(
|
|
30657
|
+
console.log(import_chalk21.default.yellow(`
|
|
30658
|
+
${kind === "warm" ? "Warm" : "Start"} hook timed out.
|
|
30659
|
+
`));
|
|
30645
30660
|
process.exit(1);
|
|
30646
30661
|
}
|
|
30647
30662
|
if (exitCode === 0) {
|
|
30648
30663
|
console.log(import_chalk21.default.green(`
|
|
30649
|
-
Start hook passed (exit code ${exitCode}).
|
|
30664
|
+
${kind === "warm" ? "Warm" : "Start"} hook passed${options.save ? " and was saved" : ""} (exit code ${exitCode}).
|
|
30650
30665
|
`));
|
|
30651
30666
|
} else {
|
|
30652
30667
|
console.log(import_chalk21.default.red(`
|
|
30653
|
-
Start hook failed (exit code ${exitCode ?? "unknown"}).
|
|
30668
|
+
${kind === "warm" ? "Warm" : "Start"} hook failed (exit code ${exitCode ?? "unknown"}).
|
|
30654
30669
|
`));
|
|
30655
30670
|
process.exit(1);
|
|
30656
30671
|
}
|
|
30657
30672
|
}
|
|
30658
|
-
async function
|
|
30673
|
+
async function envHookRepositoryHooksCommand(envIdOrName, kind) {
|
|
30659
30674
|
ensureOrgApiAuthenticated();
|
|
30660
30675
|
const id = await resolveEnvironmentId(envIdOrName);
|
|
30661
|
-
const
|
|
30676
|
+
const repositories = kind === "warm" ? (await orgAuthenticatedFetch(
|
|
30677
|
+
`/v1/environments/${id}/warm-hooks/repository-hooks`
|
|
30678
|
+
)).repositories.map((repository) => ({ ...repository, hook: repository.warm_hook })) : (await orgAuthenticatedFetch(
|
|
30662
30679
|
`/v1/environments/${id}/start-hooks/repository-hooks`
|
|
30663
|
-
);
|
|
30664
|
-
if (
|
|
30680
|
+
)).repositories.map((repository) => ({ ...repository, hook: repository.start_hook }));
|
|
30681
|
+
if (repositories.length === 0) {
|
|
30665
30682
|
console.log(import_chalk21.default.yellow("\nNo repositories bound to this environment.\n"));
|
|
30666
30683
|
return;
|
|
30667
30684
|
}
|
|
30668
30685
|
console.log(import_chalk21.default.green(`
|
|
30669
|
-
Repository
|
|
30686
|
+
Repository ${kind} hooks (${repositories.length}):
|
|
30670
30687
|
`));
|
|
30671
|
-
for (const repo of
|
|
30688
|
+
for (const repo of repositories) {
|
|
30672
30689
|
console.log(import_chalk21.default.white(` ${repo.repository_name} @${repo.default_branch}`));
|
|
30673
30690
|
if (repo.error) {
|
|
30674
30691
|
console.log(import_chalk21.default.red(` Error: ${repo.error}`));
|
|
30675
|
-
} else if (repo.
|
|
30692
|
+
} else if (repo.hook) {
|
|
30676
30693
|
console.log(import_chalk21.default.gray(` Source: ${repo.filename ?? "(unknown)"}`));
|
|
30677
|
-
console.log(import_chalk21.default.gray(` Commands (${repo.
|
|
30678
|
-
for (const cmd of repo.
|
|
30694
|
+
console.log(import_chalk21.default.gray(` Commands (${repo.hook.commands.length}):`));
|
|
30695
|
+
for (const cmd of repo.hook.commands) {
|
|
30679
30696
|
console.log(import_chalk21.default.gray(` ${cmd}`));
|
|
30680
30697
|
}
|
|
30681
30698
|
} else {
|
|
30682
|
-
console.log(import_chalk21.default.gray(` No
|
|
30699
|
+
console.log(import_chalk21.default.gray(` No ${kind}Hook defined.`));
|
|
30683
30700
|
}
|
|
30684
30701
|
console.log();
|
|
30685
30702
|
}
|
|
30686
30703
|
}
|
|
30704
|
+
async function envWarmHookGetCommand(envIdOrName) {
|
|
30705
|
+
return envHookGetCommand(envIdOrName, "warm");
|
|
30706
|
+
}
|
|
30707
|
+
async function envWarmHookSaveCommand(envIdOrName, options) {
|
|
30708
|
+
return envHookSaveCommand(envIdOrName, options, "warm");
|
|
30709
|
+
}
|
|
30710
|
+
async function envWarmHookTestCommand(envIdOrName, options) {
|
|
30711
|
+
return envHookTestCommand(envIdOrName, options, "warm");
|
|
30712
|
+
}
|
|
30713
|
+
async function envWarmHookRepositoryHooksCommand(envIdOrName) {
|
|
30714
|
+
return envHookRepositoryHooksCommand(envIdOrName, "warm");
|
|
30715
|
+
}
|
|
30716
|
+
async function envStartHookGetCommand(envIdOrName) {
|
|
30717
|
+
return envHookGetCommand(envIdOrName, "start");
|
|
30718
|
+
}
|
|
30719
|
+
async function envStartHookSaveCommand(envIdOrName, options) {
|
|
30720
|
+
return envHookSaveCommand(envIdOrName, options, "start");
|
|
30721
|
+
}
|
|
30722
|
+
async function envStartHookTestCommand(envIdOrName, options) {
|
|
30723
|
+
return envHookTestCommand(envIdOrName, options, "start");
|
|
30724
|
+
}
|
|
30725
|
+
async function envStartHookRepositoryHooksCommand(envIdOrName) {
|
|
30726
|
+
return envHookRepositoryHooksCommand(envIdOrName, "start");
|
|
30727
|
+
}
|
|
30687
30728
|
|
|
30688
30729
|
// src/index.ts
|
|
30689
30730
|
function parseBooleanOption(value) {
|
|
@@ -31212,54 +31253,42 @@ envFiles.command("delete <env> <path-or-id>").description("Delete a file by dest
|
|
|
31212
31253
|
process.exit(1);
|
|
31213
31254
|
}
|
|
31214
31255
|
});
|
|
31215
|
-
|
|
31216
|
-
|
|
31217
|
-
|
|
31218
|
-
|
|
31219
|
-
|
|
31220
|
-
|
|
31221
|
-
console.error(import_chalk22.default.red(`
|
|
31222
|
-
\u2717 ${error51.message}
|
|
31223
|
-
`));
|
|
31224
|
-
}
|
|
31225
|
-
process.exit(1);
|
|
31226
|
-
}
|
|
31227
|
-
});
|
|
31228
|
-
envStartHooks.command("save <env>").description("Save and activate a start hook (provide --content or --file)").option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action(async (env, options) => {
|
|
31229
|
-
try {
|
|
31230
|
-
await envStartHookSaveCommand(env, options);
|
|
31231
|
-
} catch (error51) {
|
|
31232
|
-
if (error51 instanceof Error) {
|
|
31233
|
-
console.error(import_chalk22.default.red(`
|
|
31234
|
-
\u2717 ${error51.message}
|
|
31235
|
-
`));
|
|
31236
|
-
}
|
|
31237
|
-
process.exit(1);
|
|
31238
|
-
}
|
|
31239
|
-
});
|
|
31240
|
-
envStartHooks.command("test <env>").description("Run a start hook in an isolated sandbox without saving it").option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action(async (env, options) => {
|
|
31241
|
-
try {
|
|
31242
|
-
await envStartHookTestCommand(env, options);
|
|
31243
|
-
} catch (error51) {
|
|
31244
|
-
if (error51 instanceof Error) {
|
|
31245
|
-
console.error(import_chalk22.default.red(`
|
|
31246
|
-
\u2717 ${error51.message}
|
|
31247
|
-
`));
|
|
31248
|
-
}
|
|
31249
|
-
process.exit(1);
|
|
31250
|
-
}
|
|
31251
|
-
});
|
|
31252
|
-
envStartHooks.command("repository-hooks <env>").description("List per-repo start hooks defined in replicas.json / replicas.yaml").action(async (env) => {
|
|
31253
|
-
try {
|
|
31254
|
-
await envStartHookRepositoryHooksCommand(env);
|
|
31255
|
-
} catch (error51) {
|
|
31256
|
-
if (error51 instanceof Error) {
|
|
31257
|
-
console.error(import_chalk22.default.red(`
|
|
31256
|
+
function registerEnvironmentHookCommands(parent, config3) {
|
|
31257
|
+
const label = `${config3.kind} hook`;
|
|
31258
|
+
const run = async (command) => {
|
|
31259
|
+
try {
|
|
31260
|
+
await command();
|
|
31261
|
+
} catch (error51) {
|
|
31262
|
+
if (error51 instanceof Error) console.error(import_chalk22.default.red(`
|
|
31258
31263
|
\u2717 ${error51.message}
|
|
31259
31264
|
`));
|
|
31265
|
+
process.exit(1);
|
|
31260
31266
|
}
|
|
31261
|
-
|
|
31262
|
-
}
|
|
31267
|
+
};
|
|
31268
|
+
const hooks = parent.command(`${config3.kind}-hooks`).description(config3.kind === "warm" ? "Manage env-level warm hooks (run while pre-warming workspaces)" : "Manage env-level start hooks (run on every workspace boot, before repo-level start hooks)");
|
|
31269
|
+
hooks.command("get <env>").description(`Show the active ${label} for an environment`).action((env) => run(() => config3.get(env)));
|
|
31270
|
+
hooks.command("save <env>").description(`Save and activate a ${label}${config3.kind === "warm" ? " without testing it" : ""}`).option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action((env, options) => run(() => config3.save(env, options)));
|
|
31271
|
+
hooks.command("test <env>").description(`Run a ${label} in an isolated sandbox without saving it`).option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action((env, options) => run(() => config3.test(env, options)));
|
|
31272
|
+
if (config3.saveTest) {
|
|
31273
|
+
const saveTest = config3.saveTest;
|
|
31274
|
+
hooks.command("save-test <env>").description(`Test a ${label} and save it only if the test passes`).option("-c, --content <content>", "Inline hook script").option("-f, --file <local-path>", "Read hook script from a local file").action((env, options) => run(() => saveTest(env, options)));
|
|
31275
|
+
}
|
|
31276
|
+
hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action((env) => run(() => config3.repositoryHooks(env)));
|
|
31277
|
+
}
|
|
31278
|
+
registerEnvironmentHookCommands(environment, {
|
|
31279
|
+
kind: "warm",
|
|
31280
|
+
get: envWarmHookGetCommand,
|
|
31281
|
+
save: envWarmHookSaveCommand,
|
|
31282
|
+
test: envWarmHookTestCommand,
|
|
31283
|
+
saveTest: (env, options) => envWarmHookTestCommand(env, { ...options, save: true }),
|
|
31284
|
+
repositoryHooks: envWarmHookRepositoryHooksCommand
|
|
31285
|
+
});
|
|
31286
|
+
registerEnvironmentHookCommands(environment, {
|
|
31287
|
+
kind: "start",
|
|
31288
|
+
get: envStartHookGetCommand,
|
|
31289
|
+
save: envStartHookSaveCommand,
|
|
31290
|
+
test: envStartHookTestCommand,
|
|
31291
|
+
repositoryHooks: envStartHookRepositoryHooksCommand
|
|
31263
31292
|
});
|
|
31264
31293
|
environment.action(async () => {
|
|
31265
31294
|
try {
|