chore: migrate to oxlint and oxfmt

Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-14 14:31:43 +00:00
parent 912ebffc63
commit c379191f80
1480 changed files with 28608 additions and 43547 deletions

View File

@@ -2,10 +2,7 @@
* Display utilities for sandbox CLI
*/
import type {
SandboxBrowserInfo,
SandboxContainerInfo,
} from "../agents/sandbox.js";
import type { SandboxBrowserInfo, SandboxContainerInfo } from "../agents/sandbox.js";
import type { RuntimeEnv } from "../runtime.js";
import {
formatAge,
@@ -20,11 +17,7 @@ type DisplayConfig<T> = {
renderItem: (item: T, runtime: RuntimeEnv) => void;
};
function displayItems<T>(
items: T[],
config: DisplayConfig<T>,
runtime: RuntimeEnv,
): void {
function displayItems<T>(items: T[], config: DisplayConfig<T>, runtime: RuntimeEnv): void {
if (items.length === 0) {
runtime.log(config.emptyMessage);
return;
@@ -36,10 +29,7 @@ function displayItems<T>(
}
}
export function displayContainers(
containers: SandboxContainerInfo[],
runtime: RuntimeEnv,
): void {
export function displayContainers(containers: SandboxContainerInfo[], runtime: RuntimeEnv): void {
displayItems(
containers,
{
@@ -48,13 +38,9 @@ export function displayContainers(
renderItem: (container, rt) => {
rt.log(` ${container.containerName}`);
rt.log(` Status: ${formatStatus(container.running)}`);
rt.log(
` Image: ${container.image} ${formatImageMatch(container.imageMatch)}`,
);
rt.log(` Image: ${container.image} ${formatImageMatch(container.imageMatch)}`);
rt.log(` Age: ${formatAge(Date.now() - container.createdAtMs)}`);
rt.log(
` Idle: ${formatAge(Date.now() - container.lastUsedAtMs)}`,
);
rt.log(` Idle: ${formatAge(Date.now() - container.lastUsedAtMs)}`);
rt.log(` Session: ${container.sessionKey}`);
rt.log("");
},
@@ -63,10 +49,7 @@ export function displayContainers(
);
}
export function displayBrowsers(
browsers: SandboxBrowserInfo[],
runtime: RuntimeEnv,
): void {
export function displayBrowsers(browsers: SandboxBrowserInfo[], runtime: RuntimeEnv): void {
displayItems(
browsers,
{
@@ -75,9 +58,7 @@ export function displayBrowsers(
renderItem: (browser, rt) => {
rt.log(` ${browser.containerName}`);
rt.log(` Status: ${formatStatus(browser.running)}`);
rt.log(
` Image: ${browser.image} ${formatImageMatch(browser.imageMatch)}`,
);
rt.log(` Image: ${browser.image} ${formatImageMatch(browser.imageMatch)}`);
rt.log(` CDP: ${browser.cdpPort}`);
if (browser.noVncPort) {
rt.log(` noVNC: ${browser.noVncPort}`);
@@ -99,21 +80,15 @@ export function displaySummary(
): void {
const totalCount = containers.length + browsers.length;
const runningCount =
containers.filter((c) => c.running).length +
browsers.filter((b) => b.running).length;
containers.filter((c) => c.running).length + browsers.filter((b) => b.running).length;
const mismatchCount =
containers.filter((c) => !c.imageMatch).length +
browsers.filter((b) => !b.imageMatch).length;
containers.filter((c) => !c.imageMatch).length + browsers.filter((b) => !b.imageMatch).length;
runtime.log(`Total: ${totalCount} (${runningCount} running)`);
if (mismatchCount > 0) {
runtime.log(
`\n⚠ ${mismatchCount} container(s) with image mismatch detected.`,
);
runtime.log(
` Run 'clawdbot sandbox recreate --all' to update all containers.`,
);
runtime.log(`\n⚠ ${mismatchCount} container(s) with image mismatch detected.`);
runtime.log(` Run 'clawdbot sandbox recreate --all' to update all containers.`);
}
}
@@ -127,18 +102,14 @@ export function displayRecreatePreview(
if (containers.length > 0) {
runtime.log("📦 Sandbox Containers:");
for (const container of containers) {
runtime.log(
` - ${container.containerName} (${formatSimpleStatus(container.running)})`,
);
runtime.log(` - ${container.containerName} (${formatSimpleStatus(container.running)})`);
}
}
if (browsers.length > 0) {
runtime.log("\n🌐 Browser Containers:");
for (const browser of browsers) {
runtime.log(
` - ${browser.containerName} (${formatSimpleStatus(browser.running)})`,
);
runtime.log(` - ${browser.containerName} (${formatSimpleStatus(browser.running)})`);
}
}
@@ -150,13 +121,9 @@ export function displayRecreateResult(
result: { successCount: number; failCount: number },
runtime: RuntimeEnv,
): void {
runtime.log(
`\nDone: ${result.successCount} removed, ${result.failCount} failed`,
);
runtime.log(`\nDone: ${result.successCount} removed, ${result.failCount} failed`);
if (result.successCount > 0) {
runtime.log(
"\nContainers will be automatically recreated when the agent is next used.",
);
runtime.log("\nContainers will be automatically recreated when the agent is next used.");
}
}